1

I updated last night as seen in my logs.

Start-Date: 2020-03-16  13:56:51
Commandline: apt upgrade
Requested-By: logan (1001)
Install: linux-image-5.3.0-42-generic:amd64 (5.3.0-42.34, automatic), linux-tools-5.3.0-42:amd64 (5.3.0-42.34, automatic), linux-headers-5.3.0-42-gener
ic:amd64 (5.3.0-42.34, automatic), linux-modules-extra-5.3.0-42-generic:amd64 (5.3.0-42.34, automatic), linux-headers-5.3.0-42:amd64 (5.3.0-42.34, auto
matic), linux-tools-5.3.0-42-generic:amd64 (5.3.0-42.34, automatic), linux-modules-5.3.0-42-generic:amd64 (5.3.0-42.34, automatic)
Upgrade: linux-tools-generic:amd64 (5.3.0.40.34, 5.3.0.42.36), linux-headers-generic:amd64 (5.3.0.40.34, 5.3.0.42.36), linux-libc-dev:amd64 (5.3.0-40.32, 5.3.0-42.34), linux-image-generic:amd64 (5.3.0.40.34, 5.3.0.42.36), linux-tools-common:amd64 (5.3.0-40.32, 5.3.0-42.34), linux-generic:amd64 (5.3.0.40.34, 5.3.0.42.36)
End-Date: 2020-03-16  13:57:26

This morning I got dropped into initramfs with the following message.

WARNING: Option 'size' missing in crypttab for plain dm-crypt
mapping cryptswap1. Please read
/usr/shar/doc.cryptsetup-initramfs/README.initramfs.gs and add the correct 
'size' option to your crypttab(5).
crypt
cryptsetup: waiting for encrypted source device /swapfile......
Alert! encrypted device /swapfile does not exist! can't unlock.
Check cryptopt=source= bootarg: cat /proc/cmdline
or missing modules, devices: cat /proc/modules; ls /dev
Dropping to shell.

I didn't think I had a swap drive (IT from work setup this laptop last month so I'm not sure). I found a 1gb swap running free after removing the crypttab file which I then removed using sudo swapoff -a and commenting out the crypttab file. I couldn't find any fstab entry. The startup error persists although now my swap shows a size 0 after startup.

It was a real pain to boot due to all the similar cases online suggesting editing /etc/fstab and /etc/crypttab. fstab was empty and crypttab was located at cryptroot/cryptab in the ash shell it put me in which confused me. I simply deleted the crypttab file and ran exit to boot.

Since everyone in running Ubuntu 19.10 at work will has the same setup, I was wondering if it was caused by my update last night, and if anyone here could help me figure out which update caused this or if there is any other cleanup I should do.I believe I should remove the crypttab file and any mention of swap in fstab or add a valid size. Or I'll have this problem next time I boot up. My crypttab looks like this

# <target name> <source device>     <key file>  <options>
cryptswap1 /swapfile /dev/urandom swap,offset=1024,cipher=aes-xts-plain64

Bonus points for helping me understand where the shell I was dropped into was running or how I should get into a shell with better editing options once dropped into ash (ie. nano, vi or vim). I saved crypttab to /crypttab.old but now that I'm logged in I can't find it.

Additionally I've removed fstab comment so my fstab only has the /swapfile/none and ran sudo cryptsetup remove cryptswap1 and removed /etc/crypttab but I am still failing on boot with the same issue. I also tried the opposite I uncomented fstab and cryptab and added size=512 to crypt tab. The size didn't show up in the file on reboot and it failed similarly.

Update: fixed it by following the steps here it turns out I needed to update initramfs to make any of the changes take effect.

Sarzorus
  • 13
  • 5
  • Please verify whether you have swap or not by running _free -mh_ Canonical's recommendations for swap space are here: https://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html – K7AAY Mar 17 '20 at 17:51
  • I had a 1gb swap when it started up, since then I disabled it following the tutorials online. I'm very confused about how swap was running when I started up when I had to remove that crypttab file to startup. – Sarzorus Mar 17 '20 at 19:09
  • Your question says "I don't think I have a swap drive (IT from work setup this laptop last month so I'm not 100% sure)." If you are now certain, based on what you saw when running _free -mh_ there is no swap space, please click [edit] and replace that line in the question with your findings. – K7AAY Mar 17 '20 at 21:33
  • I'll edit it but I can't be sure. Something failed at trying to spin up swap (at the decrypt step), so having swap now doesn't mean I had it before, it could easily be good error handling. Definitely no swap partition. I've done what I can to remove it entirely. – Sarzorus Mar 18 '20 at 15:04

1 Answers1

0

I am running Ubuntu 19.10 with encrypted swap too and I've run into the same issue as well. I don't know a full remedy for this but for now I have disabled the encrypted swap mount as follows (NOTE - these steps worked for me, but may not work for you; adjust as needed!):

  1. In Grub, boot through Advanced options, choose the previous kernel/initramfs version. In my case it was 5.3.0-40-generic (the new one that has broken things is 5.3.0-42-generic)
  2. Remove swap mount lines from /etc/crypttab and /etc/fstab
  3. Run cryptsetup remove /dev/mapper/cryptswap1 to disable encrypted swap
  4. In /boot directory, backup old initrd.img file.
  5. Create new file using update-initramfs -c -k 5.3.0-42-generic
  6. Update GRUB config with update-grub and reboot

Another option is to resort to the previous kernel/initramfs bundle if they work for you as I did through Advanced options in GRUB menu. This will require manual selection during bootup but may be a good enough option if you don't reboot too often.

Hope this helps.

Argenet
  • 116
  • 1