Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dual booting Debian on an Windows machine.

521 views
Skip to first unread message

Richard Owlett

unread,
Apr 30, 2022, 8:10:05 AM4/30/22
to
I will be setting up a Windows laptop to dual boot Debian.
If the machine has legacy BIOS, no problem as I've done that before.

If it is a UEFI machine (possibly with secure boot, what should I be
reading.

TIA

Christian Britz

unread,
Apr 30, 2022, 8:30:05 AM4/30/22
to
Generally it is easier to install Windows first, then Debian, but of
course it is possible the other way round. The Debian boot manager can
be configured to respect the Windows installation, the Windows boot
manager does not know anything about other operating systems, so you
should leave that to Debians tools, usually GRUB. You can also select
the OS to be booted in most (?) UEFI settings implementations.

The Debian installer is capable of resizing existing Windows
installations, to make room for Debian.

You should keep a Debian Live USB stick around, because Windows still
sets the MS boot manager as default under some circumstances.
Alternative would be to select the boot device from UEFI settings as
mentioned and then fix the problem from the installed Debian.

To get GRUB to know about Windows OS, you need the package os-prober. I
am not sure if this is automatically installed by the installer, if it
detects Windows. If not, install it later. Note that os-prober will
probably get deactivated in the next Debian release for some security
concerns, AFAIK it is not yet decided, how this will be finally handled
and if there will be an alternative mechanism.

If you can choose between UEFI and BIOS (legacy) mode, I would recommend
UEFI, it simplifies booting and has probably other advantages too. I use
UEFI with disabled secure boot. It is possible to use secure boot with
Debian, but you have to actively care for key handling and signing of
kernels and modules which you compile yourself then.

Another alternative to your plan might be to run the Windows
installation in one of the many available VM solutions. This works very
well, except for accelerated video (no option if you want to play games
or use special streaming software which is only available for Windows).

Hope that helps,
Christian
--
http://www.cb-fraggle.de

IL Ka

unread,
Apr 30, 2022, 10:10:06 AM4/30/22
to
this is possible: you just need to have two .efi files for your OSes: one for Windows and one for Linux.
Use ``efibootmgr`` to manage it. 
If you have secure boot enabled, you need shim: https://wiki.debian.org/SecureBoot

Richard Owlett

unread,
Apr 30, 2022, 10:30:05 AM4/30/22
to
Thanks for a quick reply.

On 04/30/2022 07:23 AM, Christian Britz wrote:
> Generally it is easier to install Windows first, then Debian, but of
> course it is possible the other way round.

My post evidently could have been clearer.
My friend's laptop will be purchased with Windows pre-installed.
I will set it up to dual boot Debian in order to demonstrate some Linux
software.

It will be a refurbished unit. To simplify having any required servicing
done by the vendor, the installed Windows must remain.

As the only Windows computer I've added Debian to was back in days of
Squeeze. Never having with UEFI nor Secure Boot I did a brief web search.

What I found wasn't well written and was not specifically Debian
oriented. Reading your post suggests I've forgotten things and know less
than I thought about recent hardware/software.

Suggested formal articles?
TIA

Richard Owlett

unread,
Apr 30, 2022, 11:00:05 AM4/30/22
to
On 04/30/2022 09:01 AM, IL Ka wrote:
> this is possible: you just need to have two .efi files for your OSes: one
> for Windows and one for Linux.
> Use ``efibootmgr`` to manage it.
> If you have secure boot enabled, you need shim:
> https://wiki.debian.org/SecureBoot

Following links from there suggests I know even less than I thought I
did. Confirms I need to read newbie oriented material about dual booting
Debian on a UEFI equipped Windows machine (with or without Secure Boot).

Suggestions?

TIA

Andrew M.A. Cater

unread,
Apr 30, 2022, 12:00:05 PM4/30/22
to
On Sat, Apr 30, 2022 at 09:09:19AM -0500, Richard Owlett wrote:
> Thanks for a quick reply.
>
> On 04/30/2022 07:23 AM, Christian Britz wrote:
> > Generally it is easier to install Windows first, then Debian, but of
> > course it is possible the other way round.
>
> My post evidently could have been clearer.
> My friend's laptop will be purchased with Windows pre-installed.
> I will set it up to dual boot Debian in order to demonstrate some Linux
> software.
>

This is probably a bad move: if _anything_ goes wrong, even with Windows
you are likely to get the blame. I'd suggest that instead, you use something
like a Debian Live to demonstrate software - that will make no changes.

As someone who has done this, you may be in for a world of pain, misery
and support calls.
If your friend doesn't have a copy of Office - get libreoffice for them, for
example, or other software that exists for both OS to help them out.

> It will be a refurbished unit. To simplify having any required servicing
> done by the vendor, the installed Windows must remain.
>

So: You have a Windows laptop that has "a" preinstalled Windows on: it
may not be installed the way you'd want - it might be installed with a
large recovery partition / a generic image / have been installed using
BIOS mode.

If it were me, I'd be tempted to get hold of a Windows .iso and make a clean
install of Windows and other software if that's feasible. You can get
a Windows .iso from Microsoft to do the reinstall by using their media
make - specify as you download it that it's for this computer.
Alternatively, there may be a way to effectively do a reinstall by doing
a Windows refresh - which may wipe out applications installed.

If you can get your friend comfortable with using Debian live, then suggest
that _they_ with your help, dedicate a portion of the disk to Debian.

Installation:

Windows first - shrink the disk using Windows partition manager. Install
Debian, use OS prober which should also find the pre-existing Windows install.
Set the Windows clock appropriately so that Debian doesn't reset it when
daylight saving time cuts in or whatever ...

Debian first:

Install Debian: use gparted to resize the disk. Leave the second part
of the disk completely blank. As you install Windows, tell it to use
only the free space. It _will_ assume that it's the only OS: at that
point, use a Debian medium in rescue mode to set Debian as the OS in
charge of boot.

IL Ka

unread,
Apr 30, 2022, 12:40:06 PM4/30/22
to
I am not aware of any document, but here is how UEFI boot works:

Harddrive is GPT-labeled and it has a partition with a special EFI flag. The partition is formatted as Fat32.

Firmware (people tend to call it BIOS) contains configuration in non-volatile memory. This configuration consists of paths to .efi files, something like
(harddisk_[disk_id[partition_id])/efi/debian/bootx64.efi

.efi is a special file that firmware can run. One file is for grub, another is for windows loader. 
So, you need to have two efi files on this partition (one file for each OS) and add records about them in firmware configuration. Linux does it with efibootmgr tool (grub2-install calls it under the hood)

If you have Windows installed, then you can simply install Debian, and I believe the installation process will add Debian .efi file preserving Windows file.
If not, then simply run `update-grub` after the installation.


I just played with uefi dualboot on hyper-v (second generation VM supports EFI), so here is how I did it:
I installed windows, and got several partitions, one of them is called EFI and contains "\EFI\Microsoft\Boot\boomgfw.efi". This partition doesn't have letter associated, but you can use disk manager to assign letter and check its contents.

My EFI configuration contains following record:
Firmware device path: HD(1,GPT,47D66F17-77D9-4C7D-8993-733E9FDF5459,0x800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi

So far, so good. I then used disk manager to shrink disk "C" (to get some free space for Debian) and installed Debian there.
I disabled Secure boot for now.

Debian's grub installed its own efi file there: /boot/efi/EFI/debian/shimx64.efi
Here is my new firmware config record: 
Firmware device path: HD(1,GPT,47D66F17-77D9-4C7D-8993-733E9FDF5459,0x800,0x32000)/\EFI\debian\shimx64.efi

So I can now choose between Windows and Debian by choosing .efi file to boot in firmware settings (aka boot menu)

But `update-grub` found Windows .efi file and added it to its configuration to implement chain loading: PC boots grub efi file, and grub then loads Windows efi file

I suggest you to install hyper-v on Windows, create Gen2 VM, install Windows there, disable secure boot, then do everything I wrote about, and then do it on your real laptop

Thomas Schmitt

unread,
Apr 30, 2022, 1:10:05 PM4/30/22
to
Hi,

i have to add some technical nitpicking for the archives:

IL Ka wrote:
> I am not aware of any document, but here is how UEFI boot works

https://uefi.org/specifications
current is UEFI Specification Version 2.9 (March 2021)
https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf
although i still read
https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_A_Feb14.pdf
when it comes to discussions.


> Harddrive is GPT-labeled and it has a partition with a special EFI flag.

It may also be partitioned by an MBR partition table.
(UEFI 2.8, 5.2.2 OS Types:
"0xEF (i.e., UEFI System Partition) defines a UEFI system partition."
)
Debian ISOs boot from USB stick by such an MBR partition.

In GPT the EFI partition is specified to be marked by type GUID
12A7328-F81F-11D2-BA4B-00A0C93EC93B.
(UEFI 2.8, Table 23 Defined GPT Partition Entry - Partition Type GUIDs)


Have a nice day :)

Thomas

Kenneth Parker

unread,
Apr 30, 2022, 1:40:05 PM4/30/22
to


On Sat, Apr 30, 2022, 10:54 AM Richard Owlett <rcow...@cloud85.net> wrote:
On 04/30/2022 09:01 AM, IL Ka wrote:
> this is possible: you just need to have two .efi files for your OSes: one
> for Windows and one for Linux.
> Use ``efibootmgr`` to manage it.
> If you have secure boot enabled, you need shim:
> https://wiki.debian.org/SecureBoot

Following links from there suggests I know even less than I thought I
did. Confirms I need to read newbie oriented material about dual booting
Debian on a UEFI equipped Windows machine (with or without Secure Boot).

Suggestions?

A "few" years ago,  I acquired an HP Tower with Windows 8.1 on it.  I invested in a 1 Terabyte External "spinning rust" drive, connected via USB.  I installed xubuntu on it and fixed Bios and UEFI to allow USB to boot. This included disabling Secure Boot, by the way. 

I ran it that way for a couple of years,  before shrinking Windows and making use of the, rather delicious internal Hard drive space.   (Windows was, eventually upgraded to 10, using one of Microsoft's "free offers", but that's a different story.  And, when I recently asked about upgrading to Windows 11, Microsoft simply laughed at me).

I am still using that Infrastructure, but without the external USB, and with Debian Bullseye being the primary system. 

As mentioned earlier, I disabled Secure Boot to even be able to boot External USB but, on one of my laptops, made use of the shim file someone else mentioned. And yes,  Debian suports Secure Boot, as noted on the previously mentioned Debian Wiki article. 

Good luck!

Kenneth Parker 

IL Ka

unread,
Apr 30, 2022, 7:20:04 PM4/30/22
to

  https://uefi.org/specifications
current is UEFI Specification Version 2.9 (March 2021)
  https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf
although i still read
  https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_A_Feb14.pdf
when it comes to discussions.


You are right, but OP asked for "newbie instructions" on how to multiboot Debian and Windows.
 
> Harddrive is GPT-labeled and it has a partition with a special EFI flag.

It may also be partitioned by an MBR partition table.
(UEFI 2.8, 5.2.2 OS Types:
 "0xEF (i.e., UEFI System Partition) defines a UEFI system partition."
)
AFAIK it is up to firmware to support MBR or not. Even more fun: firmware _may_ support any filesystem including NTFS or ext3, but every modern firmware _must_ support GPT and Fat32. 

Joe

unread,
May 1, 2022, 3:10:06 PM5/1/22
to
On Sat, 30 Apr 2022 09:09:19 -0500
Richard Owlett <rcow...@cloud85.net> wrote:

> Thanks for a quick reply.
>
> On 04/30/2022 07:23 AM, Christian Britz wrote:
> > Generally it is easier to install Windows first, then Debian, but of
> > course it is possible the other way round.
>
> My post evidently could have been clearer.
> My friend's laptop will be purchased with Windows pre-installed.
> I will set it up to dual boot Debian in order to demonstrate some
> Linux software.
>
> It will be a refurbished unit. To simplify having any required
> servicing done by the vendor, the installed Windows must remain.
>
> As the only Windows computer I've added Debian to was back in days of
> Squeeze. Never having with UEFI nor Secure Boot I did a brief web
> search.
>
> What I found wasn't well written and was not specifically Debian
> oriented. Reading your post suggests I've forgotten things and know
> less than I thought about recent hardware/software.
>
>

You've had the usual variety of suggestions, all of them good in
slightly differing circumstances.

Here's a case history:

I bought a 'refurbished' netbook containing Windows 10 about two years
ago. It had a hardwired 32GB SSD (not actually large enough for Windows
to do its out-of-box first upgrade without the temporary help of an
external USB drive) and internal space for a real laptop hard drive. The
installation was UEFI.

I was prepared to wipe Windows and start from there, but just for a
laugh I ran the Stretch netinstall and told it to install to the new
additional hard drive.

Well, the damn thing created a perfect UEFI dual-boot. Just like that.

Sadly the effect was spoiled somewhat when I later upgraded to Buster,
which stopped the computer booting at all without manual intervention
to the UEFI boot menu, and even then would only boot to Windows. I
spent quite a lot of time (including a fresh install of Buster) trying
to fix this, but to no avail. To this day, if I boot into Windows, I
then need to used a netinstall disc in rescue mode to get grub booted
again.

To complicate matters, the netbook UEFI implementation has at least
two problems: it implements NextBoot but not DefaultBoot, and when I
edit the UEFI boot menu, on its next boot it restores the Windows drive
to the default entry (and then fails to find it!) so it is entirely
possible that with a decent UEFI firmware, there might still not be any
problem. I'd love to know how Stretch got it right first time, though.

So I'm adding a warning here: do not assume the UEFI firmware of this
laptop is implemented correctly. Spend some time searching for UEFI
issues with the model before beginning work. My netbook is an Acer, and
apart from this issue is a wonderful machine, but Acer is notorious for
BIOS/UEFI issues, and slow to issue upgrades, if ever.

--
Joe

Anssi Saari

unread,
May 3, 2022, 6:40:06 AM5/3/22
to
I did this last fall, I may still have notes with links somewhere. I
think I did resize the EFI and recovery and the main Windows partitions
to have enough space for Linux system and boot files on the respective
partitions. I had no issues with the Debian installation even though it
was my first UEFI machine.

My desktop upgrade this winter was second UEFI experience and there
things were more complicated since I converted it from BIOS boot to UEFI
boot and it has Windows 10 and Debian and Arch. Windows didn't actually
survive the changes in HW, no problems with the actual conversion
though.

As for secure boot, I tried it with the laptop and it worked fine,
except Linux (or at least Debian 11) doesn't yet support hibernation
with secure boot so I turned secure boot off.
0 new messages