You are not logged in.

#1 2023-03-17 05:34:11

DaveBullet
Member
Registered: 2023-03-14
Posts: 9

[SOLVED] Dual boot 2 arch installations - separate kernel files

Hello,

I'd like to install arch twice on the same machine.  One version is my debug/ compile, lots of stuff on it.  the other is my "production" which will only have runtime / bare minimum packages.

I can get both installed in separate partitions...my problem occurs when pacstrapping the 2nd installation... wanting to overwrite the 1st installation's kernel in /boot.

I can rename the kernels and repoint GRUB to boot the correct one... my concern is when it comes time to apply system upgrades (pacman -S linux?)

I might want to test this on the "Debug" install.. but may accidentally overwrite the "prod" installs kernel.

Is there a way to permanently point the target kernel filename to a different directory on boot, or different filename in the same directory? such that upgrades to the kernel apply to the right location?

Last edited by DaveBullet (2023-03-17 22:02:01)

Offline

#2 2023-03-17 06:48:26

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,771
Website

Re: [SOLVED] Dual boot 2 arch installations - separate kernel files

DaveBullet wrote:

my problem occurs when pacstrapping the 2nd installation... wanting to overwrite the 1st installation's kernel in /boot

Why are you sharing the same /boot partition?

Just use /efi or /boot/efi for the EFI system partition. GRUB doesn't need the ESP mounted under /boot.

Offline

#3 2023-03-17 12:03:36

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,647

Re: [SOLVED] Dual boot 2 arch installations - separate kernel files

Mount the ESP to /efi, then bind mount a dir on that to /boot.

Online

#4 2023-03-17 22:01:11

DaveBullet
Member
Registered: 2023-03-14
Posts: 9

Re: [SOLVED] Dual boot 2 arch installations - separate kernel files

Thanks for the suggestion @scimmia.  I didn't know about bind mounts.

I ended up doing the following that worked.

1. Change both installs to mount the ESP partition as /efi and not /boot
2. Move the kernels for each image into subdirectories on the ESP partition - e.g. /efi/image1 and /efi/image2
3. Add a bind mount to each image's /etc/fstab, such that it would mount the /efi/image1 or /efi/image2 to /boot
4. Update /efi/grub/grub.cfg to load the correct /image1/<kernel> or /image2/<kernel> for each boot option.   (this was after first running grub-mkconfig -o /boot/grub/grub.cfg on the first install to pick up the 2nd install's partition and add it to the config).  NB: Don't forget to pacman -S os-prober and ensure GRUB_DISABLE_OS_PROBER=false in /etc/default/grub to allow grub to detect multiple additional installs.

Here's my /efi tree

[root@arch-pc-debug efi]# tree debug-boot/ prod-boot/ EFI
debug-boot/
├── initramfs-linux-fallback.img
├── initramfs-linux.img
└── vmlinuz-linux
prod-boot/
├── initramfs-linux-fallback.img
├── initramfs-linux.img
└── vmlinuz-linux
EFI
├── BOOT
│   ├── BOOTX64.EFI
│   ├── fbx64.efi
│   └── mmx64.efi
├── Dell
│   └── logs
│       └── diags_current.xml
└── GRUB
    ├── BOOTX64.CSV
    ├── grub.cfg
    ├── grubx64.efi
    ├── mmx64.efi
    └── shimx64.efi

And here is the /etc/fstab for image1 (debug) - this mounts ESP partition to /efi but then binds the /efi/debug-boot as /boot for the booted linux:

UUID=1AD3-F799          /efi            vfat            rw,relatime,fmask=0022,dmask=0022,cod
epage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro        0 2

# Bind mount so that this linux sees the /efi/<instance-boot> as its /boot location for upgra
des to linux etc.. (to not clash with the other installation)
/efi/debug-boot /boot   none    defaults,bind   0       0

Offline

#5 2023-03-17 23:10:40

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

Re: [SOLVED] Dual boot 2 arch installations - separate kernel files

What's the purpose of the bind mount here?  Why not just leave the /boot directory on the root partition of each system?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2023-03-17 23:36:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,647

Re: [SOLVED] Dual boot 2 arch installations - separate kernel files

Some people just prefer to have /boot on a separate partition. That appears to be what they want, so I gave them a solution that fit with the way they want their system set up.

Online

#7 2023-03-19 01:17:15

DaveBullet
Member
Registered: 2023-03-14
Posts: 9

Re: [SOLVED] Dual boot 2 arch installations - separate kernel files

Trilby wrote:

What's the purpose of the bind mount here?  Why not just leave the /boot directory on the root partition of each system?

I was going to just do that and not bother with boot being on the ESP partition. I had assumed - wrongly that GRUB might care about needing the boot kernel on the same partition as ESP (as that was the way I first installed Arch from a USB stick).

I might go back to moving boot onto the root / single partition of each install.

Offline

Board footer

Powered by FluxBB