Dual Boot Debian Versions - EFI

Kernels & Hardware, configuring network, installing services

Dual Boot Debian Versions - EFI

Postby k829king » 2020-07-26 11:57

What steps should I take to dual boot multiple Debian versions on the one EFI system?
I currently have a Buster based version BUT it has a mess/mixture of Backports packages (as a result of following some instructions to get an updated kernel).
** I need to keep it running as is for now as my main workspace.
I've got plenty of unallocated space on the main drive so would like to install a fresh copy of Buster and avoid backports and over period of time I will install everything I need to make it my main space.
And I would also like to install Bullseye or Sid.
If I can use the one swap space for all would be preferable.
On a previous unit I tried to have Deb 9 and 10 dual boot but had issues with Grub and the swap space.
k829king
 
Posts: 90
Joined: 2018-08-26 09:47

Re: Dual Boot Debian Versions - EFI

Postby p.H » 2020-07-26 12:57

Issues with swap and GRUB are to be expected.

1) Shared swap :
Warning : if you mark an existing swap area "use as swap" in the Debian installer, it will be reformatted with a new UUID. If an existing Debian installation uses the UUID to identify the swap (default with a swap partition), it will have trouble.
Things to know :
- Hibernation must be used with extreme caution when using a shared swap : make sure the system which is booted next is the one which went into hibernation.
- On GPT (recommended with EFI boot), a swap partition is used automatically even if not defined in fstab when no swap is explicitly defined. So my advice is to mark the existing swap partition "do not use this partition"
- By default, a swap area in an LVM logical volume is identified by its LVM device name (stable, unlike partition device names), not its UUID, so it does not matter if its UUID changes.

2) GRUB
Any installation of a Debian instance will use the same name "debian" in the EFI partition and in the EFI boot entries in UEFI NVRAM.
Note that the Debian installer installs a GRUB flavour which is signed for UEFI secure boot (grub-signed). This flavour is hardcoded to use the directory name "debian" in the EFI directory and won't work if installed with another name using
Code: Select all
grub-install --bootloader-id <name>

You could use a separate EFI partition for each installation so that each one can have its own "debian" directory but the latest installation (and re-installation or upgrade) will still overwrite the unique "debian" EFI boot entry in UEFI NVRAM.
If you do not use secure boot, the unsigned flavour of GRUB can be installed with any name.

If you want GRUB to be managed by your main Debian instance, you have to reinstall it from that instance each time after installing a new instance. You could skip the installation of GRUB to avoid this, but it has issues too due to the missing /boot/grub/grub.cfg.
p.H
 
Posts: 1663
Joined: 2017-09-17 07:12

Re: Dual Boot Debian Versions - EFI

Postby HankB » 2021-02-09 19:19

Any further suggestions on this?

I have a laptop that (used to) boot Buster. I just installed Bullseye in a spare partition and while that is working fine, I lost the ability to boot Buster. It appears that the Bullseye install overwrote files for Buster in /boot/efi/EFI/debian:

Code: Select all
root@ryvius:/boot/efi/EFI# ls -l
total 20
drwx------ 2 root root 4096 Oct 31  2019 Boot
drwx------ 3 root root 4096 Aug 29 00:54 debian
drwx------ 4 root root 4096 Aug 29 00:58 Dell
drwx------ 4 root root 4096 Oct 31  2019 Microsoft
drwx------ 3 root root 4096 Oct 31  2019 ubuntu
root@ryvius:/boot/efi/EFI# ls -l debian
total 5484
-rwx------ 1 root root     108 Feb  9  2021 BOOTX64.CSV
-rwx------ 1 root root 1207944 Feb  9  2021 fbx64.efi
drwx------ 2 root root    4096 Aug 29 01:03 fw
-rwx------ 1 root root   62867 Jul 23  2020 fwupdx64.efi
-rwx------ 1 root root   74960 Aug  2  2020 fwupx64.efi
-rwx------ 1 root root     117 Feb  9  2021 grub.cfg
-rwx------ 1 root root 1660272 Feb  9  2021 grubx64.efi
-rwx------ 1 root root 1262304 Feb  9  2021 mmx64.efi
-rwx------ 1 root root 1322936 Feb  9  2021 shimx64.efi


