System Not Booting - Failed to activate swap /swapfile

Solution 1:

That all looks normal, but let's recreate the /swapfile.

Boot to Recovery Mode like you just did, and do this...

Note: Incorrect use of the dd command can cause data loss. Suggest copy/paste.

In the terminal (or root # prompt)...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm nnG RAM and 4G swap

Confirm this /swapfile line at the end of /etc/fstab... and confirm no other “swap” lines...

To edit, use sudo -H gedit /etc/fstab or sudo pico /etc/fstab

/swapfile    none    swap    sw      0   0

reboot                    # reboot and verify operation

Update #1:

/etc/fstab was messed up and causing the file system to be read-only. Only had 1 hour on freshly installed Ubuntu, so I recommended to reinstall Ubuntu again.

UUID="fae3ba3a-abaf-4eca-8139-40d5328d017c" /srv ext4 errors=remount-ro 0