BOOTLOADER Install (legacy)

mounted or unmnounted?

Unmounted.

well… it works partly.
After chrooting and mount /dev /sys and /proc the grub-mkconfig command was possible.

[manjaro /]# grub-mkconfig -o boot/grub/grub.cfg
Generating grub configuration file ...
Found background: /usr/share/grub/background.png
Found linux image: /boot/vmlinuz-lts
Found linux image: /boot/vmlinuz-5.4.0-58-generic
Found initrd image: /boot/initrd.img-5.4.0-58-generic
Found linux image: /boot/vmlinuz-5.4.0-56-generic
Found initrd image: /boot/initrd.img-5.4.0-56-generic
Found Alpine Linux v3.13 on /dev/sda2
Found Windows 10 on /dev/sda3
done

Windows works.

What is the “partly” part of it?

  • the manjaro entry of grub-mkconfig does not boot and gives an error about “some modules”. I can’t tell it better for now.
  • the Alpine entry hangs having detected a USB keybord and USB mouse.

I will do a little reinstall of 2 machines without a shared BOOT partition.
I will have it easier then I hope.

haha

PS:
the lts kernel is the Alpine one btw

Whats about using /etc/grub.d/40_custom for chainloading second linux?
(Standard with Windoofs as second OS)

sounds good.
For Alpine:

    menuentry "Alpine Linux" {
    set root=(hd0,3)
    linux /boot/vmlinuz-hardened root=UUID=8de6973a-4a8c-40ed-b710-c4e2b42d6b7a modules=sd-mod,usb-
    storage,ext3 quiet
    initrd /boot/initramfs-hardened
    }

How would that be for a Manjaro Linux?

The parts for Manjaro linux should be in /boot/grub/grub.cfg
Chainloading of ONE system is required AFAIK.
(One system is the Big Boss - the other the humble slave)

to add win I would do the following in 40_custom

	menuentry "Microsoft Windows Vista/7/8/8.1/10 BIOS/MBR" {
		insmod part_msdos
		insmod ntfs
		insmod ntldr     
		search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 XXXXXXXXXXXXXXXX
		ntldr /bootmgr
	}

hd0,msdos1

equivalent sda1

There is one more thing. I have a last issue with grub. Can u tell me, why the custom entry for ALPINE linux is not recognized by grub mkconfig?

Manjaro environment:

[siserhost grub.d]# grub-mkconfig -o /boot/grub/grub.cfg                    
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.9-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-5.9-x86_64.img
Found initrd fallback image: /boot/initramfs-5.9-x86_64-fallback.img
Found linux image: /boot/vmlinuz-4.19-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-4.19-x86_64.img
Found initrd fallback image: /boot/initramfs-4.19-x86_64-fallback.img
Found Alpine Linux v3.13 on /dev/sda2
Found Windows 10 on /dev/sda4
Found memtest86+ image: /boot/memtest86+/memtest.bin
done
[siserhost grub.d]# awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg                       
Manjaro Linux
Manjaro Linux (Kernel: 5.9.16-1-MANJARO x64)
Manjaro Linux (Kernel: 5.9.16-1-MANJARO x64 - fallback initramfs)
Manjaro Linux (Kernel: 4.19.167-1-MANJARO x64)
Manjaro Linux (Kernel: 4.19.167-1-MANJARO x64 - fallback initramfs)
Windows 10 (on /dev/sda4)




[siserhost grub.d]# nano 40_custom                                         
[siserhost grub.d]# cat 40_custom      
#!/bin/sh
exec tail -n +3 $0
# 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.

#echo "Adding Alpine" >&2
#cat << EOF

menuentry "Alpine Linux" {
 set root=(hd0,1)
 linux vmlinuz-lts root=UUID=c74d472c-858e-478d-ab30-dbd59714bfa5 modules=sd-mod,usb-storage,ext4 quiet
 initrd initramfs-lts
}

menuentry "Alpine Linux" {
 set root=(hd0,1)
 linux vmlinuz-lts root=/dev/sda2 modules=sd-mod,usb-storage,ext4 quiet
 initrd initramfs-lts
}

menuentry "Windows 10 AMELIORATED" --class windows --class os {
   insmod part_msdos
   insmod ntfs
   insmod ntldr
   search --no-floppy --fs0uid --set=root --hint-bios=hd0,msdos3 
   ntldr /bootmgr
}

EOF
[siserhost grub.d]# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

sda      8:0    0 223.6G  0 disk 
├─sda1   8:1    0     1G  0 part 
├─sda2   8:2    0     8G  0 part /mnt/alpine
├─sda3   8:3    0   100G  0 part /
└─sda4   8:4    0 114.6G  0 part 
sdb      8:16   0 558.9G  0 disk 
├─sdb1   8:17   0    32G  0 part 
├─sdb2   8:18   0    16G  0 part [SWAP]
├─sdb3   8:19   0   100G  0 part /mnt/share
└─sdb4   8:20   0 410.9G  0 part /mnt/lbry

sr0     11:0    1  1024M  0 rom  
[siserhost grub.d]#

mount /dev/sda1 boot/

[siserhost boot]# ls
boot        extlinux.conf            initramfs-lts  ldlinux.sys   libutil.c32  mboot.c32  System.map-lts  vmlinuz-lts
config-lts  extlinux.conf.multiboot  ldlinux.c32    libcom32.c32  lost+found   menu.c32   vesamenu.c32

That is normal. Its only the output, the command will work nevertheless.

SOLVED :sunny:
This is a proper entry for Grub2:

cat /etc/grub.d/40_custom                      

#!/bin/sh
exec tail -n +3 $0
    menuentry "Windows 10 AMELIORATED" --class windows --class os {
       insmod part_msdos
       insmod ntfs
       insmod ntldr
       search --no-floppy --fs-uuid 06C8CA483EAF8327 --set=root --hint-bios=hd0,msdos3 
       ntldr (hd0,msdos3)/bootmgr
    }
    EOF

This not: (on some systems):

if [ "${grub_platform}" == "pc" ]; then
	menuentry "Microsoft Windows Vista/7/8/8.1/10 BIOS/MBR" {
		insmod part_msdos
		insmod ntfs
		insmod ntldr     
		search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 XXXXXXXXXXXXXXXX
		ntldr /bootmgr
	}
fi

… because the “ntldr (hd0,msdos3)/bootmgr” part is important and os-prober cant be trusted to get it right either.
Good documentation once again gave Gentoo: wiki/GRUB2#Installation
(and you of course*)

Thanks to you@all for helping !
B

1 Like