It probably also overwrote some grub settings/configuration. Normally when I get into a situation where I cannot boot an OS (usually a result of a Windows update) I can go into the BIOS boot menu and boot anything in the EFI directory but that's not working in this case.

Questions:

* How can I restore ability to boot Buster?
* How can I dual boot Buster and Bullseye?

Incidentally, I dual boot two Buster installations on my desktop. One is Buster with root on ZFS. The other is Buster with root on EXT4 (to use as a rescue environment, should it be needed.) Apparently both installations share files in /boot/efi/EFI/Debian.

Code: Select all
hbarta@olive:~/$ tree /boot/efi/
/boot/efi/
└── EFI
    ├── boot
    └── Debian
        ├── BOOTX64.CSV
        ├── fbx64.efi
        ├── fw
        ├── grub.cfg
        ├── grubx64.efi
        ├── mmx64.efi
        └── shimx64.efi

4 directories, 6 files
hbarta@olive:~/$
HankB
 
Posts: 48
Joined: 2012-03-07 15:15

Re: Dual Boot Debian Versions - EFI

Postby Head_on_a_Stick » 2021-02-09 19:50

Add this stanza for buster to the end of the file at /etc/grub.d/40_custom in your bullseye system:
Code: Select all
menuentry 'Debian buster' {
   search --fs-uuid --set=root $uuid
   configfile /boot/grub/grub.cfg
}

Replace $uuid with the actual UUID of the Debian buster root partition. That example presumes /boot is on the root partition, if it is on it's own partition then use the UUID of the /boot partition and remove the leading "/boot" from the configfile line.

Remember to run the update-grub command (as root) after adding the stanza.

If you would prefer to only have a single GRUB screen then use this stanza instead:
Code: Select all
menuentry 'Debian buster' {
   search --fs-uuid --set=root $uuid
   linux /vmlinuz root=UUID=$uuid ro quiet
   initrd /initrd.img
}

Any desired kernel parameters can be added to the end of the line that starts with linux.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13254
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Dual Boot Debian Versions - EFI

Postby p.H » 2021-02-12 09:00

HankB wrote:It appears that the Bullseye install overwrote files for Buster in /boot/efi/EFI/debian

As expected :
p.H wrote:Any installation of a Debian instance will use the same name "debian" in the EFI partition and in the EFI boot entries in UEFI NVRAM.


HankB wrote:* How can I dual boot Buster and Bullseye?

Normally os-prober should detect Buster and update-grub should add it to the GRUB menu. No need for manual editing.

HankB wrote:Apparently both installations share files in /boot/efi/EFI/Debian.

No, they don't. They just overwrite each other's files.
p.H
 
Posts: 1663
Joined: 2017-09-17 07:12

Re: Dual Boot Debian Versions - EFI

Postby Head_on_a_Stick » 2021-02-12 21:41

p.H wrote:Normally os-prober should detect Buster and update-grub should add it to the GRUB menu.

But not for the OP. I have no idea why though.

HankB wrote:I currently have a Buster based version BUT it has a mess/mixture of Backports packages

This should list all of the backported packages:
Code: Select all
aptitude search '?narrow(?installed, ?archive(buster-backports))'

Or if you don't have aptitude:
Code: Select all
dpkg --list | grep '~bpo'
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13254
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Dual Boot Debian Versions - EFI

Postby p.H » 2021-02-13 10:00

Head_on_a_Stick wrote:
p.H wrote:Normally os-prober should detect Buster and update-grub should add it to the GRUB menu.

But not for the OP.

Do you mean HankB ? I do not see clear evidence that os-prober or update-grub have been run.

Head_on_a_Stick wrote:
HankB wrote:I currently have a Buster based version BUT it has a mess/mixture of Backports packages

No, HankB did not write this. The OP (k829king) did, but does not seem to be interested in this thread any more.
p.H
 
Posts: 1663
Joined: 2017-09-17 07:12

Re: Dual Boot Debian Versions - EFI

Postby Head_on_a_Stick » 2021-02-13 10:35

Bugger. Thanks p.H, glad you're here to pick up all of the pieces I drop :mrgreen:
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13254
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to System configuration

Who is online

Users browsing this forum: No registered users and 18 guests

fashionable