Can not boot from external drive. Initramfs not found

I have a problem booting into the OS installed on an external hard drive.

I have Manjaro installed on the internal nvme drives and a second Manjaro on the external drive /dev/sda. The second system is supposed to be portable and has it’s own /boot and boot/efi. It’s partitioned like that:

lsblk
NAME      MOUNTPOINT    FSTYPE
sda                           
├─sda1    /boot/efi     vfat
├─sda2    /boot         ext4
├─sda3    /             btrfs

I would like to boot into the second system from the grub menu of the main system.
For that I boot into the main system, connect the external drive and update the grub menu:
$ grub-mkconfig -o /boot/grub/grub.cfg
The system on the external drive is detected and added to the grub.cfg:

log
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Manjaro Linux on /dev/sda3

However, when I select it from the grub menu, I get:

error: file `/boot/initramfs-x.xx-x86_64.img` not found.
Press any key to continue...

The main system still boots fine.

I’ve checked the entries in the grub.cfg and noticed that for the main system that boots, the initrd is:

initrd  /intel-ucode.img /initramfs-6.1-x86_64.img

While for the system that doesn’t boot:

initrd /intel-ucode.img /boot/initramfs-6.1-x86_64.img

When I change in the grub.cfg
/boot/initramfs-6.1-x86_64.img
to
/initramfs-6.1-x86_64.img
then the second system also boots fine.

Spoiler

Actually not yet, because I get another error:

mount: /new_root: can't find UUID=....
You are now being dropped into an emergency shell.
sh: can't access tty: job control turned off
[rootfs ]#

which can be fixed by manually mounting new_root:

mount /dev/sda3 -o subvol=@ /new_root
exit

And then finally boot into the system. But I think it’s not related to this topic.

I’m super tired, but since nobody seems to touch this, I’ll give you my five cents.

What is that???

Did you install the kernels while sda2 was mounted? Are you mounting that on your btrfs root in fstab or smthn?
I have no idea how grub would handle that. It’s also in ext4, not fat32. Why?
Do you then mount your efi partition, sda1 inside that or something?
Was the drive a bootable system somewhere else?
Why are the partitions mounted like that? I’m so confused.

It’s probably on sda2, idk where you installed them.

On the boot partition on your functioning system yes. No idea where, you did not provide info.

Probably looking for it where you installed it, on sdb2 maybe?

This is a mess, you need to provide more info.
Inxi of your system.
lsblk of your whole system.
How did you install the other os.
What IS the other os?
etc etc.

For anyone to be of any assistance you should post:

  1. The complete grub entry that gets generated for your external-drive OS,
  2. Plus output of your partitions that include the UUID’s…
  3. Plus contents of your fstab of your external-drive OS,

Keep in mind that the ESP of your external-drive OS (sda1 on it) will NOT be used when booting into your main OS which most likely boots from NVMe, because the ESP on that will be used by default.

  • That means the grub of your main OS will be initialized with the NVMe drive as root device and all entries following that will assume paths are on the NVMe unless explicitly changed in the grub-menu entry.

Anyhow like said at start, you need to provide more detailed technical info about your grub-config and partitions, the info you have provided so far is not enough to help for your problem at hand…

Most likely that is an XBOOTLDR partition (See also Boot Loader Specification | UAPI Group Specifications)

Sorry for not being clear enough.
The second system is Manjaro and was installed completely on the external drive sda. It has separate /boot and /boot/efi. The main system is on internal nvme with it’s own /boot and /boot/efi.

You’re right, it’s enough to have a fat32 or ext2. I think ext4 still should work.

