You are not logged in.

#1 2019-01-05 17:48:13

gsplf
Member
Registered: 2019-01-05
Posts: 7

[SOLVED] Install from existing Arch Linux, grub

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

#2 2019-01-05 18:08:12

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Install from existing Arch Linux, grub

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 packagesZsh and other configs

Offline

#3 2019-01-05 20:53:32

gsplf
Member
Registered: 2019-01-05
Posts: 7

Re: [SOLVED] Install from existing Arch Linux, grub

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.

graysky wrote:
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

#4 2019-01-06 03:33:31

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Install from existing Arch Linux, grub

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

#5 2019-01-06 12:39:20

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Install from existing Arch Linux, grub

gsplf wrote:

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 packagesZsh and other configs

Offline

#6 2019-01-06 15:52:23

gsplf
Member
Registered: 2019-01-05
Posts: 7

Re: [SOLVED] Install from existing Arch Linux, grub

eschwartz wrote:

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.

graysky wrote:

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

#7 2019-01-06 16:36:54

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Install from existing Arch Linux, grub

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 packagesZsh and other configs

Offline

#8 2019-01-06 17:54:07

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Install from existing Arch Linux, grub

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. wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#9 2019-01-06 18:53:18

sammiev
Member
Registered: 2018-12-22
Posts: 84

Re: [SOLVED] Install from existing Arch Linux, grub

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

#10 2019-01-06 20:02:10

gsplf
Member
Registered: 2019-01-05
Posts: 7

Re: [SOLVED] Install from existing Arch Linux, grub

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

#11 2019-01-06 20:06:56

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Install from existing Arch Linux, grub

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. big_smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB