You are not logged in.

#1 2023-03-31 14:44:34

Johnburrell
Member
Registered: 2014-07-16
Posts: 23

Using Arch as the host to install LFS

Hi

I've installed Arch and I would like to use it as the host to build LFS from the linuxfromscratch.org website.
I installed Arch in UEFI mode so obviously will build LFS in the same mode.
I would like to setup Arch so that I have the option to boot LFS using grub.

So to my question:
Arch has an EFI System Partition (ESP) which is mounted to /mnt/boot
When setting up LFS should I mount /mnt/lfs/boot to the same ESP as was used for /mnt/boot in Arch?
This means the LFS kernel files will end up alongside the Arch kernel. Will os-prober be able to sort out the two different OSs?

Is this the correct way to handle the two operating systems in dual boot?

Thanks

jb.

Offline

#2 2023-03-31 14:52:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,471
Website

Re: Using Arch as the host to install LFS

Johnburrell wrote:

Arch has an EFI System Partition (ESP) which is mounted to /mnt/boot

Are you sure?  That's a very odd place to mount an ESP.  You may have mounted it there in the live medium in which you were installing to /mnt, but that would mean the ESP in the actual installed system is at /boot which would make a lot more sense.  If that is in fact where your arch kernel is, then it must be /boot, not /mnt/boot.

Johnburrell wrote:

When setting up LFS should I mount /mnt/lfs/boot to the same ESP as was used for /mnt/boot in Arch?

Those paths still don't really make any sense, but generally, yes, you should use one ESP that would be shared across different OSs.  If you are building the lfs root at /mnt/lfs, then /mnt/lfs/boot would be the mountpoint for the ESP from within your arch host system.  But in LFS it would also just be /boot.

Note that whether you should mount the ESP to /boot in any system is a separate question - as is whether or not you should store the kernels on the ESP (this is not required with grub).  I do prefer ESP to be on /boot, and I do prefer storing kernels on the ESP - but that's just personal preference.  However having just one ESP on the machine for all the OSs really is best regardless of how you use that ESP.

Johnburrell wrote:

Will os-prober be able to sort out the two different OSs?

So long as they have different file names (and if they don't, you'll have far bigger problems.  This is just what os-prober is meant to do.  That said, I've always found grub(2) to be a massive overkill and so complex that it is quite vulnerable to errors / bugs.  So if it doesn't work right away, come back for some troubleshooting - but this is what os-prober should do.

Last edited by Trilby (2023-03-31 15:19:33)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-03-31 16:05:23

Johnburrell
Member
Registered: 2014-07-16
Posts: 23

Re: Using Arch as the host to install LFS

Thanks for your reply. It sounds as though I will be doing the correct thing and I've made the ESP big enough
to accommodate the kernels as well.

A quick response to your suggestion "Are you sure?  That's a very odd place to mount an ESP."

I was following the Arch wiki installation guide which says:

For UEFI systems, mount the EFI system partition:

# mount --mkdir /dev/efi_system_partition /mnt/boot

This is obviously pre arch-chroot
and the same with LFS. From the host, LFS is at /mnt/lfs and so /mnt/lfs/boot/ becomes
/boot when you chroot into LFS in chapter 7. So we agree - excellent!

jb.

Offline

#4 2023-04-02 11:45:54

Johnburrell
Member
Registered: 2014-07-16
Posts: 23

Re: Using Arch as the host to install LFS

I'm afraid installing LFS using the above method didn't work at all. I can still access the Arch OS but the attempt to boot LFS gives an error:

cannot find /boot/vmlinuz-6.2.9-lfs

A recursive list of /boot  gives:

# ls -R /boot

/boot:
config-6.2.9  grub			    initramfs-linux.img  vmlinuz-6.2.9-lfs
EFI	      initramfs-linux-fallback.img  System.map-6.2.9	 vmlinuz-linux

/boot/EFI:
BOOT  GRUB

/boot/EFI/BOOT:
BOOTX64.EFI

/boot/EFI/GRUB:
grubx64.efi

/boot/grub:
fonts  grub.cfg  grubenv  locale  themes  x86_64-efi

/boot/grub/fonts:
unicode.pf2

I haven't included /boot/grub/locale, /boot/grub/themes/starfield and lastly /boot/grub/x86_64-efi which is full of .mod files

and the menuentry for LFS from /boot/grub/grub.cfg is:

menuentry 'Linux From Scratch (r11.3-50-systemd+) (on /dev/nvme0n1p4)' --class linuxfromscratch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-754c2a89-9588-4d65-8691-dcde8072e9b7' {
        insmod part_gpt
        insmod ext2
        search --no-floppy --fs-uuid --set=root  754c2a89-9588-4d65-8691-dcde8072e9b7
        linux /boot/vmlinuz-6.2.9-lfs root=/dev/nvme0n1p4
}

I tried changing linux /boot/vmlinuz-6.2.9-lfs to linux /vmlinuz-6.2.9-lfs but it produced the same error.

fdisk -l for the relevant disk nvme0n1 is:

/dev/nvme0n1p1       2048   10487807  10485760    5G EFI System Partition mounted to /boot for Arch and LFS
/dev/nvme0n1p2   10487808  547358719 536870912  256G Arch /
/dev/nvme0n1p3  547358720  631244799  83886080   40G Arch /home
/dev/nvme0n1p4  631244800 1168115711 536870912  256G LFS /
/dev/nvme0n1p5 1168115712 1252001791  83886080   40G LFS /home
/dev/nvme0n1p6 1252001792 1293944831  41943040   20G LFS /opt

I've labelled the partitions to show what's what.

The root UUID for the LFS partition in the menuentry is correct:

/dev/nvme0n1p4: UUID="754c2a89-9588-4d65-8691-dcde8072e9b7" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="LFS /" PARTUUID="51f9958f-50c4-4bb2-9c61-8db193876799"

Any suggestions as to what I should try next to get LFS to boot?

TIA

jb.

Offline

#5 2023-04-02 11:58:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,471
Website

Re: Using Arch as the host to install LFS

Johnburrell wrote:

A recursive list of /boot  gives: ...

Clearly that's not a partition thats mounted at /boot for both arch and lfs.  There is no arch kernel / initramfs there.

But in any case, if this is just a problem in booting an attempted LFS installation, this is the wrong venue to pursue it.  You'll need to look for LFS support channels.  Though if you mount your ESP at /boot, then for the bootloader the kernel would not be at /boot/vmlinuz-* it would be just at ./vmlinuz-*.  But I know nothing about grub.  I know it can mount a root partition and find the kernel there - but your kernels are not on the root partition but rather on a ESP/boot partition.  Given that your init system has not run yet, your ESP is not mounted on /boot/ at that point in the boot process and it seems you are setting grub to search for the kernel on the root partition (which would explain why it is not found).

I'm guessing you do not actually mount your ESP on /boot in arch linux, and thus your arch kernel is on [nvme0n1p2]/boot not [nvme0n1p1]/, so your grub entry for arch linux would tell grub to search vnme0n1p1 at /boot/vmlinuz-* - you either need to set your LFS system up similarly with the ESP not mounted and the kernel placed on the [nvme0n1p2]/boot/ or you need to fix your grub config to point to where the kernel actually is on [nvme0n1p1]/.

Aside: 4G for an ESP?!  That's a lot of wasted space.

Last edited by Trilby (2023-04-02 12:35:01)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB