Local-fs-pre.target boot hang on btrfs replaced drive

Yesterday I tried a btrfs replace to move my os partition from a 256gb disk to a 500gb.
Now it hangs on “local-fs-pre.target” when booting.

What I did:

  1. I first installed fedora 37 on the new device, setting up the efi and boot partitions right, creating the main Luks partition.

  2. I ran btrfs replace moving the mapper dev from old drive to new mapper dev ( both unlocked luks partitions). No problems

  3. I mounted the boot partition on the new device and editing the grub entry, replacing with the new mapper dev uuid.

All above from the same live session.

  1. I rebooted and booted from the new drive. It boots, I get prompted for encryption key for drive, I enter it it boots fine all the way to “local-fs-pre.target”. Here it just hangs.

Now I’m asking for your help dear people.

Is there anything else I need to edit? Maybe the fstab or similar?

Best regards and sorry for grammatical errors (second language).

Check the UUIDs for LUKS and Btrfs:

lsblk -p -o +FSTYPE,UUID

And make sure they match the ones in /etc/crypttab and /etc/fstab respectively.

If the issue persists, set up a chroot, restore GRUB and regenerate initramfs:

sudo dracut -f --regenerate-all

Need logs. You might try rd.systemd.debug_shell and switching to tty9, and mount a USB stick to /sysroot and direct journal to it, e.g. journalctl > /sysroot/journal.log and then post it somewhere.

  1. Btrfs replace will use the same fs UUID, so that doesn’t need to be updated in fstab or the kernel command line in any of the bootloader BLS snippets in /boot/loader/entries

  2. However, the rd.luks.uuid boot parameter in each BLS entry needs updating.

  3. The /etc/crypttab and /etc/fstab need updating.

  4. The initramfs might need updating.

The boot sequence is:

UEFI firmware → UEFI NVRAM boot entries → EFI OSLoader on the ESP (shim.efi) → grubx64.efi → ESP grub.cfg → boot grub.cfg → BLS snippets on boot in loader/entries/

Since you’ve gotten to at least the initramfs, the above is probably correct and you’re stuck with discovery related to the initramfs or fstab or crypttab. I’m wondering if it hasn’t asked you for the LUKS passphrase, and hasn’t done that because of #2 above.

Thanks for your replies!

I setup chroot and ran

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

and

sudo dracut -f --regenerate-all

Then on first reboot it asked for LUKS passphrase but hanged on basic-system.target

I booted a live system and checked the entry file under boot/loader/entries, my old LUKS UUID and old Btrfs UUID from the old system had been put back in the entry file. I realized i didnt mention it before but i generated a new Btrfs UUID with btrfstune -u after the initial file system move, mistake it seems.

After correcting grub entry file, /etc/crypttab and /etc/fstab i could successfully boot! Success!

Realizing the old UUIDs could be a problem in the future i generated a new test grub.cfg under home dir with sudo grub2-mkconfig -o /home/user/grub.cfg
When inspecting this file it seems it still generates with the old LUKS UUID. Not sure what put back the old Btrfs UUID in the entry file tho.

I then edited corrected /etc/default/grub.cfg, after this i tried running grub2-mkconfig and dracut and now it seems to use the right UUIDs. Success!

But, now when i regenerate initramfs with dracut -f it generates the .img under /boot but i get the following errors:

depmod: WARNING: could not open modules.order at /var/tmp/dracut.pqTDcf/initramfs/lib/modules/6.2.7-200.fc37.x86_64: No such file or directory
depmod: WARNING: could not open modules.builtin at /var/tmp/dracut.pqTDcf/initramfs/lib/modules/6.2.7-200.fc37.x86_64: No such file or directory
depmod: WARNING: could not open modules.builtin.modinfo at /var/tmp/dracut.pqTDcf/initramfs/lib/modules/6.2.7-200.fc37.x86_64: No such file or directory

After i first setup fedora and the partitions on the new drive i suspect it installed using kernel 6.0.7.
On my old system i was running kernel 6.1.17. I suspect theres a clash here somewhere after the move/btrfs replace. I tried updating the kernel to 6.2.7 as soon as i successfully booted.

All suggestions are appreciated.

Take care

I think i found a solution to the depmod warning.

I ran sudo depmod -a and saw that the files where missing in /lib/modules/6.2.7-200.fc37.x86_64

depmod: WARNING: could not open modules.order at /lib/modules/6.2.7-200.fc37.x86_64: No such file or directory
depmod: WARNING: could not open modules.builtin at /lib/modules/6.2.7-200.fc37.x86_64: No such file or directory
depmod: WARNING: could not open modules.builtin.modinfo at /lib/modules/6.2.7-200.fc37.x86_64: No such file or directory

i also ran rpm -qf /lib/modules/6.2.7-200.fc37.x86_64/modules.builtin to see what package the file belonged to, which was kernel-modules-core-6.2.7-200.fc37.x86_64.
Upon reinstalling this package it doesnt seem to include the files missing.

but after restoring the missing files from an earlier btrfs snapshot neither depmod or dracut complains anymore.

Thank you @vgaetera and @chrismurphy , by following your instructions and some investigation on my own i managed to restore my data and get everything working smoothly again.