You are not logged in.
Hi,
I'm trying to install second Arch Linux from existing Arch Linux (Install from existing Linux).
I did everything and now I want to add a second Arch to the GRUB menu.
sda
├─sda1 ext4 / <-- first Arch Linux
├─sda2 ext4 /home
└─sda3 ext4 /mnt <-- second Arch Linux
What I've done:
$ sudo mount /dev/sda3 /mnt
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
done
GRUB doesn't find the second Arch, but os-prober finds it:
$ sudo os-prober
/dev/sda3:Arch Linux:Arch:linux
Why can't grub-mkconfig find the second Arch?
Last edited by gsplf (2019-01-06 20:02:56)
Offline
I don't use osprober... just edit /etc/grub.d/40_custom and manually create the entry, then run grub-mkconfig again.
Example from my system (adjust as needed):
#!/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.
menuentry 'Mini-Arch (on /dev/nvme0n1p4)' --class gnu-linux --class gnu --class os {
insmod part_gpt
insmod ext2
load_video
set gfxpayload=keep
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 120478d0-e1d3-4e67-ad2b-71e872951e8e
else
search --no-floppy --fs-uuid --set=root 120478d0-e1d3-4e67-ad2b-71e872951e8e
fi
linux /boot/vmlinuz-linux root=/dev/nvme0n1p4 rw quiet audit=0
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}
menuentry 'ISO loopback-Arch' {
set reldate=2018.11.01
###
set isofile="archlinux-$reldate-x86_64.iso"
set imgdevpath='/dev/sdb1'
loopback loop (hd2,1)/$isofile
linux (loop)/arch/boot/x86_64/vmlinuz img_dev=$imgdevpath img_loop=$isofile archisobasedir=arch earlymodules=loop
initrd (loop)/arch/boot/x86_64/archiso.img
}
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
graysky, thanks.
I did like you by adding the following to 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.
menuentry 'Second Arch' --class arch --class gnu-linux --class gnu --class os {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
search --no-floppy --fs-uuid --set=root c35a37e7-942c-432d-9857-82344c2a3e2a
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=c35a37e7-942c-432d-9857-82344c2a3e2a rw quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log-priority=3
echo 'Loading initial ramdisk ...'
initrd /boot/amd-ucode.img /boot/initramfs-linux.img
}
And the Second Arch booted. But I still don't understand why grub-mkconfig cannot do this on its own.
Why do you have it? In any case, the same thing happens.
if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root 120478d0-e1d3-4e67-ad2b-71e872951e8e else search --no-floppy --fs-uuid --set=root 120478d0-e1d3-4e67-ad2b-71e872951e8e fi
Offline
grub-mkconfig sucks and is unreliable, just write your own highly trivial config: https://wiki.archlinux.org/index.php/Us … figuration
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
And the Second Arch booted. But I still don't understand why grub-mkconfig cannot do this on its own.
Why do you have it? In any case, the same thing happens.
Glad you got it working... not sure what you're asking me with your 3rd and 4th sentences.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
grub-mkconfig sucks and is unreliable, just write your own highly trivial config: https://wiki.archlinux.org/index.php/Us … figuration
Thanks for the link! I'll do it. I decided to write my grub.cfg and never use grub-mkconfig.
not sure what you're asking me with your 3rd and 4th sentences.
Why do you have
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 120478d0-e1d3-4e67-ad2b-71e872951e8e
else
search --no-floppy --fs-uuid --set=root 120478d0-e1d3-4e67-ad2b-71e872951e8e
fi
instead of
search --no-floppy --fs-uuid --set=root 120478d0-e1d3-4e67-ad2b-71e872951e8e
?
Offline
Ha, you're right... that was a copy/paste from an older cfg that just worked. I agree that it looks like a pointless if/else.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
I'd guess the pointless if/else was originally copy-pasted from grub-mkconfig's autogenerated snippets, which have a habit of setting things in confusing, redundant loops.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Grub-mkconfig worked for me without issues on two arch installs on same drive.
However after reading this thread, I think I'll rebuild my config as posted above.
What a great thread.
Thanks
Offline
I think my problem has been solved, but problem with grub-mkconfig remains. Is there any hope that grub-mkconfig will work well in the future?
Offline
The purpose of grub-mkconfig is to thoughtlessly make something good enough that you don't really need to configure it. It works pretty well for zero-maintenance Debian systems, supposedly...
I guess if someone actually understood the issue and cared about using the mkconfig output, they could contribute a fix for it. But that person certainly isn't me, I can tell you that much.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline