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
Resolved: How to Dual boot with UEFI Windows?
-
- Posts: 109
- Joined: 2009-08-11 10:41
Resolved: How to Dual boot with UEFI Windows?
Hi,
I have a shiny new Thinkpad T470p that came with windows. I'd like to keep the windows partition for now, as I need to use the mobile broadband modem and that is the one thing that may not work with Linux (we'll see...).
I installed Debian 9, to /dev/sda2 by making use of VirtualBox. I set up a RAW disk in Windows that points to /dev/sda, then created a VM on that, installing to /dev/sda2.
When Grub installation came up, I followed its default option, which was to install to the MBR on /dev/sda. I think. I'm not totally sure about that though.
I disable Secure Boot, and enabled Legacy and UEFI boot in the BIOS.
When I boot the raw disk under Virtual Box, I get grub and can only choose Debian from it, there is no Windows entry.
When I boot the bare metal laptop, it boots into Windows, and Grub gets completely bypassed.
If I disable UEFI boot and only allow legacy, it will not boot at all.
Is it possible to boot Debian and UEFI Windows side-by-side? I want to make sure I am not going to render the Windows partition un-bootable by running 'grub-install /dev/sda'.
I have a shiny new Thinkpad T470p that came with windows. I'd like to keep the windows partition for now, as I need to use the mobile broadband modem and that is the one thing that may not work with Linux (we'll see...).
I installed Debian 9, to /dev/sda2 by making use of VirtualBox. I set up a RAW disk in Windows that points to /dev/sda, then created a VM on that, installing to /dev/sda2.
When Grub installation came up, I followed its default option, which was to install to the MBR on /dev/sda. I think. I'm not totally sure about that though.
I disable Secure Boot, and enabled Legacy and UEFI boot in the BIOS.
When I boot the raw disk under Virtual Box, I get grub and can only choose Debian from it, there is no Windows entry.
When I boot the bare metal laptop, it boots into Windows, and Grub gets completely bypassed.
If I disable UEFI boot and only allow legacy, it will not boot at all.
Is it possible to boot Debian and UEFI Windows side-by-side? I want to make sure I am not going to render the Windows partition un-bootable by running 'grub-install /dev/sda'.
Last edited by rupertlssmith on 2017-10-14 12:55, edited 1 time in total.
- None1975
- df -h | participant
- Posts: 1398
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 46 times
- Been thanked: 68 times
Re: How to Dual boot with UEFI Windows?
Did you read Debian Wiki?
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github
Debian Wiki | DontBreakDebian, My config files on github
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Thanks. That says "Windows 10 was installed first on a non-formated disk using a non-UEFI BIOS."None1975 wrote:Did you read Debian Wiki?
But my Windoze was installed using UEFI.
This one suggests reformatting the into GPT:
https://wiki.debian.org/WindowsDualBoot
Great plan if Lenovo actually provided me with the windows installation disks...
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Code: Select all
# hdparm -i /dev/sda
/dev/sda:
Model=VBOX HARDDISK, FwRev=1.0, SerialNo=VB13f90867-fe7a0da4
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=512, ECCbytes=0
BuffType=DualPortCache, BuffSize=256kB, MaxMultSect=128, MultSect=128
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=2000409264
IORDY=yes, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=no WriteCache=enabled
Drive conforms to: unknown: ATA/ATAPI-1,2,3,4,5,6
* signifies the current active mode
I think I will try booting into a USB drive, backing up the MBR and windows partitions, then running grub-install from there on the actual physical /dev/sda.
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Code: Select all
# grub-install /dev/sda
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Code: Select all
# fdisk -l /dev/sda
Disk /dev/sda: 953.9 GiB, 1024209543168 bytes, 2000409264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 90ED82E2-736D-40F4-B48F-C347B69203B3
Device Start End Sectors Size Type
/dev/sda1 2048 534527 532480 260M EFI System
/dev/sda2 534528 567295 32768 16M Microsoft reserved
/dev/sda3 567296 319000575 318433280 151.9G Microsoft basic data
/dev/sda4 1998360576 2000408575 2048000 1000M Windows recovery environment
/dev/sda5 319000576 319999999 999424 488M Linux filesystem
/dev/sda6 320000000 1998360575 1678360576 800.3G Linux LVM
Partition table entries are not in disk order.
There are also some helpful answers here that might lead me to enlightenment:
https://superuser.com/questions/903112/ ... -partition
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
So, I already have a bootable, esp partition:
Perhaps I just have to install Grub in UEFI mode to /dev/sda1?
Presumably that will overwrite the Windows booter that is there? But UEFI mode Grub should manage to boot that?
Code: Select all
/dev/sda1 2048 534527 532480 260M EFI System
Presumably that will overwrite the Windows booter that is there? But UEFI mode Grub should manage to boot that?
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: How to Dual boot with UEFI Windows?
I cannot believe that VirtualBox is insane enough to allow a guest to use the raw physical disk where the host operating system is installed. Do you realize how insane and dangerous it is ? The guest system could write anything anywhere on the host partitions while the host operating system is running !rupertlssmith wrote:I installed Debian 9, to /dev/sda2 by making use of VirtualBox. I set up a RAW disk in Windows that points to /dev/sda, then created a VM on that, installing to /dev/sda2.
If you wanted to install and boot Debian directly on the hardware, why did you use VirtualBox ?
I hoped so, but it does not seem so.rupertlssmith wrote:So the raw /dev/sda that Debian sees might be some fabrication that Windows is presenting it with.
Some BIOS/UEFI firmwares require that a partition in the MBR partition table has the boot flag set to allow booting the disk in BIOS/legacy mode. The flag can be set with fdisk by forcing the use of the DOS partition table with the "-t dos" option.rupertlssmith wrote:If I disable UEFI boot and only allow legacy, it will not boot at all.
HOWEVER : UEFI firmwares may require that no partition has the boot flag set to boot in EFI mode, because it is against the UEFI/GPT specification. So be aware that setting this flag may prevent booting Windows.
Yes, but if you do this in VirtualBox, GRUB won't be able to register itself in the host EFI boot entries.rupertlssmith wrote:Perhaps I just have to install Grub in UEFI mode to /dev/sda1?
GRUB for PC 64 bit UEFI is installed by grub-efi-amd64.
There are two ways to boot Debian in EFI mode on the physical hardware.
1) Boot the Debian installer (or another EFI compatible live system) in EFI mode and select "rescue" in the installer main menu. Follow the steps and run a shell on the installed system root logical volume. You'll also have to mount /boot and the EFI partition on /boot/efi, but the installer should propose to do it.
2) If the UEFI firmware is sophisticated enough, it may allow you to select which EFI boot file to boot from. Select /EFI/debian/grubx64.efi on the EFI partition.
Once booted in EFI mode, you can run grub-install (without any argument) again.
No. One of the few advantages of UEFI is that the installed systems do not overwrites each other's bootloaders. At worst they just change the boot order so that their own bootloader get higher priority. But that may be changed in the UEFI setup.rupertlssmith wrote:Presumably that will overwrite the Windows booter that is there?
Yes, but you'll have to run update-grub again to add a menu entry for the EFI Windows boot loader.rupertlssmith wrote:But UEFI mode Grub should manage to boot that?
-
- Posts: 1394
- Joined: 2007-03-04 21:10
- Location: U.S.A. - WI.
Re: How to Dual boot with UEFI Windows?
[quote="rupertlssmith"]
Code: Select all
# hdparm -i /dev/sda ......
[b][i]So the raw /dev/sda that Debian sees might be some fabrication that Windows is presenting it with. Which would explain why Grub has not installed to the MBR of the physical disk. [/i][/b]
I think I will try booting into a USB drive, backing up the MBR and windows partitions, then running grub-install from there on the actual physical /dev/sda.[/quote]
Uhh, no? You are booted into virtualbox, sda is the partition / file you made for vbox. As far as I know you [b] cannot [/b] install grub on the physical primary disk ( or any other physical disks outside of the partition / disk the VM is using ) when booted into a virtual machine without first escaping the VM through an exploit and running code on the host / hypervisor machine.
One option that MAY work is using the Windows bootloader to chainload grub from the partition you installed to in vbox ( if you actually used a physical partition and not a file ). Kind of the exact opposite of what normally happens - where grub chainloads the windows bootloader.
fortune -o
Your love life will be... interesting.
How did it know?
The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches
Your love life will be... interesting.
How did it know?
The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Ok, I'm starting to get my head round this.
The Debian installer would have taken care of EFI for me. I should have installed from a bootable USB and not tried to bootstrap via VirtualBox. It would seem that Windows is preventing VirtualBox from modifying the EFI while it is running, or at least the VBox machine crashes when I try to installer grub on it.
This blog here describes a procedure for setting up the Debian installed in an EFI boot:
https://www.logilab.org/blogentry/6546148
The Debian installer would have taken care of EFI for me. I should have installed from a bootable USB and not tried to bootstrap via VirtualBox. It would seem that Windows is preventing VirtualBox from modifying the EFI while it is running, or at least the VBox machine crashes when I try to installer grub on it.
This blog here describes a procedure for setting up the Debian installed in an EFI boot:
https://www.logilab.org/blogentry/6546148
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Didn't have a USB device to hand! Its an old trick that has worked for me before, but you are right, so I'm making a bootable USB just now.p.H wrote: If you wanted to install and boot Debian directly on the hardware, why did you use VirtualBox ?
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Good to know. The current EFI boot partition has "boot, esp" flags set. I'l stick with that since it already seems to work.p.H wrote: Some BIOS/UEFI firmwares require that a partition in the MBR partition table has the boot flag set to allow booting the disk in BIOS/legacy mode. The flag can be set with fdisk by forcing the use of the DOS partition table with the "-t dos" option.
HOWEVER : UEFI firmwares may require that no partition has the boot flag set to boot in EFI mode, because it is against the UEFI/GPT specification. So be aware that setting this flag may prevent booting Windows.
Thanks for all your other explanations, it confirms what I have been learning this afternoon.
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: How to Dual boot with UEFI Windows?
I was not talking about the partitions in the GPT partition table. These "flags" are not really flags but the (stupid IMO) way used by parted and gparted to define and indicate partition types. With GPT, "boot" and "esp" are synonyms for the EFI system partition type.rupertlssmith wrote:The current EFI boot partition has "boot, esp" flags set.
I was talking about the legacy boot flag of the legacy DOS partition table in the MBR, which contains one single GPT protection partition (type ee). When set parted displays it as "pmbr_boot".
Not at all. VirtualBox emulates a virtual PC with its own BIOS/UEFI firmware which has nothing to do with the host UEFI firmware. It has no single reason to mess with the host UEFI settings.rupertlssmith wrote:It would seem that Windows is preventing VirtualBox from modifying the EFI
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
I followed the above but substituted stretch installer for the jessie one. It almost worked but hangs after the 'Loading InitRD' message. So at least I got some practice in how to install something to an EFI setup.rupertlssmith wrote: This blog here describes a procedure for setting up the Debian installed in an EFI boot:
https://www.logilab.org/blogentry/6546148
Can anyone recommend good set of instructions to follow to create a bootable EFI mode Debain Stretch installer on USB?
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: How to Dual boot with UEFI Windows?
Sorry but I won't read that blog. What "almost worked but hangs" ?rupertlssmith wrote: I followed the above but substituted stretch installer for the jessie one. It almost worked but hangs after the 'Loading InitRD' message.
As mentionned in the Debian installation guide :rupertlssmith wrote:Can anyone recommend good set of instructions to follow to create a bootable EFI mode Debain Stretch installer on USB?
Code: Select all
cp debian-xxx.iso /dev/sdX
- alan stone
- Posts: 269
- Joined: 2011-10-22 14:08
- Location: In my body.
Re: How to Dual boot with UEFI Windows?
Create installation media for Windowsrupertlssmith wrote:Great plan if Lenovo actually provided me with the windows installation disks...
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
So I did the above:p.H wrote: As mentionned in the Debian installation guide :sdX being the USB drive with all partitions removed first, then unplugged and plugged again.Code: Select all
cp debian-xxx.iso /dev/sdX
Code: Select all
cp debian-9.2.0-amd64-netinst.iso /dev/sdc
netinst.iso is looking for a CD-ROM device, but fails to find one. I tried opening a shell and "mount /dev/sda1 /cdrom" but that says it cannot find the /cdrom directory despite the file system showing it is there..?
I am using a USB HDD device rather than a USB memory stick. I wonder if that affects things? AFAIK, the netinst installer is supposed to be dual purpose in that it can work from a CD-ROM or a USB device.
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: How to Dual boot with UEFI Windows?
The error message may be misleading. IIRC the mount command from busybox included in the Debian installer requires to specify the filesystem type (iso9660) with -t.
It should not. Check which /dev/sdX device name the USB drive gets.rupertlssmith wrote:I am using a USB HDD device rather than a USB memory stick. I wonder if that affects things?
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
Thanks. That works:p.H wrote:The error message may be misleading. IIRC the mount command from busybox included in the Debian installer requires to specify the filesystem type (iso9660) with -t.
It should not. Check which /dev/sdX device name the USB drive gets.rupertlssmith wrote:I am using a USB HDD device rather than a USB memory stick. I wonder if that affects things?
Code: Select all
mount -t iso9660 /dev/sda /cdrom
-
- Posts: 109
- Joined: 2009-08-11 10:41
Re: How to Dual boot with UEFI Windows?
So now I get the installer running.
When I come to the step 'Install Base System' it fails with the message 'Failed to determine the codename for the release.' Any suggestions?
I think I now understand why Linus Torvalds says he is not technical enough to install Debian...
When I come to the step 'Install Base System' it fails with the message 'Failed to determine the codename for the release.' Any suggestions?
I think I now understand why Linus Torvalds says he is not technical enough to install Debian...