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 (2 copies of Debian) on a UEFI PC

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Dual boot (2 copies of Debian) on a UEFI PC

#1 Post by MartinK »

I have built an Intel NUC with both SSD and HDD. My intention was to have a bootable Debian OS on both drives so that in the event of problems with one drive I could boot from the other. I used an image of the Debian netinst installer copied to USB stick to install Debian, first on the SSD then the HDD. Both systems boot O.K. I can select which one to boot from the GRUB menu.

However, default boot was from the HDD. I wanted to change that to SSD so with the PC booted from SSD edited /etc/default/grub to change "GRUB_DEFAULT=", ran "update-grub", re-booted and found no change in behaviour.

Looking at /boot/grub/grub.cfg on the SSD I was surprised to find no reference to the SSD nvme interface , only the HDD's sda interface.

I found the live grub /boot/grub/grub.cfg configuration on the HDD. It appears that although my first install of Debian was to the SSD the functional boot loader is actually on the HDD.

I see that in the NUC's firmware the HDD tops the boot order.

This is my first new PC for 8 years, and hence my first encounter with UEFI. Is my plan for resilience with 2 bootable drives each with their own copy of the OS possible?

If there is only one active copy of the bootloader it would appear not. But then why did the Debian installer create 2 separate grub.cfg files?

MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: Dual boot (2 copies of Debian) on a UEFI PC

#2 Post by MartinK »

If you have one copy of GRUB can you have resilience in the event of an internal disk drive failing?

MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: Dual boot (2 copies of Debian) on a UEFI PC

#3 Post by MartinK »

I bought this new PC to replace an old PowerPC (Motorola CPU) machine with Open Firmware. That supported easy selection of multiple bootable drives in a resilient manner. Yaboot being the boot loader for OF under Linux. Recreating what I had their with EFI seems at first sight unlikely.

I will do some more tests at this stage before setting up my user environment on the new system.

tynman
Posts: 131
Joined: 2016-05-03 19:48
Location: British Columbia, Canada
Been thanked: 1 time

Re: Dual boot (2 copies of Debian) on a UEFI PC

#4 Post by tynman »

I think it's fair to say the UEFI implementation in the BIOS of current x86 computers is often pretty crappy in terms of usablility and configurability. It certainly has been on all the motherboards I have been using since UEFI started showing up. Having said that, you definitely should be able to set up your system the way you have described, i.e. with grub "installed" discretely on the two different hard drives. Actually it sounds like you have already done that.

The challenge comes in being able to direct the computer's BIOS to UEFI-boot from the hard drive or partition you want it to. I am not familiar with your Intel NUC, but hopefully there is a key sequence which can be used during bootup to bring up a "boot menu", where it will list all the EFI partitions (ESPs) it finds on the computer, and it should list the EFI partitions where you have installed GRUB.

MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: Dual boot (2 copies of Debian) on a UEFI PC

#5 Post by MartinK »

I agree with all of the last post. I now think I can make it work as I intended. I am looking at the output from "efibootmgr -v" now and think I have identified the "debian" pointer in nvram to the active bootloader on disk. I have also discovered in the NUC's setup how to start an EFI shell. It exposes the firmware interface in a manner similar to that in Open Firmware.

I have run out of time tonight to get it all sorted.

User avatar
dotlj
Posts: 646
Joined: 2009-12-25 17:21

Re: Dual boot (2 copies of Debian) on a UEFI PC

#6 Post by dotlj »

The easy way to dual boot using two separate disks is to use boot priority. You didn't say if you want to run Debian stable on both, or try say testing or Sid.
The way I do it with another OS is to have one OS on /dev/sda that will boot by default if I don't go into boot priorities during power on. If I want the other OS, I press F10, get the boot menu and select /dev/sdb - except in the menu is shows the disks as HGST1000 or whatever, but you will know the manufacturer of your disks.

The other way to do it as others have said is to allow grub on /dev/sda to control which disk to boot. Linux gives you lots of options.
It depends if your SSD uses SATA or M.2 (NVMe) connection. On this computer, my Samsung 960 EVO is detected as /dev/nvme0 and Toshiba THNSNJ is only detected as /dev/sda.

MartinK
Posts: 28
Joined: 2015-05-14 21:55
Location: United Kingdom

Re: Dual boot (2 copies of Debian) on a UEFI PC

#7 Post by MartinK »

The availability of the applications/data on this machine is important to me. I am booting two copies of the same OS, Debian 9 Stretch. I back up my data from the SSD to the HDD (and via LAN to another device). Taking the SSD as primary, in the event of a problem I can, without any software changes, boot from HDD into a system of identical functionality. A hot standby.

I now have a grasp of how UEFI works. Firmware (variable in nvram) points at the selected ESP (EFI system partition). The grubx64.efi bootloader on that partition then runs. Using efibootmgr I have created my appropriately named nvram variables pointing at my two ESP's, one on SSD the other on HDD. Now, at NUC startup I can indeed hit F10, go into the boot menu, and choose which record in nvram to use. That shows me the grub2 menu from the relevant ESP. From both grub2 menus I have the options to boot either copy of the OS.

This is not exactly what I envisaged. I believe it should be possible to see a nvram pointer selection screen at NUC boot. (No need to hit function key F10). The feature I believe will reveal the options in the first stage of the boot process, timeout, I have been unable to set. I have raised a bug report against efibootmgr because the timeout (-t) option does not work.

I think it is probably possible to set the timeout using the EFI shell on the NUC. The dmpstore command shows the variables in nvram but I haven't yet worked out how to change them with dmpstore.

The problems with the NUC are that by default access to the EFI shell is disabled and the EFI timeout is one second! (I don't even see the options I think are there).

During my research I have seen all sorts of issues with UEFI firmware referred to. The 'standard' is so large and complicated that the chances of two implementations giving the same end result must be remote. Twenty years ago Open Firmware was a mature system. I am now grappling with something newer, more obscure, and buggy.

As a footnote for anybody else who may go down this route, beware when making changes to the variables in nvram. Adding a record can change the whole device tree! I wondered why my mouse had stopped working (left and right buttons no longer reversed). The device ID of the mouse, referred to by xinput, had changed. UEFI has not made a good impression on me.

Post Reply