Score:1

Removed LVM swap partition, and now booting takes a lot of time because of errors

cn flag

Context

Originally I had the following partition structure

nvme0n1
├─nvme0n1p1             /boot/efi
└─nvme0n1p2
  ├─ubuntu--vg-root     /
  └─ubuntu--vg-swap_1   swap

Then I decided to remove the swap partition and use, instead, a swapfile. I created a file, called mkswap /swapfile on it, swapoff -a and then swapon /swapfile. I then edited /etc/fstab and changed the line

/dev/mapper/ubuntu--vg-swap_1   none swap sw  0 0

to

/swapfile  none swap sw  0 0

Rebooting worked perfectly, so I opened gparted and deleted the swap partition to extend root (which I did instead using lvexpand), so my partitions look now (as for the command lsblk)

nvme0n1
├─nvme0n1p1             /boot/efi
└─nvme0n1p2
  └─ubuntu--vg-root     /

The problem

I must have messed up here because now reboot takes al least 25 seconds (instead of 4) and it looks like it's pausing boot to look for swap partition, as the following message appears at least 5 times before booting normally

failed to find logical volume ubuntu-vg/swap_1

What I've tried (according to what I've found online)

  1. running update-grub (nowhere in grub.cfg is mentioned swap_1)
  2. running update-initramfs -u
  3. file /etc/initramfs-tools/conf.d/resume doesn't exist, so nothing to change here
  4. lsblk and lvdisplay only show the root partition

I'm afraid there must still be somewhere a notion of the swap partition in the LVM configuration, as I didn't use its commands to remove it, but I've found nowhere a place that lists swap_1 as a partition (except for some files in /etc/lvm/archive, but I guess they aren't useful for me). I've even run a full disk search for the content swap_1 in any file, but only error logs contained that work in text

Score:1
cn flag

As it turns out, update-initramfs -u was not enough, as it did not update the current kernel initramfs (but instead used one of the other kernels I was not using) and kept using the old one with the old partition. The solution was to specify the kernel that was currently loaded

sudo update-initramfs -k $(uname -r) -u

(in doubt I've also added RESUME=/swapfile to /etc/initramfs-tools/conf.d/resume which previously did not exist, so also that)

Terrance avatar
id flag
Or you can update all installed kernels at once by using `sudo update-initramfs -u -k all`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.