Thanks for clarification, that can be the problem in my case. I have a separate ESP for the external OS.
Is there a way to set a different ESP in grub?


  1. Grub entry for the external-drive OS:
    from grub.cfg
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'Manjaro Linux (on /dev/sda3)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-0b23081f-891c-481a-a19b-99a0fd580225' {
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt2'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b85841a4-0cb5-49ec-a801-0cf14d61d024
    	else
    	  search --no-floppy --fs-uuid --set=root b85841a4-0cb5-49ec-a801-0cf14d61d024
    	fi
    	linux /vmlinuz-6.1-x86_64 root=UUID=0b23081f-891c-481a-a19b-99a0fd580225 rw rootflags=subvol=@ quiet apparmor=1 security=apparmor udev.log_priority=3
    	initrd /intel-ucode.img /boot/initramfs-6.1-x86_64.img
    }
    submenu 'Advanced options for Manjaro Linux (on /dev/sda3)' $menuentry_id_option 'osprober-gnulinux-advanced-0b23081f-891c-481a-a19b-99a0fd580225' {
    	menuentry 'Manjaro Linux (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.1-x86_64--0b23081f-891c-481a-a19b-99a0fd580225' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b85841a4-0cb5-49ec-a801-0cf14d61d024
    		else
    		  search --no-floppy --fs-uuid --set=root b85841a4-0cb5-49ec-a801-0cf14d61d024
    		fi
    		linux /vmlinuz-6.1-x86_64 root=UUID=0b23081f-891c-481a-a19b-99a0fd580225 rw rootflags=subvol=@ quiet apparmor=1 security=apparmor udev.log_priority=3
    		initrd /intel-ucode.img /boot/initramfs-6.1-x86_64.img
    	}
    	menuentry 'Manjaro Linux (Kernel 6.1.38-1-MANJARO x64) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.1-x86_64--0b23081f-891c-481a-a19b-99a0fd580225' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b85841a4-0cb5-49ec-a801-0cf14d61d024
    		else
    		  search --no-floppy --fs-uuid --set=root b85841a4-0cb5-49ec-a801-0cf14d61d024
    		fi
    		linux /vmlinuz-6.1-x86_64 root=UUID=0b23081f-891c-481a-a19b-99a0fd580225 rw rootflags=subvol=@ quiet apparmor=1 security=apparmor udev.log_priority=3
    		initrd /intel-ucode.img /boot/initramfs-6.1-x86_64.img
    	}
    	menuentry 'Manjaro Linux (Kernel 6.1.38-1-MANJARO x64 - fallback initramfs) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.1-x86_64--0b23081f-891c-481a-a19b-99a0fd580225' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b85841a4-0cb5-49ec-a801-0cf14d61d024
    		else
    		  search --no-floppy --fs-uuid --set=root b85841a4-0cb5-49ec-a801-0cf14d61d024
    		fi
    		linux /vmlinuz-6.1-x86_64 root=UUID=0b23081f-891c-481a-a19b-99a0fd580225 rw rootflags=subvol=@ quiet apparmor=1 security=apparmor udev.log_priority=3
    		initrd /initramfs-6.1-x86_64-fallback.img
    	}
    	menuentry 'Manjaro Linux (Kernel 5.15.120-1-MANJARO x64) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.15-x86_64--0b23081f-891c-481a-a19b-99a0fd580225' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b85841a4-0cb5-49ec-a801-0cf14d61d024
    		else
    		  search --no-floppy --fs-uuid --set=root b85841a4-0cb5-49ec-a801-0cf14d61d024
    		fi
    		linux /vmlinuz-5.15-x86_64 root=UUID=0b23081f-891c-481a-a19b-99a0fd580225 rw rootflags=subvol=@ quiet apparmor=1 security=apparmor udev.log_priority=3
    		initrd /intel-ucode.img /boot/initramfs-5.15-x86_64.img
    	}
    	menuentry 'Manjaro Linux (Kernel 5.15.120-1-MANJARO x64 - fallback initramfs) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.15-x86_64--0b23081f-891c-481a-a19b-99a0fd580225' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b85841a4-0cb5-49ec-a801-0cf14d61d024
    		else
    		  search --no-floppy --fs-uuid --set=root b85841a4-0cb5-49ec-a801-0cf14d61d024
    		fi
    		linux /vmlinuz-5.15-x86_64 root=UUID=0b23081f-891c-481a-a19b-99a0fd580225 rw rootflags=subvol=@ quiet apparmor=1 security=apparmor udev.log_priority=3
    		initrd /initramfs-5.15-x86_64-fallback.img
    	}
    	menuentry 'Memory Tester (memtest86+) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/memtest86+/memtest.bin--0b23081f-891c-481a-a19b-99a0fd580225' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  b85841a4-0cb5-49ec-a801-0cf14d61d024
    		else
    		  search --no-floppy --fs-uuid --set=root b85841a4-0cb5-49ec-a801-0cf14d61d024
    		fi
    		linux /memtest86+/memtest.bin 
    	}
    }
    
  2. List of partitions:
    Output of lsblk

    /dev/sda also includes partitions for other systems (it’s supposed to be multiboot drive).
    But I think it’s not important in that case.

    NAME                MOUNTPOIN LABEL          FSTYPE        SIZE UUID
    sda                                                      465,8G 
    ├─sda1                                       vfat          500M J4KD-M13F
    ├─sda2                        manjaro-boot   ext4          1,5G b85841a4-0cb5-49ec-a801-0cf14d61d024
    ├─sda3                        manjaro-root   btrfs          93G 0b23081f-891c-481a-a19b-99a0fd580225
    ├─sda4                        eos-boot       ext4          1,4G 2843d1c5-c2bc-4de9-8672-7736bc11f6fd
    ├─sda5                        eos-root       ext4         90,7G 1d588355-4990-4df1-b427-77ce2b01474c
    ├─sda6                        neon-user-boot ext4          1,4G 6bfb55ac-ae79-4885-911f-2c9b38df5235
    ├─sda7                        neon-user-root ext4         89,8G 922df223-e933-41ce-bc5a-cc4cff203be8
    ├─sda8                        neon-unst-boot ext4          1,5G 89e0d542-e575-4844-bbe8-486de13f4450
    └─sda9                        neon-unst-root ext4         89,8G 78122353-f5c6-4c11-b524-e82b15dc985f
    nvme0n1                                                  931,5G 
    └─nvme0n1p1                                  LVM2_member 931,5G erNHNx-8Gz2-fuUE-1LoH-lLPL-xNcp-3p6Hkn
      └─vgsystem-lvhome /home                    ext4        931,5G 580072ef-96b2-4350-94ce-129e4894fbf7
    nvme1n1                                                  232,9G 
    ├─nvme1n1p1         /boot/efi EFI            vfat          300M 84WL-VE25
    ├─nvme1n1p2         /boot                    ext4          1,4G d0fd4a2b-e07b-4a42-9809-79b339aded55
    └─nvme1n1p3                                  LVM2_member 231,2G 1WVihV-giKG-X4Vt-HtAn-fXSS-7pXq-2jDczh
      └─vgsystem-lvroot /var/log                 btrfs       231,2G 9815b44b-d523-45c0-a30d-1563d1fe14e2
    
  3. Contents of fstab on external-drive OS:
    fstab in /dev/sda3
    # <file system>             <mount point>  <type>  <options>  <dump>  <pass>
    UUID=J4KD-M13F                            /boot/efi      vfat    umask=0077 0 2
    UUID=b85841a4-0cb5-49ec-a801-0cf14d61d024 /boot          ext4    defaults,noatime 0 2
    UUID=0b23081f-891c-481a-a19b-99a0fd580225 /              btrfs   subvol=/@,defaults,discard=async 0 0
    UUID=0b23081f-891c-481a-a19b-99a0fd580225 /home          btrfs   subvol=/@home,defaults,discard=async 0 0
    UUID=0b23081f-891c-481a-a19b-99a0fd580225 /var/cache     btrfs   subvol=/@cache,defaults,discard=async 0 0
    UUID=0b23081f-891c-481a-a19b-99a0fd580225 /var/log       btrfs   subvol=/@log,defaults,discard=async 0 0
    tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
    

