My brother invited me to join his Civ 6 game recently. An initial diagnosis of my Dell XPS 13 (Ubuntu 18.04) showed I had only 2 gigs however for Steam to use for a swap file. Whenever I activated the game in Steam, it hung on the loading data page.. forever!

Having never messed with swap files before I used the excellent tutorial provided on It's Foss to get started. I swapoff the file, and mkswap something larger. But oh wait, wasn't I supposed to fallocate a new swap file. Oops! I just deleted the old swap file (mkswap does that) without adding a new file first! Suddenly my browser and the toolbar disappear. In a panic I power down and attempt to reboot - wrong move apparently. Now I'm stuck at Grub. Every time I try rebooting the Dell leaves me weeping at the Ubuntu splash screen.

Clearly I need a new swap file simply to reboot, much less run Civ 6.
Additional homework, including:

helped me patch together something close to a script for accessing BASH through GRUB. My first run through the Foss process gives notice upon swapon that I just created a four gig file, to whit- 4194300k swap on /swapfile. Priority: -2 extents:29 across : 17580028k SSFS -looks good huh?
To make sure I'm on the same page I run the Its Foss pipe instructions, thinking this will save the swapfile, and activate it for use. I reboot, only to find myself once more left crying on the Ubuntu splash page. I walk back through my process to regain BASH, and free -h returns a swap file, however swapon --show returns nothing.

So what have I done? Did I actually create a swap file I can use? If so how have a failed to inform the system to use it? If not, what pitfalls should I avoid creating a swapfile the second time around? Help! I can already hear the settlers and sails of other Civilizations claiming the globe as their own.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

  • 1
    Did you edit /etc/fstab to tell the system about the new swapfile? Swap is not required to boot, but a missing swapfile will cause the system to hang for a couple minutes during boot.
    – user535733
    Commented Aug 11, 2020 at 20:13
  • Boot to Recovery Mode from the GRUB menu, Root Access, then type: free -h and swapon --show and grep -i swap /etc/fstab. Start comments to me with @heynnema or I'll miss them.
    – heynnema
    Commented Aug 11, 2020 at 20:43
  • @heynnema I followed your advice, and found the swapfile! However it still isn't booting. So I ran fsck and was told I have the wrong count on free blocks. Fair enough, however Recovery Mode will not then recover on the root system where this is an issue..
    – Rogue_417
    Commented Aug 15, 2020 at 22:18
  • Show me the output of the commands that I requested earlier. Please see my answer. If it's helpful, please remember to accept it by clicking on the checkmark icon that appears just to the left of my answer. Thanks!
    – heynnema
    Commented Aug 15, 2020 at 22:27

1 Answer 1



To check/repair your file system...

  • boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
  • open a terminal window by pressing Ctrl+Alt+T
  • type sudo fdisk -l
  • identify the /dev/sdXX device name for your "Linux Filesystem"
  • type sudo fsck -f /dev/sdXX, replacing sdXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot


To create a 4G /swapfile...

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

Boot to Recovery Mode...

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 ??G RAM and 4G swap
reboot                    # reboot and verify operation

Confirm this line in /etc/fstab...

Note: Confirm that this is the only line that contains "swap".

/swapfile    none    swap    sw      0   0

Update #1:

Go to https://www.memtest86.com/ and download/run their free memtest to test your memory. Get at least one complete pass of all the 4/4 tests to confirm good memory. This may take many hours to complete.

  • I have images showing these steps in recovery mode, but cannot seem to paste through stack exchange to a Comment. I will walk through the steps using live USB and paste them here tomorrow. Thanks for your patience!
    – Rogue_417
    Commented Aug 17, 2020 at 17:55
  • @Rogue_417 You can't post images into comments. You'll have to edit your question and add them there.
    – heynnema
    Commented Aug 17, 2020 at 18:02
  • #heynnema when I attempt to fsck from the live USB, it cannot find the FS. So I look in Nautilus. ubuntu@ubuntu:~$ sudo ls root@major-XPS-13-9360/home ls: cannot access 'root@major-XPS-13-9360/home': No such file or directory ubuntu@ubuntu:~$ sudo ls root@major-XPS-13-9360 / ls: cannot access 'root@major-XPS-13-9360': No such file or directory /: bin dev initrd.img lib64 opt root snap tmp vmlinuz boot etc initrd.img.old media proc run srv usr vmlinuz.old cdrom home lib mnt rofs sbin sys var
    – Rogue_417
    Commented Aug 18, 2020 at 14:31
  • I find and mount it. sudo mount /dev/sda2 /mount_point ubuntu@ubuntu:~$ cd /dev/sda2 bash: cd: /dev/sda2: Not a directory ubuntu@ubuntu:~$ ls /dev/sda2 /dev/sda2 ubuntu@ubuntu:~$ ls /dev/sda2/ ls: cannot access '/dev/sda2/': Not a directory ubuntu@ubuntu:~$ ls /mount_point ls: cannot open directory '/mount_point': Permission denied ubuntu@ubuntu:~$ sudo ls /mount_point bin dev initrd.img lib64 mnt root snap sys var boot etc initrd.img.old lost+found opt run srv tmp vmlinuz cdrom home lib media proc sbin swapfile usr vmlinuz.old
    – Rogue_417
    Commented Aug 18, 2020 at 14:38
  • Although you can see the swapfile listed, I cannot run free -h to prove the system recognizes it as such. Again this is all from the live USB. ubuntu@ubuntu:~$ sudo free -h /mount_point/root total used free shared buff/cache available Mem: 7.5G 1.6G 2.2G 833M 3.7G 4.9G Swap: 0B 0B 0B
    – Rogue_417
    Commented Aug 18, 2020 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .