You are not logged in.

#1 2024-02-26 14:11:24

dab9966
Member
Registered: 2023-12-05
Posts: 33

I want to try dual booting Arch and Debian, do we have docs?

Found docs on dual booting for Arch and Windows https://wiki.archlinux.org/title/Dual_boot_with_Windows.

But do we have any for Arch and another Linux distro? I want to run Arch for daily work (encrypted partition) and Debian for anything else (not-encrypted). This should ideally prevent Debian from accessing files on Arch.

I have seen that you only need one bootloader. So I currently use systemd when booting to Arch, so I guess we just install Debian without bootloader? It's all on one hard drive

Any starting pointers would be appreciated

Offline

#2 2024-02-26 14:23:43

Trilby
Banned
Registered: 2011-11-29
Posts: 30,330
Website

Re: I want to try dual booting Arch and Debian, do we have docs?

The boot loader pages discuss having multiple entries.  Beyond that there's nothing else to know.


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

Offline

#3 2024-02-26 14:33:34

dab9966
Member
Registered: 2023-12-05
Posts: 33

Re: I want to try dual booting Arch and Debian, do we have docs?

I assume you talk about this one? https://wiki.archlinux.org/title/Arch_b … oot_loader, and not this one https://wiki.archlinux.org/title/Dual_b … imitations

Thanks I will have a go smile

Offline

#4 2024-02-26 14:35:33

Trilby
Banned
Registered: 2011-11-29
Posts: 30,330
Website

Re: I want to try dual booting Arch and Debian, do we have docs?

I was talking about the pages for actual boot loaders - the same pages you'd follow if you were installing according to the installation guide.  In your case I gather this would be systemd-boot.

Last edited by Trilby (2024-02-26 14:36:15)


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

Offline

#5 2024-02-26 16:16:53

Head_on_a_Stick
Member
From: Belsize Park
Registered: 2014-02-20
Posts: 8,248
Website

Re: I want to try dual booting Arch and Debian, do we have docs?

dab9966 wrote:

I have seen that you only need one bootloader. So I currently use systemd when booting to Arch, so I guess we just install Debian without bootloader?

Debian does not support installation of kernel images to FAT filesystems so systemd-boot will only work if you use an XBOOTLDR partition (with a non-FAT filesystem) to hold Debian's kernel & initramfs images. That might become irritating though because Debian's kernel images are versioned (unlike under Arch) so the systemd-boot configuration file would have to be updated every time the kernel version is bumped in Debian.

I would use GRUB instead with a menuentry in /boot/grub/custom.cfg for the /vmlinuz & /initrd.img symlinks in the Debian root partition that always point to the current versions.


"The nation-state domesticates the society in the name of capitalism and alienates the community from its natural foundations."
Democratic Confederalism, Abdullah Öcalan.

Offline

#6 2024-02-26 19:03:19

dab9966
Member
Registered: 2023-12-05
Posts: 33

Re: I want to try dual booting Arch and Debian, do we have docs?

that makes things little bit more complicated if I already have boot partition, it is of type FAT. https://wiki.archlinux.org/title/System … g_XBOOTLDR I guess the order of operations would be

1. create new /efi partition(FAT32)
2. delete /boot partition (backup config beforehand)
3. create new /boot partition (Extended Boot Partition)
4. run

bootctl --esp-path=/efi --boot-path=/boot install

(ensure partitions are mounted)

I understand after this, the stuff that's currently under

/boot/loader/entries

will stay there, I have 2 conf files: arch.conf and debian.conf

Offline

#7 2024-02-26 19:09:53

Head_on_a_Stick
Member
From: Belsize Park
Registered: 2014-02-20
Posts: 8,248
Website

Re: I want to try dual booting Arch and Debian, do we have docs?

You could keep Arch's /boot/ where it is and just add an XBOOTLDR partition for Debian's /boot/ instead.

Another alternative would be scripts in Debian's /etc/kernel/postinst.d/ & /etc/initramfs/post-update.d/ to copy the kernel & initramfs images to the ESP so you could keep using systemd-boot without an XBOOTLDR partition.


"The nation-state domesticates the society in the name of capitalism and alienates the community from its natural foundations."
Democratic Confederalism, Abdullah Öcalan.

Offline

#8 2024-02-26 21:02:59

dab9966
Member
Registered: 2023-12-05
Posts: 33

Re: I want to try dual booting Arch and Debian, do we have docs?

Head_on_a_Stick wrote:

You could keep Arch's /boot/ where it is and just add an XBOOTLDR partition for Debian's /boot/ instead.

Another alternative would be scripts in Debian's /etc/kernel/postinst.d/ & /etc/initramfs/post-update.d/ to copy the kernel & initramfs images to the ESP so you could keep using systemd-boot without an XBOOTLDR partition.

So now we have:

/dev/nvme0n1p6 - /boot (FAT32). Arch
/dev/nvme0n1p7 - / (root). Arch
/dev/nvme0n1p8 - / (root). Debian
/dev/nvme0n1p9 - empty XBOOTLDR partition

I made new partition (p9) with XBOOTLDR for Debian use. I see it has bls_boot flag. Whereas, the (p6) has boot, esp. How can we tell Debian to use this newly created partition without affecting Arch? I imagine we have to copy files either from (p7) /boot or from (p8) /boot into (p9).

# /dev/nvme0n1p7
ls /boot
amd-ucode.img	 EFI   initramfs-linux-fallback.img   initramfs-linux.img   loader  'System Volume Information'   vmlinuz-linux

# /dev/nvme0n1p8
ls /boot
config-6.1.0-18-amd64  efi  initrd.img-6.1.0-18-amd64  System.map-6.1.0-18-amd64  vmlinuz-6.1.0-18-amd64

I would assume we want to copy files from (p8) since its debian. But I think we will also have to copy files from (p7), specifically in loader directory, since that's where we define our kernel parameters. And debian currently missing that directory as its been freshly installed

I've attempted to mount (p9) to add those files, but getting error. Not sure if these can be mounted directly

wrong fs type, bad option, bad superblock on /dev/nvme0n1p9, missing codepage or helper program, or other error.

Last edited by dab9966 (2024-02-26 21:12:14)

Offline

#9 2024-02-26 21:40:36

Head_on_a_Stick
Member
From: Belsize Park
Registered: 2014-02-20
Posts: 8,248
Website

Re: I want to try dual booting Arch and Debian, do we have docs?

dab9966 wrote:

How can we tell Debian to use this newly created partition without affecting Arch?

Copy the contents of Debian's /boot/ to the XBOOTLDR partition then edit /etc/fstab to make that the new mountpoint.

Remember to add an entry for systemd-boot to /loader/entries/ on the XBOOTLDR partition and also add the respective EFI filesystem driver to /EFI/systemd/drivers/ on the ESP.

You should probably also add some kernel & initramfs scripts to edit the configuration files when the kernel is updated.

dab9966 wrote:

I've attempted to mount (p9) to add those files, but getting error

Did you format the XBOOTLDR partition?


"The nation-state domesticates the society in the name of capitalism and alienates the community from its natural foundations."
Democratic Confederalism, Abdullah Öcalan.

Offline

#10 2024-02-27 00:01:58

dab9966
Member
Registered: 2023-12-05
Posts: 33

Re: I want to try dual booting Arch and Debian, do we have docs?

Head_on_a_Stick wrote:
dab9966 wrote:

How can we tell Debian to use this newly created partition without affecting Arch?

Copy the contents of Debian's /boot/ to the XBOOTLDR partition then edit /etc/fstab to make that the new mountpoint.

Remember to add an entry for systemd-boot to /loader/entries/ on the XBOOTLDR partition and also add the respective EFI filesystem driver to /EFI/systemd/drivers/ on the ESP.

You should probably also add some kernel & initramfs scripts to edit the configuration files when the kernel is updated.

dab9966 wrote:

I've attempted to mount (p9) to add those files, but getting error

Did you format the XBOOTLDR partition?

You are correct, I forgot to format the XBOOTLDR, now its working smile. I created 3 partitions just for Debian but it doesn't load systemd-boot while booting hmm

├─nvme0n1p6  vfat   FAT32 (Arch /boot)
├─nvme0n1p7  ext4   1.0 (Arch /)
├─nvme0n1p8  ext4   1.0 (Debian /)
├─nvme0n1p9  ext4   1.0 (Debian /boot)
└─nvme0n1p10 vfat   FAT32 (Debian /efi)

cat (Debian /) /etc/fstab
UUID=<UUID of (Debian /)>        /        ext4 errors=remount-ro                                                               0 1
UUID=<UUID of (Debian /efi)>    /efi    vfat  rw,relatime,fmask=0022,dmask=0022,errors=remount-ro 0 2
UUID=<UUID of (Debian /boot)> /boot ext4 rw,relatime,fmask=0022,dmask=0022,errors=remount-ro 0 2

I even ran this from my arch disto, but nothing changed I think:
sudo bootctl --root=~/mount_debian_root --esp-path=~/mount_debian_efi/efi --boot-path=~/mount_debian_boot/boot install

Contents:

ls -la mount_debian_root
lrwxrwxrwx  1 root      root          7 Feb 26 16:40 bin -> usr/bin
drwxr-xr-x  3 root      root       4096 Feb 26 16:52 boot_bkp
drwxr-xr-x  4 root      root       4096 Feb 26 16:40 dev
drwxr-xr-x 57 root      root       4096 Feb 26 16:53 etc
drwxr-xr-x  3 root      root       4096 Feb 26 16:52 home
lrwxrwxrwx  1 root      root         30 Feb 26 16:48 initrd.img -> boot/initrd.img-6.1.0-18-amd64
lrwxrwxrwx  1 root      root         30 Feb 26 16:48 initrd.img.old -> boot/initrd.img-6.1.0-18-amd64
lrwxrwxrwx  1 root      root          7 Feb 26 16:40 lib -> usr/lib
lrwxrwxrwx  1 root      root          9 Feb 26 16:40 lib64 -> usr/lib64
drwx------  2 root      root      16384 Feb 26 16:40 lost+found
drwxr-xr-x  3 root      root       4096 Feb 26 16:40 media
drwxr-xr-x  2 root      root       4096 Feb 26 16:40 mnt
drwxr-xr-x  2 root      root       4096 Feb 26 16:40 opt
drwxr-xr-x  2 root      root       4096 Jan 28 21:20 proc
drwx------  3 root      root       4096 Feb 26 23:01 root
drwxr-xr-x  2 root      root       4096 Feb 26 16:53 run
lrwxrwxrwx  1 root      root          8 Feb 26 16:40 sbin -> usr/sbin
drwxr-xr-x  2 root      root       4096 Feb 26 16:40 srv
drwxr-xr-x  2 root      root       4096 Jan 28 21:20 sys
drwxrwxrwt  6 root      root       4096 Feb 26 22:53 tmp
drwxr-xr-x 12 root      root       4096 Feb 26 16:40 usr
drwxr-xr-x 11 root      root       4096 Feb 26 16:40 var
lrwxrwxrwx  1 root      root         27 Feb 26 16:48 vmlinuz -> boot/vmlinuz-6.1.0-18-amd64
lrwxrwxrwx  1 root      root         27 Feb 26 16:48 vmlinuz.old -> boot/vmlinuz-6.1.0-18-amd64

ls -la mount_debian_boot/boot
-rw-r--r-- 1 root root  259453 Feb 26 22:13 config-6.1.0-18-amd64
drwxr-xr-x 2 root root    1024 Feb 26 22:13 efi
-rw-r--r-- 1 root root 7752077 Feb 26 22:13 initrd.img-6.1.0-18-amd64
drwxr-xr-x 3 root root    1024 Feb 26 22:51 loader
-rw-r--r-- 1 root root      83 Feb 26 22:13 System.map-6.1.0-18-amd64
-rw-r--r-- 1 root root 8152768 Feb 26 22:13 vmlinuz-6.1.0-18-amd64

ls -la mount_debian_boot/boot/loader
drwxr-xr-x 2 root root 1024 Feb 26 22:42 entries
-rwxr-xr-x 1 root root   49 Feb 26 22:51 loader.conf

ls -la mount_debian_boot/boot/loader/entries
-rwxr-xr-x 1 root root  138 Feb 26 22:50 debian.conf

ls -la mount_debian_efi/efi
drwxr-xr-x 2 root root 4096 Feb 26 23:32 .
drwxr-xr-x 3 root root 4096 Jan  1  1970 ..

cat mount_debian_boot/boot/loader/loader.conf
timeout 3
#console-mode keep
default debian.conf

cat mount_debian_boot/boot/loader/entries/debian.conf
title Debian
linux /vmlinuz-6.1.0-18-amd64
initrd /initrd.img-6.1.0-18-amd64
options root=/dev/nvme0n1p8 rw init=/usr/lib/systemd/systemd

Did I forget to trigger something? Perhaps updating the Boot options menu when you turn the PC on. I will probably go over the docs tomorrow, see if I missed anything. Last check for today, is to change title of debian.conf to see if it will reflect that change in Boot menu

--
update, I think I need to add debian entry in boot manager. As it doesn't reflect any changes there. Running efibootmgr doesn't display anything new

Last edited by dab9966 (2024-02-27 00:06:35)

Offline

#11 2024-02-27 06:54:01

Head_on_a_Stick
Member
From: Belsize Park
Registered: 2014-02-20
Posts: 8,248
Website

Re: I want to try dual booting Arch and Debian, do we have docs?

dab9966 wrote:

Running efibootmgr doesn't display anything new

Please share the output here.

Did you remember to add the EFI ext4 drivers to the ESP? They are provided by the efifs package.

EDIT: corrections. It's too early.

Last edited by Head_on_a_Stick (2024-02-27 06:56:11)


"The nation-state domesticates the society in the name of capitalism and alienates the community from its natural foundations."
Democratic Confederalism, Abdullah Öcalan.

Offline

#12 2024-02-27 20:11:37

dab9966
Member
Registered: 2023-12-05
Posts: 33

Re: I want to try dual booting Arch and Debian, do we have docs?

Head_on_a_Stick wrote:
dab9966 wrote:

Running efibootmgr doesn't display anything new

Please share the output here.

Did you remember to add the EFI ext4 drivers to the ESP? They are provided by the efifs package.

EDIT: corrections. It's too early.

efibootmgr
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000,0007,0008,0003,0005,2002,2001,2003
Boot0000* Linux Boot Manager	HD(6,GPT,c496f744-37df-4dd7-9a76-f7eae6868052,0x5ed1d000,0x113000)/\EFI\systemd\systemd-bootx64.efi
Boot0001* EFI PXE 0 for IPv4 (8C-8C-AA-FC-77-73) 	PciRoot(0x0)/Pci(0x2,0x1)/Pci(0x0,0x0)/MAC(8c8caafc7773,0)/IPv4(0.0.0.0,0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)RC
Boot0002* EFI PXE 0 for IPv6 (8C-8C-AA-FC-77-73) 	PciRoot(0x0)/Pci(0x2,0x1)/Pci(0x0,0x0)/MAC(8c8caafc7773,0)/IPv6([::],0,Static,[::],[::],64)RC
Boot0003* Windows Boot Manager	HD(1,GPT,95f3e2b0-6d30-4d4f-9098-f70badaaa92c,0x800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
Boot0005* EFI Hard Drive (WDC PC SN730 SDBPNTY-1T00-1101)	PciRoot(0x0)/Pci(0x1,0x2)/Pci(0x0,0x0)/NVMe(0x1,00-1B-44-4A-46-A4-41-B5)/HD(6,GPT,c496f744-37df-4dd7-9a76-f7eae6868052,0x5ed1d000,0x113000)RC
Boot0007* debian	HD(1,GPT,95f3e2b0-6d30-4d4f-9098-f70badaaa92c,0x800,0x32000)/\EFI\debian\shimx64.efi
Boot0008* ubuntu	HD(1,GPT,95f3e2b0-6d30-4d4f-9098-f70badaaa92c,0x800,0x32000)/\EFI\ubuntu\shimx64.efi
Boot2001* EFI USB Device	RC
Boot2002* EFI DVD/CDROM	RC
Boot2003* EFI Network	RC

Only 2 boot loader entries are currently used - boot0000 for Arch (systemd) and boot0003 for windows. Everything else is old/unused

I started getting error while trying to install bootctl

sudo mount --mkdir /dev/nvme0n1p8 /mnt/root; sudo mount --mkdir /dev/nvme0n1p9 /mnt/boot; sudo mount --mkdir /dev/nvme0n1p10 /mnt/esp
sudo bootctl install --root="/mnt/root" --esp-path="/mnt/esp/efi" --boot-path="/mnt/boot/boot"

Failed to open parent directory of "/mnt/esp/efi": No such file or directory

Also just added the driver to EFI:

ls esp/efi/EFI/systemd/drivers/
ext2_x64.efi # ext2 was the only one on the website, so I think its covering ext4 too

Last edited by dab9966 (2024-02-27 20:15:17)

Offline

#13 2024-02-27 21:03:37

Head_on_a_Stick
Member
From: Belsize Park
Registered: 2014-02-20
Posts: 8,248
Website

Re: I want to try dual booting Arch and Debian, do we have docs?

You don't have to run `bootctl install`, the extant systemd-boot loader should pick up the XBOOTLDR partition and add the entry once it has the filesystem drivers.

And please stop full-quoting unnecessarily, it bloats the thread and degrades readability.


"The nation-state domesticates the society in the name of capitalism and alienates the community from its natural foundations."
Democratic Confederalism, Abdullah Öcalan.

Offline

#14 2024-02-27 21:14:00

dab9966
Member
Registered: 2023-12-05
Posts: 33

Re: I want to try dual booting Arch and Debian, do we have docs?

I decided to move to Grub for now. It was easy to install so I keep debian and arch now. I did little bit more research on Systemd and it seems its quite criticised haha. Interesting stuff. Thanks for your help so far big_smile

Offline

Board footer

Powered by FluxBB