I was trying to increase the swap size of my Ubuntu. I, naïve, followed the steps of this answer:
Check the swap that is in use:
sudo swapon -s
If swap partition(s) are found:
sudo swapoff -a sudo nano -Bw /etc/fstab
Add # before the UUID of the swap partition(s):
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none swap sw 0 0
Add a line for the swapfile, if one does not exist:
swapfile none swap sw 0 0
Create the swapfile:
sudo fallocate -l XG /swapfile*
where X is swapfile's size in GB:
sudo mkswap /swapfile sudo chmod 0600 /swapfile sudo swapon /swapfile
Reboot:
sudo reboot
After that, my computer only starts in recovery mode.
I tried to follow this anwser. But the error unable to resolve host my-laptop-name: Temporary failure in name resolution
appears and make the process to fail.
I tried to fix it following another answer that says that the name of the host in /etc/hostname and /etc/hosts must be the same. It was wrong in /etc/hosts. But the file is read-only and I can't write on it, even with sudo.
I checked /etc/fstab and notice that I, dumb, put # to the UUID to the the boot disk, not only to the swap thing. I tried to erase the #. But that file is read-only too. I want to kill myself right now :).
If it's not clear after all this, I don't know much about Linux.
Edit 1:
My version of Ubuntu is Desktop 22.04.3 LTS
When I do sudo sudo nano /etc/fstab
to erase # from boot line, [ File '/etc/fstab' is unwritable
. The same happens with /etc/hosts.
Edit 2:
I edited the boot option in the GRUB and it worked to edit both /etc/fstab and /hosts.
Now I am struggling because when I try to boot normally the system raises an error about swap. This the error:
[0.219748] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PC00.DGPV],
AE_NOT_FOUND (20230331/psargs-330)
[0.219765 ACPI Error: Aborting method \SB.PC00.PEG0.PCRP._OFF due to previous error (AE_NOT_FOUND) (20230331/psparse-596)
/dev/nvme0n1p2: clean, 848739/15597568 files, 29875721/62383360 blocks
[2.251365] systemd[1]: Failed to activate swap /swapfile.
[FAILED] Failed to activate swap /swapfile.
[DEPEND] Dependency failed for Swaps.
[3.057060] iwlwifi <ipv6> BIOS contains WGDS but no WRDS
I tried to recreate swap file like in this answer. These are the commands I run to do so:
swapoff -a
rm /swapfile
dd if=/dev/zero of=/swapfile bs=1M count=4096
chmod 600 /swapfile
mkswap /swapfile
#anwer to this line is:
setting up swapspace version 1, size 4 GiB
no label, UUID=<long UUID>
swapon /swapfile
Then I review /etc/fstab. At the end there's the line /swapfile none swap sw 0 0
. There's the line with UUID with the boot partion too. But there's no line with the UUID that mkswap /swapfile
returned. And the error when trying to boot still happens.
/etc/fstab
or the file-system table for your system required elevated privileges to edit, ie. did you include asudo
command at the start of your edit command? (ie. to elevate your privileges so you had access to WRITE to the file??) – guiverc Feb 05 '24 at 01:00dmesg
,journactl
etc) to see why); then it maybe reboot using live and perform file-system checks OR checking drive health or for hardware issues.. You've added 22.04 or the release; not which product (Server? Desktop? etc) as they have different defaults – guiverc Feb 05 '24 at 01:26journalctl
,dmesg
) at the time when you failed to activate the swapfile. You can also runblkid /swapfile
to check the file itself. – mcendu Feb 05 '24 at 07:47