17.10 shutdown/swap issue

Hello all, I got some time today to carry on looking at my ACER laptop very slow shutdown issue. I have the problem noted in https://ubuntu-mate.community/t/slow-shutdown-process/15218 but there is a workaround using the "sudo poweroff -f" command.

For me there seem to be multiple issues, the one I want to address first is use of the swapfile. I seem to have a very odd configuration (despite choosing the defaults from a clean install). Perhaps related to maybe a configuration issue on home drive/swapfile encryption.

I think the problem is my system is not using the swapfile at all. I would like to investigate further, I seem to have come to a place where I'm asking for help on the next steps.

I am not using a swap partition, unsure why as I thought the default installer did. Here is a gparted screenshot

Here is a dump of
$ sudo fdisk -l
[sudo] password for andy:
Disk /dev/loop0: 83 MiB, 87080960 bytes, 170080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop1: 8.6 MiB, 9011200 bytes, 17600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop2: 83.1 MiB, 87089152 bytes, 170096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop3: 83.7 MiB, 87793664 bytes, 171472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop4: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 46474A93-8A0E-4431-89D6-085BDD30EDBA
Device       Start        End    Sectors  Size Type
/dev/sda1     2048    1050623    1048576  512M EFI System
/dev/sda2  1050624 1953523711 1952473088  931G Linux filesystem

Disk /dev/mapper/cryptswap1: 2 GiB, 2146959360 bytes, 4193280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

This shows a cryptswap, but the file /etc/crypttab contains:

cryptswap1 /swapfile /dev/urandom swap,offset=1024,cipher=aes-xts-plain64

My /etc/fstab contains

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=f1ea4097-4ae6-4b62-ad3d-aacd53b7b0db /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=8173-2AAD  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

I'm not 100% sure that these configurations match properly. When I:

$ sudo swapon -a
swapon: /swapfile: read swap header failed

A bit of research tells me that use of the swapfile is not happening. I can

$ swapon -s
Filename				Type		Size	Used	Priority
/dev/dm-0                              	partition	2096636	0	-1

Which supports this.

A look at / gives me

 $ ls -la /
total 2097264
drwxr-xr-x  24 root root       4096 Dec  2 10:04 .
drwxr-xr-x  24 root root       4096 Dec  2 10:04 ..
drwxr-xr-x   2 root root       4096 Oct 29 18:57 bin
drwxr-xr-x   4 root root       4096 Dec  2 10:05 boot
drwxrwxr-x   2 root root       4096 Oct 29 18:34 cdrom
drwxr-xr-x  20 root root       4300 Dec  3 13:46 dev
drwxr-xr-x 140 root root      12288 Dec  3 13:05 etc
drwxr-xr-x   4 root root       4096 Oct 29 18:35 home
lrwxrwxrwx   1 root root         33 Dec  2 10:04 initrd.img -> boot/initrd.img-4.13.0-17-generic
lrwxrwxrwx   1 root root         33 Oct 29 18:35 initrd.img.old -> boot/initrd.img-4.13.0-16-generic
drwxr-xr-x  24 root root       4096 Oct 30 19:34 lib
drwxr-xr-x   2 root root       4096 Oct 18 14:52 lib64
drwx------   2 root root      16384 Oct 29 18:27 lost+found
drwxr-xr-x   3 root root       4096 Oct 30 07:26 media
drwxr-xr-x   2 root root       4096 Oct 18 14:52 mnt
drwxr-xr-x   2 root root       4096 Oct 18 14:52 opt
dr-xr-xr-x 229 root root          0 Dec  3 13:45 proc
drwx------   7 root root       4096 Dec  3 13:04 root
drwxr-xr-x  32 root root        920 Dec  3 13:53 run
drwxr-xr-x   2 root root      12288 Oct 29 18:57 sbin
drwxr-xr-x   5 root root       4096 Oct 29 18:53 snap
drwxr-xr-x   2 root root       4096 Oct 18 14:52 srv
-rw-------   1 root root 2147483648 Dec  3 13:46 swapfile
dr-xr-xr-x  13 root root          0 Dec  3 13:49 sys
drwxrwxrwt  13 root root       4096 Dec  3 15:06 tmp
drwxr-xr-x  10 root root       4096 Oct 18 14:52 usr
drwxr-xr-x  14 root root       4096 Oct 18 15:01 var
lrwxrwxrwx   1 root root         30 Dec  2 10:04 vmlinuz -> boot/vmlinuz-4.13.0-17-generic
lrwxrwxrwx   1 root root         30 Oct 29 18:35 vmlinuz.old -> boot/vmlinuz-4.13.0-16-generic

Which shows a swapfile at least being there.

I'm now not sure what to do? How do I prove that the swapfile isn't being used, and if so how do I fix that problem? Is my configuration set up correctly and what other information can I look at to help me solve this please?

(yes its fully updated)

I'm unsure if related but on boot I do see errors about not being able to read uefi, I suspect a failure of a previous install that tried to encrypt my disk may have something to do with this also?

Thanks

HI andyp6,

swap is only used in the 17.10 when needed and doesn’t write a separate partition for it, it allocates space on the HDD according to when and if it is needed!. :grinning:

Even though you said you are updated, try changing your software download location and updating again:

Thanks WM, I did try this a few days ago but no change. What seems to have made a difference is that from some googling I switched off and re-enabled the swapfile (swapoff/swapon) and things seem to be ok for the shutdown now.

I still have errors at boot that I will investigate when I have time. Thanks again.
Andy