How to recover from a boot hang after deleting old swap?

12,373

Solution 1

It seems that manually editing out the parameter containing rd.lvm.lv=fedora_old/swap in the grub configuration file does the trick. There is no need to run dracut or reinstall grub at all.

# vi /boot/efi/EFI/fedora/grub.cfg

Search for the following line under the menu entry which you will be booting from:

linuxefi /vmlinuz-3.12.x-xxx.fc20.x86_64 root=/dev/mapper/fedora_new-root00 ro rd.lvm.lv=fedora_old/swap rd.lvm.lv=fedora_new/swap vconsole.font=....

To make sure the above changes stick, do the same for /etc/default/grub:

GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora_old/swap rd.lvm.lv=fedora_new/swap vconsole.font=...

Please provide an answer or leave a comment if this method is wrong.

Solution 2

To make this permanent, you'll want to update /etc/default/grub to point to the correct swap partition.

Example: Change this:

GRUB_CMDLINE_LINUX="rd.lvm.lv=rootVG/root rd.lvm.lv=oldnameVG/swapLV rhgb quiet"

To this:

GRUB_CMDLINE_LINUX="rd.lvm.lv=rootVG/root rd.lvm.lv=rootVG/swapLV rhgb quiet"

When that is completed, you 'll want to regenerate the grub config:

grub2-mkconfig -o /boot/grub2/grub.cfg

You can verify that it worked by looking at /boot/grub2/grub.cfg and verifying that swap is now pointed at the correct VG/LV

Share:
12,373

Related videos on Youtube

Question Overflow
Author by

Question Overflow

I don't have any formal education on programming. I guess it is the passion that gets me started and keeps me going. Thanks everybody for sharing your knowledge. Don't worry, I am no critic. I see no wrong answer, only good and not so good answers. All are welcome to learn and to share.

Updated on September 18, 2022

Comments

  • Question Overflow
    Question Overflow over 1 year

    I did a fresh installation of Fedora 20 in the free space of my hard drive after failing to upgrade from the older version. Everything seems to be working fine until I deleted the partition containing the older version to free up some space. Upon restarting the computer, I got the following message after waiting for a long time:

    Warning: Could not boot

    Warning: /dev/fedora_old/swap does not exist

    Starting Dracut Emergency Shell

    I am still able to boot if I type exit on dracut prompt. But, that does not solve the root of the problem. There are a few suggestions on the web proposing:

    dracut --force --regenerate-all
    

    I am not sure what it does exactly and it doesn't seem to resolve the problem. What is the proper way to sort out the swap partition? It seems that the swap for the older OS was being used when the new OS is being installed despite it having its own swap partition.

    And how could I avoid such a problem in the future?

    This is what I have for /etc/fstab:

    /dev/mapper/fedora_new-root00 /          ext4    defaults                   1 1
    UUID=somehexdec               /boot      ext4    defaults                   1 2
    UUID=someotherhexdec          /boot/efi  vfat    umask=0077,shortname=winnt 0 0
    /dev/mapper/fedora_new-home00 /home      ext4    defaults                   1 2
    /dev/mapper/fedora_new-swap   swap       swap    defaults                   0 0
    
    • Admin
      Admin over 10 years
      did you edit your /etc/fstab?
    • Question Overflow
      Question Overflow over 10 years
      @bersch, no, I didn't edit that.
  • Mcol
    Mcol about 7 years
    Is running grub2-mkconfig mandatory and/or required?