Challenges to creating and using SWAP files in Ubuntu 18.04

Clearly Akito I missed something the first two times around, so I looked to retrace my steps today.

  1. I edit the GRUB menu, rewriting the linux entry from ro quiet splash $vt_handoff to rw init=/bin/bash -I then hit CTRL-X as recommended here. https://linuxconfig.org/how-to-reset-lost-root-password-on-ubuntu-18-04-bionic-beaver-linux note this brings me back to GRUB so I hit c for the command line.

  2. Having achieved root@(none))/# I type free -h. It lists no swap memory

  3. root@(none))/# swapon –show returns nothing.

  4. fallocate -l 4G /swapfile as per https://itsfoss.com/create-swap-file-linux/ it returns root@(none)/#

5. chmod 600 /swapfile which returns same as per ibid

  1. mkswap /swapfile returns “ Setting up swapspace version 1, size = 4 GiB(4294963200 bytes) no label, UUID= 5317-8850-41b6-b075-d6de972fbb17 and root@(none)/# as per Ibd

  2. swapon /swapfile returns { 1014.650463}Adding 4194300k swap on /swapfile. Priority -2 extents: 29 across : 17500028k SSFS

  3. swapon –show returns 1 FILE, SIZE 4G USED 0B PRIO -2 as per Ibd.

  4. I back up the file sudo cp /etc/fstab /etc/fstab.back which returns root@(none)/# as per Ibd.

  5. I enter the following command echo ‘/swapfile none swap sw 0 0’ | tee -a /etc/fstab (Identical to Ibd save that, as I cannot sudo on this command line, I omitted it.) This returns /swapfile none swap sw 0 0 and root@(none)/#

  6. I press the power button, then press it again to start the boot process. Besides mentioning its booting into insecure mode all I get is the splash screen, little orange dots blinking away…

I presume by now you can tell I’m not master of the command line. This said I’m guessing I failed to actually reach my root, as no sudo was used. What did I miss?