PDA

View Full Version : [SOLVED] boot problem after removing swap logical volume



janvlug
2nd April 2015, 04:10 PM
I changed a few things in my lvm configuration.
One of the things was that I deleted a swap logical volume.
Now my system does not boot anymore into the full Fedora environment, but into the dracut shell.

I guess that the problem is that the initramfs is still somehow referring to the removed logical swap volume, because one of the last messages printed is:

Warning: /dev/VolumeGroup/SwapVolume does not exist

This thread (http://forums.fedoraforum.org/showthread.php?t=292088) makes me think that I have to regenerate an initramfs by doing:
dracut --regenerate-all --force

Now my question is: how should I do this now I'm only able to boot to the dracut# shell?

wintonian
2nd April 2015, 05:52 PM
I guess you could try using a live CD and 'chroot', making sure you mount /boot in addition to the root fs?

I have no idea if you would need to mount anything else, but I'm sure someone else will have the commands needed.

nsnbm
3rd April 2015, 12:03 AM
janvlug wrote:


One of the things was that I deleted a swap logical volume

There are boot problems with the removal of partitions or volumes from /etc/fstab. There is a thread on the forum about this which you could search for. If you could restore the swap volume and put it's config in /etc/fstab then you may be able to boot again.

There is an example of using the dracut shell in the dracut manpage under the heading: "Accessing the root volume from the dracut shell." I have used this successfully, but not with your problem of having deleted a swap volume, and I don't use lvm.

rccharles
3rd April 2015, 12:16 AM
I changed a few things in my lvm configuration.
One of the things was that I deleted a swap logical volume.
Now my system does not boot anymore into the full Fedora environment, but into the dracut shell.


I ran into this with a restore from backup. It drove me nuts. I'm sure this was a hack, but I could not figure out who was referencing the swap volume.

Create a new small partition somewhere ... don't know small will be ok. 50 to 100 meg. I use gparted off of a bootable rescue cd.

Find out what uuid is missing. You will see this in a message. Use some uuid command to set uuid of small partition to the missing uuid. Some how I get the missing uuid into a file on an ext4 flash drive. I recall you can just mount an ext4 flash drive without have to specify any parms.

http://www.sudo-juice.com/how-to-change-the-uuid-of-a-linux-partition/

some commands of interest:
sudo blkid; lsblk -f; sudo fdisk -l; drutil info; df ;
lsblk -f; blkid; tune2fs; swaplabel;

What a hack, but worked for me.

Robert

jpollard
3rd April 2015, 01:45 AM
It is usually the fstab stored in the initramfs. If you change your system fstab, you also have to rebuild the initramfs used for boot.

And if you also try to run your system in local time then you also have to force the /etc/adjtime into the initramfs as well.

rccharles
3rd April 2015, 04:12 AM
It is usually the fstab stored in the initramfs.
Thanks. At least for me, that explains what happened

Robert

stevea
3rd April 2015, 05:37 AM
Thanks. At least for me, that explains what happened

Robert

Yes indeed - it's a great explanation ... except for one minor flaw - it's wrong.


It is usually the fstab stored in the initramfs.

FAIL - there is no fstab in the initramfs - never was.



The moderns initrams is a bit more complex that the older, its a simple cpio archive w/ a little x86 firmware followed by a gzip compressed cpio archive that represents the kernels first root file system. If you crack it open you will see ...

[stevea@lycoperdon foo]$ ls -l etc/fsta*
-rw-r--r-- 1 stevea stevea 0 Apr 2 23:53 etc/fstab.empty
[stevea@lycoperdon foo]$ ls -l /usr/sbin/init
lrwxrwxrwx 1 root root 22 Mar 27 14:16 /usr/sbin/init -> ../lib/systemd/systemd

So there is a zero length fstab.empty and a 'init' is really systemd .

When I search for my swap uuid I get ...

[stevea@lycoperdon foo]$ fgrep -lr '4a51caa7-35a7-4c00-ad29-8e553cbfff73'
usr/lib/dracut/hostonly-files
usr/lib/dracut/hooks/initqueue/finished/devexists-\x2fdev\x2fdisk\x2fby-uuid\x2f4a51caa7-35a7-4c00-ad29-8e553cbfff73.sh
usr/lib/dracut/hooks/emergency/80-\x2fdev\x2fdisk\x2fby-uuid\x2f4a51caa7-35a7-4c00-ad29-8e553cbfff73.sh
etc/cmdline.d/95resume.conf
[stevea@lycoperdon foo]$ file $(fgrep -lr '4a51caa7-35a7-4c00-ad29-8e553cbfff73')
usr/lib/dracut/hostonly-files: ASCII text
usr/lib/dracut/hooks/initqueue/finished/devexists-\x2fdev\x2fdisk\x2fby-uuid\x2f4a51caa7-35a7-4c00-ad29-8e553cbfff73.sh: ASCII text
usr/lib/dracut/hooks/emergency/80-\x2fdev\x2fdisk\x2fby-uuid\x2f4a51caa7-35a7-4c00-ad29-8e553cbfff73.sh: ASCII text
etc/cmdline.d/95resume.conf: ASCII text



Dracut examines your root/etc/fstab and creates several scripts for initramfs that access swap.





Let me make clear that this is IMO an error/problem that you should report it to redhat bugzilla. Lack of swap should not prevent boot. Warnings are sufficient.

janvlug
3rd April 2015, 11:26 AM
Solved. Thanks for your tips!

In the end the problem was *not* related to dracut/initramfs.

The problem was that the grub2 boot parameters in /boot/grub2/grub.cfg still had a reference to the old VolumeGroup/SwapVolume:

rd.lvm.lv=VolumeGroup/SwapVolume

This is how I found out:
I booted a fedora 21 live image and in a terminal as root I did:

mkdir /mountjan
(then I mounted the root file system, on /dev/sdc1 in my case):

mount /dev/sdc1 /mountjan/
(then I mounted the boot file system, on /dev/sda1 in my case):

mount /dev/sda1/mountjan/boot/
(changed root to the now mounted root file system on the disk):

chroot /mountjan
<got some warnings, ignored them>

cd /boot
fgrep -lri SwapVolume
(with this result:)

grub2/grub.cfg

In grub2/grub.cfg, I removed the following parts:
rd.lvm.rd=VolumeGroup/SwapVolume

this solved the issue.

Note: Initially I also tried to edit the grub2 boot parameters from the grub2 menu, but strange enough that did not seem to work, so I decided to edit the grub2/grub.cfg directly.

@stevea: so, in the end, I think that there is no bug to report, because I forgot to update the grub2 configuration. If you don't agree, I will create a bug report.

janvlug
3rd April 2015, 11:48 AM
I guess you could try using a live CD and 'chroot', making sure you mount /boot in addition to the root fs?

Thanks wintonian. This advice steered me in the direction of solving this issue!

---------- Post added at 12:40 PM ---------- Previous post was at 12:36 PM ----------


If you could restore the swap volume and put it's config in /etc/fstab then you may be able to boot again.

Thanks for the tip nsnbm! Fortunately I managed to solve the root cause of the issue, so I did not need to go with your suggested approach.

---------- Post added at 12:43 PM ---------- Previous post was at 12:40 PM ----------


It is usually the fstab stored in the initramfs. If you change your system fstab, you also have to rebuild the initramfs used for boot.

I confirm that this is incorrect as stated previously by stevea. But thanks for your suggestion jpollard, appreciated.

---------- Post added at 12:48 PM ---------- Previous post was at 12:43 PM ----------




[stevea@lycoperdon foo]$ fgrep -lr '4a51caa7-35a7-4c00-ad29-8e553cbfff73'



Thanks for your detailed suggestions stevea, they steered me in the direction of the solution.