Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Dual Boot Debian Versions - EFI

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
k829king
Posts: 133
Joined: 2018-08-26 09:47

Dual Boot Debian Versions - EFI

#1 Post by k829king »

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.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#2 Post by p.H »

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.

HankB
Posts: 53
Joined: 2012-03-07 15:15

Re: Dual Boot Debian Versions - EFI

#3 Post by HankB »

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:~/$

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#4 Post by Head_on_a_Stick »

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

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#5 Post by p.H »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#6 Post by Head_on_a_Stick »

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'
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#7 Post by p.H »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#8 Post by Head_on_a_Stick »

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

HankB
Posts: 53
Joined: 2012-03-07 15:15

Re: Dual Boot Debian Versions - EFI

#9 Post by HankB »

Just to clarify a couple points. First, I'm running ZFS and it is normal for os-prober to not find that if the pools are not imported. It is normal procedure for me to perform a "rescue operation" following update of the other install. The short description of the rescue is to import pools and mount the filesystems, chroot into the ZFS based environment and repeat the grub installation. (more detail at https://openzfs.github.io/openzfs-docs/ ... -a-live-cd) In my case, the rescue host is the other Debian install. I ran this way on my laptop for several weeks, switching between Buster and Bullseye almost daily while I decided if Bullseye was ready for me. (It is and I have upgraded my primary installation to Bullseye. Upgrade was smooth as silk and the Debian Devs did an outstanding job on this.)

The other thing I determined is that the directory used in the EFI tree is named in the grub-install command.

Code: Select all

grub-install --target=x86_64-efi --efi-directory=/boot/efi \
    --bootloader-id=debian --recheck --no-floppy
Change the "--bootloader-id=" argument to something else and that will be used for the EFI files. I don't know if this is sticky in that the the same directory will be used the next time update-grub is run but I suspect that will be the case.

In any case, Buster and Bullseye overwriting each others' additions in the common directory caused no problems and now that's behind me until I get the itch to try the next testing release.

Thanks again for your attention to my query.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#10 Post by Head_on_a_Stick »

HankB wrote:I don't know if this is sticky in that the the same directory will be used the next time update-grub is run but I suspect that will be the case.
The update-grub command is a wrapper for grub-mkconfig. It doesn't run grub-install.
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Dual Boot Debian Versions - EFI

#11 Post by p.H »

Be aware that --bootloader-id with a value other than "debian" breaks the Debian buster signed EFI GRUB image which is installed by default and has its config file location hardcoded with "debian".
--boot-loader-id is not sticky in any way you could think of. IIRC, the default is derived from the value of GRUB_DISTRIBUTOR defined in /etc/default/grub (converted to lowercase).

Post Reply