You are not logged in.
Hello,
I have had an Arch installation on the IdeaPad S100-14IBR laptop (UEFI), and needed to make another installation on the SD card on the same laptop. What I did, is installed Arch on SD card partitioned into boot, swap and system partitions and installed grub (a second one, as one is also installed on the eMMC memory of the laptop with the main Arch installation. After reboot, it only loads SD card's Grub (if SD card is disconnected nothing boots). In the SD Arch I update grub.cfg with os-prober, it finds the main OS, but after rebooting and choosing this new entry the following message pops up and OS doesn't boot.
error: file `/boot/vmlinuz-linux' not found.
error: you need to lead the kernel first.
Press any key to continue...The grub installation was done this way:
# pacman -S grub efibootmgr
# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
# pacman -S os-prober
# grub-mkconfig -o /boot/grub/grub.cfgI thought I could get into the main OS and update Grub there to make it the one, that boots by default and also works when SD card is out, but it seems I made a mistake. My thoughts are maybe to try and chroot into my main OS from live CD and reinstall Grub there, having no SD card connected, but not sure if it is even possible, or right action to take. Having read wiki entries didn't give me much understanding sadly.
Here is the disk setup I have:
sda 119.3G (SD Card)
- sda1 600M /boot (SD OS)
- sda2 2G swap (SD OS)
- sda3 116.7G / (SD OS)
mmcblk0 29.1G (Internal eMMC memory)
- mmcblk0p1 300M /boot (Main OS)
- mmcblk0p2 2G swap (Main OS)
- mmcblk0p3 26.8G / (Main OS)
mmcblk0boot0 4M
mmcblk0boot1 4MMy question is what was my mistake and how do I restore bootability to my main OS and setup dual boot for the SD card one.
P.S. SD card is not in the built-in card reader (which seems to be faulty), but in the card reader connected via USB, if this is of any importance.
Last edited by Virgileo (2019-08-19 15:33:55)
Offline
Tired chrooting into my main OS and making grub config while SD card was disconnected. Here is what the output was:
Generating grub configuration file...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map. Still couldn't boot, so decided to reinstall grub. Chrooted into main OS from live environment again and ran:
# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
# grub-mkconfig -o /boot/grub/grub.cfgGrub was fixed and I could successfully boot into the system. I then plugged-in SD card, mounted sda3 / and sda1 /boot to /mnt and /mnt/boot correspondingly and ran grub-mkconfig:
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
$ sudo umount -R /mnt
$ rebootIt found the SD OS, but now the opposite problem arose, SD card OS wouldn't boot with the same message:
error: file `/boot/vmlinuz-linux' not found.
error: you need to lead the kernel first.
Press any key to continue...I feel like I stepped on the same rake twice now, what am I doing wrong?
Offline
After reboot, it only loads SD card's Grub (if SD card is disconnected nothing boots).
Do you see two separate boot entries for the two Arch systems listed in the output of the efibootmgr command?
It's probably better to have just a single GRUB bootloader installed on the hard drive, that should be able to boot the second system on the SD card.
what am I doing wrong?
You haven't posted the full output of the grub-mkconfig command (or the content of the "active" grub,cfg) so that we can see where it's going wrong.
Jin, Jîyan, Azadî
Offline
Do you see two separate boot entries for the two Arch systems listed in the output of the efibootmgr command?
The output of efibootmgr while on main OS:
$ efibootmgr --verbose
BootCurrent: 0000
Timeout: 2 seconds
BootOrder: 0000,0013,0014,0016,0001,0012,0017,0015
Boot0000* GRUB HD(1,GPT,a9e31ddb-ec85-44ec-b59e-5916fa30d6fe,0x800,0x96000)/File(\EFI\GRUB\grubx64.efi)
Boot0001* Windows Boot Manager HD(1,GPT,a9e31ddb-ec85-44ec-b59e-5916fa30d6fe,0x800,0x96000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0010 Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0011 Boot Menu FvFile(86488440-41bb-42c7-93ac-450fbf7766bf)
Boot0012* ATA HDD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f600)
Boot0013* eMMC Disk: SanDisk iNAND 32GB PciRoot(0x0)/Pci(0x10,0x0)/Ctrl(0x0)..]3.K.L......2.
Boot0014* USB HDD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot0015* PCI LAN: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot0016* USB FDD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot0017* USB CD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)the content of the "active" grub,cfg
/boot/grub/grub.cfg, main OS:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root ea27bf7c-c174-4ec2-aa2d-5b81e59b1615
else
search --no-floppy --fs-uuid --set=root ea27bf7c-c174-4ec2-aa2d-5b81e59b1615
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-ea27bf7c-c174-4ec2-aa2d-5b81e59b1615' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 2D6C-A073
else
search --no-floppy --fs-uuid --set=root 2D6C-A073
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=ea27bf7c-c174-4ec2-aa2d-5b81e59b1615 rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-ea27bf7c-c174-4ec2-aa2d-5b81e59b1615' {
menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-ea27bf7c-c174-4ec2-aa2d-5b81e59b1615' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 2D6C-A073
else
search --no-floppy --fs-uuid --set=root 2D6C-A073
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=ea27bf7c-c174-4ec2-aa2d-5b81e59b1615 rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-ea27bf7c-c174-4ec2-aa2d-5b81e59b1615' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 2D6C-A073
else
search --no-floppy --fs-uuid --set=root 2D6C-A073
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=ea27bf7c-c174-4ec2-aa2d-5b81e59b1615 rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux-fallback.img
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Arch Linux (on /dev/sda3)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7' {
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275/(null)/sas/disk@0,gpt3' --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7
else
search --no-floppy --fs-uuid --set=root 3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7
fi
linux /boot/vmlinuz-linux root=/dev/sda3
initrd /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux (on /dev/sda3)' $menuentry_id_option 'osprober-gnulinux-advanced-3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7' {
menuentry 'Arch Linux (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7' {
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275/(null)/sas/disk@0,gpt3' --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7
else
search --no-floppy --fs-uuid --set=root 3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7
fi
linux /boot/vmlinuz-linux root=/dev/sda3
initrd /boot/initramfs-linux.img
}
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###It's probably better to have just a single GRUB bootloader installed on the hard drive, that should be able to boot the second system on the SD card.
That is what I want, but the main Grub though detecting the SD card OS fails to boot it...
Offline
menuentry 'Arch Linux (on /dev/sda3)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7' { insmod part_gpt insmod ext2 set root='hd0,gpt3' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275/(null)/sas/disk@0,gpt3' --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3 3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7 else search --no-floppy --fs-uuid --set=root 3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7 fi linux /boot/vmlinuz-linux root=/dev/sda3 initrd /boot/initramfs-linux.img }
That stanza is looking for the kernel image on /dev/sda3 but it is actually on /dev/sda1 (according to your OP).
Try creating a file at /boot/grub/custom.cfg with this content:
menuentry 'Arch (SD card)' {
set root='hd0,gpt1'
linux /boot/vmlinuz-linux root=/dev/sda3 rw quiet
initrd /boot/initramfs-linux.img
}You may have to replace the set root line with
search --no-floppy --fs-uuid --set=root $uuidand replace $uuid with the actual UUID of the /boot partition on your SD card.
And just to confirm: both /dev/sda1 and /dev/mmcblk0p1 are FAT-formatted EFI system partitions, right?
Jin, Jîyan, Azadî
Offline
And just to confirm: both /dev/sda1 and /dev/mmcblk0p1 are FAT-formatted EFI system partitions, right?
Yes, here is how it looks:
$ lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1 vfat E3EB-4D1E
├─sda2 swap 58d062ca-fea3-48b4-932e-202bdf8a54ef
└─sda3 ext4 3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7
mmcblk0
├─mmcblk0p1 vfat 2D6C-A073 242.7M 19% /boot
├─mmcblk0p2 swap b6dd8c55-60da-4af5-9785-40ee86e36d6a [SWAP]
└─mmcblk0p3 ext4 ea27bf7c-c174-4ec2-aa2d-5b81e59b1615 4.4G 78% /
mmcblk0boot0
mmcblk0boot1Created /boot/grub/custom.cfg:
menuentry 'Arch (SD card)' {
search --no-floppy --fs-uuid --set=root E3EB-4D1E
linux /boot/vmlinuz-linux root=/dev/sda3 rw quiet
initrd /boot/initramfs-linux.img
}Booting from this entry lead to the same error as before so I looked at the entry for the main OS that boots and noticed that there it sets root to boot partition and then calls the image from / rather than from /boot. I then changed custom.cfg like so:
menuentry 'Arch (SD card)' {
search --no-floppy --fs-uuid --set=root E3EB-4D1E
linux /vmlinuz-linux root=UUID=3a9c373a-3dad-41e0-8f5d-efe5b3fefaa7 rw quiet
initrd /initramfs-linux.img
}That did the trick and now I can boot into SD card OS just fine, thanks for help. How should have I done this installation cleanly though? When installing second system just completely ignoring the Grub installation part? Would Grub on main drive after grub-mkconfig just pick up the system and system will boot fine? Essentially what was the cause of this problem? I'm still not sure why grub-mkconfig created faulty entry...
Offline
Booting from this entry lead to the same error as before so I looked at the entry for the main OS that boots and noticed that there it sets root to boot partition and then calls the image from / rather than from /boot.
Ah yes, well done for spotting my, er, deliberate mistake ![]()
Essentially what was the cause of this problem? I'm still not sure why grub-mkconfig created faulty entry...
Me neither ![]()
Your installation process looks fine to me and both systems are now working so you can just un-install the os-prober package, regenerate /boot/grub/grub.cfg and rely on custom.cfg to provide the entry for the SD card system.
If you want to use the SD card in different (UEFI) machines then you could run grub-install from that system and add the --removable option to get it to boot even if there are no NVRAM entries: https://wiki.archlinux.org/index.php/GR … _boot_path
Jin, Jîyan, Azadî
Offline
Alright, got it. Thanks for all the help and advice!
Offline