For simplicity, would it not be possible to “pick boot partition” at bios level even before grub since you have multiple boot partitions?

On my computer I can press F12 and choose what boot device I want to use (assuming they are set up correctly).

No the UEFI-BIOS chooses the first it encounters, in sequence of devices connected or configured in it.
You can however use Grub specific commands to choose the root filesystem to use…See:

1 Like

Totally valid point.
The problem is that my bios can’t find Manjaro on the external boot partition.
When I add it manually with

$ efibootmgr -c -d /dev/sda -p 1 -L "manjaro2" -l "\EFI\Manjaro\grubx64.efi"

then it appears in the bios menu and boots fine when selected. However, when I reconnect the external drive, the entry doesn’t reappear.
Looks like a bios specific issue…

No that is expected behaviour, the UEFI-Bios doesn’t allow permanent boot entries that are on external drives by design…
(Because the entry could point to something completely different as what was setup at time when you insert a different drive…)
What actually happens is when you boot without the external drive, the UEFI-Bios purges entries where the medium can not be found AFAIK…

For external drives you should use the default boot entry in /EFI/BOOT/BOOTx64.efi or similar /EFI/BOOT/BOOT.efi for it to be auto-added…

I have multiple systems on the external drive. Each create a folder in a common ESP.

So next to /EFI/BOOT/BOOTx64.efi I have e.g. /EFI/Manjaro/grubx64.efi, /EFI/endeavouros/grubx64.efi, /EFI/neon/grubx64.efi.

I guess then they are all ignored by UEFI, unless manually added with efibootmgr

Ok, that makes sense. But I don’t get why when I boot with external drive, the entry still doesn’t appear…

I’ve actually checked it with the other motherboard, and external Manjaro appears in UEFI every time I boot with the external drive connected.

Different MB’s have different UEFI implementations i guess, so you found the problem already…

  • It’s your new MB that doesn’t auto recognize the entries on your external drive :wink:
  • Or put differently: Your old motherboards UEFI does not auto remove the removable drive entries…

I’m guessing the new MB has a newer UEFI-Bios implementation that acts more correct…

If it were me, i would get rid of all those grub stuff and replace them all with a single systemd-boot :wink:

1 Like