Difference between revisions of "Dual boot with Windows"

From ArchWiki
Jump to: navigation, search
(use https for links to archlinux.org)
(Time standard: Latest Windows 10 does not revert the hardware clock to localtime when it sync the time online.)
 
(88 intermediate revisions by 31 users not shown)
Line 1: Line 1:
 
[[Category:Boot process]]
 
[[Category:Boot process]]
[[ru:Windows and Arch Dual Boot]]
+
[[Category:Getting and installing Arch]]
[[sk:Windows and Arch Dual Boot]]
+
[[es:Dual boot with Windows]]
This is a simple article detailing different methods of Arch/Windows coexistence.
+
[[ja:Windows Arch のデュアルブート]]
 +
[[ru:Dual boot with Windows]]
 +
[[sk:Dual boot with Windows]]
 +
[[zh-cn:Dual boot with Windows]]
 +
{{Related articles start}}
 +
{{Related|Dual boot with Windows/SafeBoot}}
 +
{{Related articles end}}
  
{{Out of date|GRUB Legacy support has been dropped from Arch Linux:<br> https://www.archlinux.org/news/grub-legacy-no-longer-supported/}}
+
This is an article detailing different methods of Arch/Windows coexistence.
==Windows and Arch Dual Booting==
+
In this example, we will install Windows first, and subsequently install the GRUB bootloader along with Arch, allowing for dual boot.
+
  
Installation will be standard, but there are a few things to keep in mind:
+
== Important information ==
  
1. You may have to use logical partitions for some of your partitions, because there can only be up to 4 primary partitions per disk.
+
=== Windows UEFI vs BIOS limitations ===
  
2. Remember to write down your partitions numbers: "sda1, sda2... sda8", noting which type of partitions belong to their relevant number. For example:
+
Microsoft imposes limitations on which firmware boot mode and partitioning style can be supported based on the version of Windows used:
  
:; sda1 : {{ic|Windows}} - 30 GB should be enough. Many new games exceed 10GB each so bear this in mind.
+
* '''Windows XP''' both '''x86 32-bit''' and '''x86_64''' (also called x64) (RTM and all Service Packs) versions do not support booting in UEFI mode (IA32 or x86_64) from any disk (MBR or GPT) OR in BIOS mode from GPT disk. They support only BIOS boot and only from MBR/msdos disk.
+
* '''Windows Vista''' or '''7''' '''x86 32-bit''' (RTM and all Service Packs) versions support booting in BIOS mode from MBR/msdos disks only, not from GPT disks. They do not support x86_64 UEFI or IA32 (x86 32-bit) UEFI boot. They support only BIOS boot and only from MBR/msdos disk.
:; sda2 : {{ic|/boot}} - 100 MB is enough '''(optional)'''
+
* '''Windows Vista RTM x86_64''' (only RTM) version support booting in BIOS mode from MBR/msdos disks only, not from GPT disks. It does not support x86_64 UEFI or IA32 (x86 32-bit) UEFI boot. It supports only BIOS boot and only from MBR/msdos disk.
   
+
* '''Windows Vista''' (SP1 and above, not RTM) and '''Windows 7''' '''x86_64''' versions support booting in x86_64 UEFI mode from GPT disk only, OR in BIOS mode from MBR/msdos disk only. They do not support IA32 (x86 32-bit) UEFI boot from GPT/MBR disk, x86_64 UEFI boot from MBR/msdos disk, or BIOS boot from GPT disk.
:; sda3 : {{ic|/}} - 10 GB should be enough. If you're planning on using KDE or installing a bunch of games, you may wish to allocate more; perhaps 15 GB.
+
* '''Windows 8/8.1 x86 32-bit''' support booting in IA32 UEFI mode from GPT disk only, OR in BIOS mode from MBR/msdos disk only. They do not support x86_64 UEFI boot from GPT/MBR disk, x86_64 UEFI boot from MBR/msdos disk, or BIOS boot from GPT disk. On market, the only systems known to ship with IA32 (U)EFI are some old Intel Macs (pre-2010 models?) and Intel Atom System-on-Chip (Clover trail and Bay Trail) Windows Tablets. in which it boots ONLY in IA32 UEFI mode and ONLY from GPT disk.
+
* '''Windows 8/8.1''' '''x86_64''' versions support booting in x86_64 UEFI mode from GPT disk only, OR in BIOS mode from MBR/msdos disk only. They do not support IA32 UEFI boot, x86_64 UEFI boot from MBR/msdos disk, or BIOS boot from GPT disk.
:; sda4: {{ic|swap}} - between 1024 MB and 4096 MB '''(optional)'''. With 2 GB+ RAM you may even wish to skip it entirely. If you're only using swap for hibernation, you can also use a [https://wiki.archlinux.org/index.php/Swap#Swap_file swapfile], which will free up one of those 4 primary partitions.
+
 
 +
In case of pre-installed Systems:
 +
 
 +
* All systems pre-installed with Windows XP, Vista or 7 32-bit, irrespective of Service Pack level, bitness, edition (SKU) or presence of UEFI support in firmware, boot in BIOS-MBR mode by default.
 +
* MOST of the systems pre-installed with Windows 7 x86_64, irrespective of Service Pack level, bitness or edition (SKU), boot in BIOS-MBR mode by default. Very few recent systems pre-installed with Windows 7 are known to boot in x86_64 UEFI-GPT mode by default.
 +
* ALL systems pre-installed with Windows 8/8.1 boot in UEFI-GPT mode. The firmware bitness matches the bitness of Windows, ie. x86_64 Windows 8/8.1 boot in x86_64 UEFI mode and 32-bit Windows 8/8.1 boot in IA32 UEFI mode.
 +
 
 +
The best way to detect the boot mode of Windows is to do the following (info from [http://www.eightforums.com/tutorials/29504-bios-mode-see-if-windows-boot-uefi-legacy-mode.html here]):
 +
 
 +
* Boot into Windows
 +
* Press Win key and 'R' to start the Run dialog
 +
* In the Run dialog type "msinfo32" and press Enter
 +
* In the '''System Information''' windows, select '''System Summary''' on the left and check the value of '''BIOS mode''' item on the right
 +
* If the value is '''UEFI''', Windows boots in UEFI-GPT mode. If the value is '''Legacy''', Windows boots in BIOS-MBR mode.
 +
 
 +
In general, Windows forces type of partitioning depending on the firmware mode used, i.e. if Windows is booted in UEFI mode, it can be installed only to a GPT disk. If the Windows is booted in Legacy BIOS mode, it can be installed only to a MBR (also called '''msdos''' style partitioning) disk. This is a limitation enforced by Windows installer, and as of April 2014 there is no officially (Microsoft) supported way of installing Windows in UEFI-MBR or BIOS-GPT configuration. Thus Windows only supports either UEFI-GPT boot or BIOS-MBR configuration.
 +
 
 +
Such a limitation is not enforced by the Linux kernel, but can depend on which bootloader is used and/or how the bootloader is configured. The Windows limitation should be considered if the user wishes to boot Windows and Linux from the same disk, since installation procedure of bootloader depends on the firmware type and disk partitioning configuration. In case where Windows and Linux dual boot from the same disk, it is advisable to follow the method used by Windows, ie. either go for UEFI-GPT boot or BIOS-MBR boot. See http://support.microsoft.com/kb/2581408 for more info.
 +
 
 +
=== Install media limitations ===
 +
 
 +
Intel Atom System-on-Chip Tablets (Clover trail and Bay Trail) provide only IA32 UEFI firmware WITHOUT Legacy BIOS (CSM) support (unlike most of the x86_64 UEFI systems), due to Microsoft Connected Standby Guidelines for OEMs. Due to lack of Legacy BIOS support in these systems, and the lack of 32-bit UEFI boot in Arch Official Install ISO or the Archboot iso (as of April 2014), these install media cannot boot in Atom SoC tablets pre-installed with Windows 8/8.1 32-bit.
 +
 
 +
=== Bootloader UEFI vs BIOS limitations ===
 +
 
 +
Most of the linux bootloaders installed for one firmware type cannot launch or chainload bootloaders of other firmware type. That is, if Arch is installed in UEFI-GPT or UEFI-MBR mode in one disk and Windows is installed in BIOS-MBR mode in another disk, the UEFI bootloader used by Arch cannot chainload the BIOS installed Windows in the other disk. Similarly if Arch is installed in BIOS-MBR or BIOS-GPT mode in one disk and Windows is installed in UEFI-GPT in another disk , the BIOS bootloader used by Arch cannot chainload UEFI installed Windows in the other disk.
 +
 
 +
The only exceptions to this are grub(2) in Apple Macs in which EFI installed grub(2) can boot BIOS installed OS via '''appleloader''' command (does not work in non-Apple systems), and rEFInd which technically supports booting legacy BIOS OS from UEFI systems, but [http://rodsbooks.com/refind/using.html#legacy does not always work in non-Apple UEFI systems] as per its author Rod Smith.
 +
 
 +
However if Arch is installed in BIOS-GPT in one disk and Windows is installed in BIOS-MBR mode in another disk, then the BIOS bootloader used by Arch CAN boot the Windows in the other disk, if the bootloader itself has the ability to chainload from another disk.  
 +
 
 +
{{Note|If Arch and Windows are dual-booting from same disk, then Arch SHOULD follow the same firmware boot mode and partitioning combination used by the installed Windows in the disk.}}
 
   
 
   
:; sda5: {{ic|/home}} - rest of the drive '''(optional)'''
+
=== UEFI Secure Boot ===
  
{{Note|Older motherboards have a 1024 cylinder limit. This means that the BIOS cannot access things beyond the 1024th cylinder (about 8.5 GB), so the {{ic|/boot}} partition should be in the first 8.5 GB (most likely before the Windows partition). [http://gparted.sourceforge.net/livecd.php GParted Live], [http://partedmagic.com Parted Magic] or [http://www.sysresccd.org/Main_Page SystemRescueCd] are useful for moving and resizing partitions to accommodate this.}}
+
All pre-installed Windows 8/8.1 systems by default boot in UEFI-GPT mode and have UEFI Secure Boot enabled by default. This is mandated by Microsoft for all OEM pre-installed systems.
  
3. When installing GRUB, you must configure {{ic|/boot/grub/menu.lst}}), and '''make sure to install GRUB to {{ic|/boot}} (or root ({{ic|/}}) if you did not create a separate partition for {{ic|/boot}})'''. ''Installing GRUB onto your Windows partition may cause Windows not to boot.'' There should be about three lines at the end of the file that speak about chainloading to boot other OSs, these can most generally be uncommented if you follow above convention, this would place windows boot point at hd0,0 or sda1. Thus you would have something akin to this:
+
Arch Linux install media currently supports Secure Boot. See [[Secure Boot#Booting archiso]].  
{{Note|The above instruction is in conflict with the GRUB installation position documented in [[GRUB#General notes about bootloader installation]] which says GRUB should be installed to MBR or the first partition to be recognized by most BIOS.}}
+
{{Note|It is also possible to install GRUB to MBR ({{ic|/dev/sda}}). This works fine with Windows 7.}}
+
# Windows XP
+
title Windows XP
+
rootnoverify (hd0,0)
+
chainloader +1
+
  
The parts of this entry break down as follows:
+
It is advisable to disable UEFI Secure Boot in the firmware setup manually before attempting to boot Arch Linux. Windows 8/8.1 SHOULD continue to boot fine even if Secure boot is disabled. The only issue with regards to disabling UEFI Secure Boot support is that it requires physical access to the system to disable secure boot option in the firmware setup, as Microsoft has explicitly forbidden presence of any method to remotely or programmatically (from within OS) disable secure boot in all Windows 8/8.1 pre-installed systems
  
:; title Windows XP : Can be anything you like; it will just be what is displayed in the GRUB boot-up screen
+
=== Fast Start-Up ===
  
:; rootnoverify (hd0,0) : Remember the partition numbers we wrote down, here you write in the partition number of your windows partition. This sets the windows boot at root, even though GRUB cannot read it.
+
Fast Start-Up is a feature in Windows 8 and above that hibernates the computer rather than actually shutting it down to speed up boot times. Your system can lose data if Windows hibernates and you dual boot into another OS and make changes to files. Even if you do not intend to share filesystems, the EFI System Partition is likely to be damaged on an EFI system. Therefore, you should disable Fast Startup, as described [http://www.eightforums.com/tutorials/6320-fast-startup-turn-off-windows-8-a.html here for Windows 8] and [http://www.tenforums.com/tutorials/4189-fast-startup-turn-off-windows-10-a.html here for Windows 10], before you install Linux on any computer that uses Windows 8 or above.
  
:; chainloader +1 : What this does is call the Windows boot loader that is still in MBR in our case, since GRUB cannot boot Windows itself.
+
{{Pkg|ntfs-3g}} added a [http://sourceforge.net/p/ntfs-3g/ntfs-3g/ci/559270a8f67c77a7ce51246c23d2b2837bcff0c9/ safe-guard] to prevent read-write mounting of hibernated disks, but the NTFS driver within the Linux kernel has no such safeguard.
  
*The file is read from the top down, so the system listed first will be the one to automatically boot, if no keys are pressed during the GRUB boot screen.
+
=== Windows filenames limitations ===
*GRUB uses a zero indexed system of numbering drives and partitions, which is a different convention than you may be used to seeing:
+
First disk, first partition=sda1=hd0,0
+
First disk, second partition=sda2=hd0,1
+
Second disk, first partition=sdb1=hd1,0
+
  
==Dual Booting from Multiple Hard Drives==
+
Windows is limited to filepaths being shorter than [http://blogs.msdn.com/b/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx 260 characters].
To dual boot from two separate hard drives (e.g., one dedicated Linux drive and one dedicated Windows drive).
+
  
=== Windows + Arch ===
+
Windows also puts [http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#naming_conventions certain characters off limits] in filenames for reasons that run all the way back to DOS:
  
You have Windows installed on the first hard drive and you want to install Arch on the second one.
+
* < (less than)
Follow this procedure :
+
* > (greater than)
 +
* : (colon)
 +
* " (double quote)
 +
* / (forward slash)
 +
* \ (backslash)
 +
* | (vertical bar or pipe)
 +
* ? (question mark)
 +
* * (asterisk)
  
# Unplug the Windows hard drive (this is not needed if you are sure you know which drive have the Windows on it and which one is supposed to receive Arch. But this way you are sure you won't do any mistake)
+
These are limitations of Windows and not NTFS: any other OS using the NTFS partition will be fine. Windows will fail to detect these files and running {{ic|chkdsk}} will most likely cause them to be deleted. This can lead to potential data-loss.
# Install Arch on the second hard drive (that has become the first if you have unplug the Windows one)
+
# Be sure to install GRUB on the MBR on the Arch drive (I didn't test with syslinux but it should work too).
+
# At the end of the process you should be able to boot on Arch but not on Windows (the disk is unplug and even if not, GRUB doesn't know how to boot Windows... Yet !)
+
# Log in on Arch
+
#Edit /boot/grub/menu.lst (that needs root access),At the end add :
+
(2) Windows
+
title Seven
+
rootnoverify (hd0,0)
+
makeactive
+
chainloader +1
+
I use '(2)' because '(0)' and '(1)' are already used by Arch.  
+
  
If you want Windows to be loaded by default (the happy wife, happy life way !)
+
'''NTFS-3G''' applies Windows restrictions to new file names through the [http://www.tuxera.com/community/ntfs-3g-manual/#4 windows_filenames] option (see [[fstab]]).
Change the 'default' value by the one used for declaring Windows just before (here it is '2').
+
Ex :
+
# general configuration:
+
timeout  8
+
default  2
+
  
7/halt your computer and plug-in the Windows drive
+
== Installation ==
  
8/Restart the computer.
+
The recommended way to setup a Linux/Windows dual booting system is to first install Windows, only using part of the disk for its partitions. When you have finished the Windows setup, boot into the Linux install environment where you can create additional partitions for Linux while leaving the existing Windows partitions untouched. The Windows installation will create the EFI System Partition which can be used by your Linux bootloader.
You should see the GRUB menu proposing Arch and Windows. Select the one you want et voila !
+
  
=== Arch + Windows ===
+
=== BIOS systems ===
  
If Windows is not on the first hard drive, the Windows boot loader must be "tricked" into thinking Windows is on the first hard drive. Do this by adding the following lines to your menu.lst config file:
+
==== Using a Linux boot loader ====
map (hd0) (hd1)
+
map (hd1) (hd0)
+
  
So the entry for Windows on second disk, first partition will look like this:
+
You may use [[GRUB#Dual-booting|GRUB]] or [[Syslinux#Chainloading|Syslinux]].
title Microsoft Windows XP Professional
+
root (hd1,0)
+
savedefault
+
makeactive
+
map (hd0) (hd1)
+
map (hd1) (hd0)
+
chainloader +1
+
  
Or if the above configuration doesn't work, you might try the one below from the Arch Wiki GRUB page:
+
==== Using Windows boot loader ====
title Windows
+
map (hd0) (hd1)
+
map (hd1) (hd0)
+
rootnoverify (hd1,0)
+
makeactive #if you use Windows7 this line should be commented out
+
chainloader +1
+
  
More information on GRUB configuration can be found in [http://www.gnu.org/software/grub/manual/grub.html the GRUB manual].
+
With this setup the Windows bootloader loads GRUB which then boots Arch.  
  
==Other Layouts==
+
===== Windows Vista/7/8/8.1 boot loader =====
1. You could use:
+
:; sda1 : Windows XP
+
+
:; sda2 : swap
+
+
:; sda3 : root
+
+
:; sda4 : home
+
  
and not use an extended partition (as {{ic|/boot}} will be in the {{ic|/}} partition as well).
+
The following section contains excerpts from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/.
  
2. LVM (Logical Volume Management) is also an option. You could simply create a single LVM partition and then create the other partitions inside the LVM physical volume. This allows a single partition to hold all your needed GNU/Linux data, and allows you to easily change partitions when necessary.
+
{{Accuracy|Using ext3 formatted /boot partition, windows bootloader works just fine}}
  
==Notes on /home==
+
In order to have the Windows boot loader see the Linux partition, one of the Linux partitions created needs to be FAT32 (in this case, {{ic|/dev/sda3}}). The remainder of the setup is similar to a typical installation. Some documents state that the partition being loaded by the Windows boot loader must be a primary partition but I have used this without problem on an extended partition.
You may not wish to store you documents on this mountpoint, especially if you wish to share data between both Windows and Arch Linux. Either use a shared NTFS partition (via [[NTFS-3G]]) or install [http://www.ext2fsd.com/ Ext2Fsd] in Windows, which will let you mount EXT4 partitions, even as Read-Only (a good idea in keeping the files virus-free).
+
  
==Using Windows boot-loader==
+
* When installing the GRUB boot loader, install it on your {{ic|/boot}} partition rather than the MBR. {{Note|For instance, my {{ic|/boot}} partition is {{ic|/dev/sda5}}. So I installed GRUB at {{ic|/dev/sda5}} instead of {{ic|/dev/sda}}. For help on doing this, see [[GRUB#Install to partition or partitionless disk]]}}
Another option is sort of the reverse of what is described at the beginning of this article where GRUB loads the Windows boot loader, which then loads Windows. Under this option, the Windows boot loader load GRUB, which then loads arch.
+
  
===Using Windows 7/8 Boot-Loader===
+
* Under Linux make a copy of the boot info by typing the following at the command shell:
Excerpted from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/
+
  
In order to have the Windows boot-loader see the linux partition, one of the linux partitions created needs to be FAT32 (in this case, /dev/sda3). The remainder of the setup is similar to a typical installation. Some documents state that the partition being loaded by the Win boot-loader must be a primary partition but I have used this without problem on an extended partition.
+
my_windows_part=/dev/sda3
 +
my_boot_part=/dev/sda5
 +
mkdir /media/win
 +
mount $my_windows_part /media/win
 +
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1
  
*When installing the grub bootloader, install it on your '''/boot''' partition rather than the MBR. {{Note| For instance, my '''/boot''' partition is '''/dev/sda5'''. So I installed grub at '''/dev/sda5''' instead of '''/dev/sda''' <br>  For help on doing this, see [[Grub#Install to Partition or Partitionless Disk]]}}
+
* Boot to Windows and open up and you should be able to see the FAT32 partition. Copy the linux.bin file to {{ic|C:\}}. Now run '''cmd''' with administrator privileges (navigate to ''Start > All Programs > Accessories'', right-click on ''Command Prompt'' and select ''Run as administrator''):
  
*Under linux make a copy of the boot info by typing the following at the command shell:
+
bcdedit /create /d “Linux” /application BOOTSECTOR
<pre>
+
my_windows_part=/dev/sda3
+
my_boot_part=/dev/sda5
+
mkdir /media/win
+
mount $my_windows_part /media/win
+
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1
+
</pre>
+
*Boot to windows and open up and you should be able to see the FAT32 partition. Copy the linux.bin file to C:\. Now run '''cmd''' with administrator privileges (navigate to Start->All Programs->Accessories, Right-click on Command Prompt and select “Run as administrator.”)
+
<pre>
+
bcdedit /create /d “Linux” /application BOOTSECTOR
+
</pre>
+
*BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}.
+
<pre>
+
bcdedit /set {ID} device partition=c:
+
bcdedit /set {ID}  path \linux.bin
+
bcdedit /displayorder {ID} /addlast
+
bcdedit /timeout 30
+
</pre>
+
  
Done! Reboot and enjoy. In my case I'm using the Win bootloader so that I can map my Dell Precision M4500's second power button to boot linux instead of windows.
+
* BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You will need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}.  
  
===Using Windows 2000/XP Bootloader===
+
bcdedit /set {ID} device partition=c:
For information on this method see http://www.geocities.com/epark/linux/grub-w2k-HOWTO.html. I do not believe there are any distinct advantages of this method over the Linux bootloader; you will still need a {{ic|/boot}} partition, and this one is arguably more difficult to set up.
+
bcdedit /set {ID}  path \linux.bin
 +
bcdedit /displayorder {ID} /addlast
 +
bcdedit /timeout 30
 +
 
 +
Reboot and enjoy. In my case I'm using the Windows boot loader so that I can map my Dell Precision M4500's second power button to boot Linux instead of Windows.
 +
 
 +
=== UEFI systems ===
 +
 
 +
If you already have Windows installed, it will already have created some partitions (on a [[GPT]]-formatted disk):
 +
* a partition of type {{ic|ef00 EFI System}} and filesystem {{ic|FAT32}},
 +
* a partition of type {{ic|0c01 Microsoft reserved}}, generally of size {{ic|128 MiB}},
 +
* a partition of type {{ic|0700 Microsoft basic data}} and of filesystem {{ic|NTFS}}, which corresponds to {{ic|C:\}},
 +
* potentially system recovery and backup partitions and/or secondary data partitions (corresponding often to {{ic|D:\}} and above).
 +
Using the Disk Management utility in Windows, check how the partitions are labelled and which type gets reported. This will help you understand which partitions are essential to Windows, and which others you might repurpose: the first 3 bullets in the above list are essential, do not delete them.
 +
 
 +
You can then proceed with [[partitioning]], depending on your needs. Mind that there is no need to create an additional EFI System Partition, since it already exists (see above): when required, [[mount]] this to {{ic|/boot}}, install your [[bootloader]] to it and save the entry in {{ic|/etc/[[fstab]]}}.
 +
 
 +
Concerning bootloaders, [[systemd-boot]] and [[rEFInd]] autodetect ''Windows Boot Manager'' ({{ic|\EFI\Microsoft\Boot\bootmgfw.efi}}) and show it in their boot menu automatically.
 +
For [[GRUB]] follow [[GRUB#Windows installed in UEFI-GPT Mode menu entry]].
 +
Syslinux (as of version 6.02 and 6.03-pre9) and ELILO do not support chainloading other EFI applications, so they cannot be used to boot {{ic|\EFI\Microsoft\Boot\bootmgfw.efi}}.
 +
 
 +
Computers that come with newer versions of Windows often have [[Secure Boot]] enabled. You will need to take extra steps to either disable Secure Boot or to make your installation media compatible with secure boot (see above and in the linked page).
 +
 
 +
=== Troubleshooting ===
 +
 
 +
==== Couldn't create a new partition or locate an existing one  ====
 +
 
 +
The usb-stick for installing Windows 8.1 seems to need a MBR partition table (not GPT), otherwise the installation gets confused and prints something like "Couldn't create a new partition or locate an existing one", although the partitions were created.
 +
 
 +
==== Cannot boot Linux after installing Windows ====
 +
 
 +
See [[UEFI#Windows changes boot order]].
 +
 
 +
==== Restoring a Windows boot record ====
 +
 
 +
By convention (and for ease of installation), Windows is usually installed on the first partition and installs its partition table and reference to its bootloader to the first sector of that partition.  If you accidentally install a bootloader like GRUB to the Windows partition or damage the boot record in some other way, you will need to use a utility to repair it.  Microsoft includes a boot sector fix utility {{Ic|FIXBOOT}} and an MBR fix utility called {{Ic|FIXMBR}} on their recovery discs, or sometimes on their install discs.  Using this method, you can fix the reference on the boot sector of the first partition to the bootloader file and fix the reference on the MBR to the first partition, respectively.  After doing this you will have to [[GRUB#Bootloader installation|reinstall GRUB]]{{Broken section link}} to the MBR as was originally intended (that is, the GRUB bootloader can be assigned to chainload the Windows bootloader).
 +
 
 +
If you wish to revert back to using Windows, you can use the {{Ic|FIXBOOT}} command which chains from the MBR to the boot sector of the first partition to restore normal, automatic loading of the Windows operating system.
 +
 
 +
Of note, there is a Linux utility called {{Ic|ms-sys}} (package {{AUR|ms-sys}} in AUR) that can install MBR's.  However, this utility is only currently capable of writing new MBRs (all OS's and file systems supported) and boot sectors (a.k.a. boot record; equivalent to using {{Ic|FIXBOOT}}) for FAT file systems.  Most LiveCDs do not have this utility by default, so it will need to be installed first, or you can look at a rescue CD that does have it, such as [http://partedmagic.com/ Parted Magic].
 +
 
 +
First, write the partition info (table) again by:
 +
 
 +
# ms-sys --partition /dev/sda1
 +
 
 +
Next, write a Windows 2000/XP/2003 MBR:
 +
 
 +
# ms-sys --mbr /dev/sda  # Read options for different versions
 +
 
 +
Then, write the new boot sector (boot record):
 +
 
 +
# ms-sys -(1-6)          # Read options to discover the correct FAT record type
 +
 
 +
{{Ic|ms-sys}} can also write Windows 98, ME, Vista, and 7 MBRs as well, see {{Ic|ms-sys -h}}.
 +
 
 +
== Time standard ==
 +
 
 +
* Recommended: Set both Arch Linux and Windows to use UTC, following [[Time#UTC in Windows]]. Some versions of Windows revert the hardware clock back to ''localtime'' if they are set to synchronize the time online. This issue appear to be fixed in Windows 10.
 +
 
 +
* Not recommended: Set Arch Linux to ''localtime'' and disable any time-related services, like [[NTPd]] . This will let Windows take care of hardware clock corrections and you will need to remember to boot into Windows at least two times a year (in Spring and Autumn) when [[Wikipedia:Daylight saving time|DST]] kicks in. So please do not ask on the forums why the clock is one hour behind or ahead if you usually go for days or weeks without booting into Windows.
  
 
== See also ==
 
== See also ==
[https://bbs.archlinux.org/viewtopic.php?id=140049 Booting Windows from a desktop shortcut]
+
 
 +
* [https://bbs.archlinux.org/viewtopic.php?id=140049 Booting Windows from a desktop shortcut]

Latest revision as of 20:24, 4 November 2016

This is an article detailing different methods of Arch/Windows coexistence.

Important information

Windows UEFI vs BIOS limitations

Microsoft imposes limitations on which firmware boot mode and partitioning style can be supported based on the version of Windows used:

  • Windows XP both x86 32-bit and x86_64 (also called x64) (RTM and all Service Packs) versions do not support booting in UEFI mode (IA32 or x86_64) from any disk (MBR or GPT) OR in BIOS mode from GPT disk. They support only BIOS boot and only from MBR/msdos disk.
  • Windows Vista or 7 x86 32-bit (RTM and all Service Packs) versions support booting in BIOS mode from MBR/msdos disks only, not from GPT disks. They do not support x86_64 UEFI or IA32 (x86 32-bit) UEFI boot. They support only BIOS boot and only from MBR/msdos disk.
  • Windows Vista RTM x86_64 (only RTM) version support booting in BIOS mode from MBR/msdos disks only, not from GPT disks. It does not support x86_64 UEFI or IA32 (x86 32-bit) UEFI boot. It supports only BIOS boot and only from MBR/msdos disk.
  • Windows Vista (SP1 and above, not RTM) and Windows 7 x86_64 versions support booting in x86_64 UEFI mode from GPT disk only, OR in BIOS mode from MBR/msdos disk only. They do not support IA32 (x86 32-bit) UEFI boot from GPT/MBR disk, x86_64 UEFI boot from MBR/msdos disk, or BIOS boot from GPT disk.
  • Windows 8/8.1 x86 32-bit support booting in IA32 UEFI mode from GPT disk only, OR in BIOS mode from MBR/msdos disk only. They do not support x86_64 UEFI boot from GPT/MBR disk, x86_64 UEFI boot from MBR/msdos disk, or BIOS boot from GPT disk. On market, the only systems known to ship with IA32 (U)EFI are some old Intel Macs (pre-2010 models?) and Intel Atom System-on-Chip (Clover trail and Bay Trail) Windows Tablets. in which it boots ONLY in IA32 UEFI mode and ONLY from GPT disk.
  • Windows 8/8.1 x86_64 versions support booting in x86_64 UEFI mode from GPT disk only, OR in BIOS mode from MBR/msdos disk only. They do not support IA32 UEFI boot, x86_64 UEFI boot from MBR/msdos disk, or BIOS boot from GPT disk.

In case of pre-installed Systems:

  • All systems pre-installed with Windows XP, Vista or 7 32-bit, irrespective of Service Pack level, bitness, edition (SKU) or presence of UEFI support in firmware, boot in BIOS-MBR mode by default.
  • MOST of the systems pre-installed with Windows 7 x86_64, irrespective of Service Pack level, bitness or edition (SKU), boot in BIOS-MBR mode by default. Very few recent systems pre-installed with Windows 7 are known to boot in x86_64 UEFI-GPT mode by default.
  • ALL systems pre-installed with Windows 8/8.1 boot in UEFI-GPT mode. The firmware bitness matches the bitness of Windows, ie. x86_64 Windows 8/8.1 boot in x86_64 UEFI mode and 32-bit Windows 8/8.1 boot in IA32 UEFI mode.

The best way to detect the boot mode of Windows is to do the following (info from here):

  • Boot into Windows
  • Press Win key and 'R' to start the Run dialog
  • In the Run dialog type "msinfo32" and press Enter
  • In the System Information windows, select System Summary on the left and check the value of BIOS mode item on the right
  • If the value is UEFI, Windows boots in UEFI-GPT mode. If the value is Legacy, Windows boots in BIOS-MBR mode.

In general, Windows forces type of partitioning depending on the firmware mode used, i.e. if Windows is booted in UEFI mode, it can be installed only to a GPT disk. If the Windows is booted in Legacy BIOS mode, it can be installed only to a MBR (also called msdos style partitioning) disk. This is a limitation enforced by Windows installer, and as of April 2014 there is no officially (Microsoft) supported way of installing Windows in UEFI-MBR or BIOS-GPT configuration. Thus Windows only supports either UEFI-GPT boot or BIOS-MBR configuration.

Such a limitation is not enforced by the Linux kernel, but can depend on which bootloader is used and/or how the bootloader is configured. The Windows limitation should be considered if the user wishes to boot Windows and Linux from the same disk, since installation procedure of bootloader depends on the firmware type and disk partitioning configuration. In case where Windows and Linux dual boot from the same disk, it is advisable to follow the method used by Windows, ie. either go for UEFI-GPT boot or BIOS-MBR boot. See http://support.microsoft.com/kb/2581408 for more info.

Install media limitations

Intel Atom System-on-Chip Tablets (Clover trail and Bay Trail) provide only IA32 UEFI firmware WITHOUT Legacy BIOS (CSM) support (unlike most of the x86_64 UEFI systems), due to Microsoft Connected Standby Guidelines for OEMs. Due to lack of Legacy BIOS support in these systems, and the lack of 32-bit UEFI boot in Arch Official Install ISO or the Archboot iso (as of April 2014), these install media cannot boot in Atom SoC tablets pre-installed with Windows 8/8.1 32-bit.

Bootloader UEFI vs BIOS limitations

Most of the linux bootloaders installed for one firmware type cannot launch or chainload bootloaders of other firmware type. That is, if Arch is installed in UEFI-GPT or UEFI-MBR mode in one disk and Windows is installed in BIOS-MBR mode in another disk, the UEFI bootloader used by Arch cannot chainload the BIOS installed Windows in the other disk. Similarly if Arch is installed in BIOS-MBR or BIOS-GPT mode in one disk and Windows is installed in UEFI-GPT in another disk , the BIOS bootloader used by Arch cannot chainload UEFI installed Windows in the other disk.

The only exceptions to this are grub(2) in Apple Macs in which EFI installed grub(2) can boot BIOS installed OS via appleloader command (does not work in non-Apple systems), and rEFInd which technically supports booting legacy BIOS OS from UEFI systems, but does not always work in non-Apple UEFI systems as per its author Rod Smith.

However if Arch is installed in BIOS-GPT in one disk and Windows is installed in BIOS-MBR mode in another disk, then the BIOS bootloader used by Arch CAN boot the Windows in the other disk, if the bootloader itself has the ability to chainload from another disk.

Note: If Arch and Windows are dual-booting from same disk, then Arch SHOULD follow the same firmware boot mode and partitioning combination used by the installed Windows in the disk.

UEFI Secure Boot

All pre-installed Windows 8/8.1 systems by default boot in UEFI-GPT mode and have UEFI Secure Boot enabled by default. This is mandated by Microsoft for all OEM pre-installed systems.

Arch Linux install media currently supports Secure Boot. See Secure Boot#Booting archiso.

It is advisable to disable UEFI Secure Boot in the firmware setup manually before attempting to boot Arch Linux. Windows 8/8.1 SHOULD continue to boot fine even if Secure boot is disabled. The only issue with regards to disabling UEFI Secure Boot support is that it requires physical access to the system to disable secure boot option in the firmware setup, as Microsoft has explicitly forbidden presence of any method to remotely or programmatically (from within OS) disable secure boot in all Windows 8/8.1 pre-installed systems

Fast Start-Up

Fast Start-Up is a feature in Windows 8 and above that hibernates the computer rather than actually shutting it down to speed up boot times. Your system can lose data if Windows hibernates and you dual boot into another OS and make changes to files. Even if you do not intend to share filesystems, the EFI System Partition is likely to be damaged on an EFI system. Therefore, you should disable Fast Startup, as described here for Windows 8 and here for Windows 10, before you install Linux on any computer that uses Windows 8 or above.

ntfs-3g added a safe-guard to prevent read-write mounting of hibernated disks, but the NTFS driver within the Linux kernel has no such safeguard.

Windows filenames limitations

Windows is limited to filepaths being shorter than 260 characters.

Windows also puts certain characters off limits in filenames for reasons that run all the way back to DOS:

  • < (less than)
  • > (greater than)
  •  : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  •  ? (question mark)
  • * (asterisk)

These are limitations of Windows and not NTFS: any other OS using the NTFS partition will be fine. Windows will fail to detect these files and running chkdsk will most likely cause them to be deleted. This can lead to potential data-loss.

NTFS-3G applies Windows restrictions to new file names through the windows_filenames option (see fstab).

Installation

The recommended way to setup a Linux/Windows dual booting system is to first install Windows, only using part of the disk for its partitions. When you have finished the Windows setup, boot into the Linux install environment where you can create additional partitions for Linux while leaving the existing Windows partitions untouched. The Windows installation will create the EFI System Partition which can be used by your Linux bootloader.

BIOS systems

Using a Linux boot loader

You may use GRUB or Syslinux.

Using Windows boot loader

With this setup the Windows bootloader loads GRUB which then boots Arch.

Windows Vista/7/8/8.1 boot loader

The following section contains excerpts from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Using ext3 formatted /boot partition, windows bootloader works just fine (Discuss in Talk:Dual boot with Windows#)

In order to have the Windows boot loader see the Linux partition, one of the Linux partitions created needs to be FAT32 (in this case, /dev/sda3). The remainder of the setup is similar to a typical installation. Some documents state that the partition being loaded by the Windows boot loader must be a primary partition but I have used this without problem on an extended partition.

  • When installing the GRUB boot loader, install it on your /boot partition rather than the MBR.
    Note: For instance, my /boot partition is /dev/sda5. So I installed GRUB at /dev/sda5 instead of /dev/sda. For help on doing this, see GRUB#Install to partition or partitionless disk
  • Under Linux make a copy of the boot info by typing the following at the command shell:
my_windows_part=/dev/sda3
my_boot_part=/dev/sda5
mkdir /media/win
mount $my_windows_part /media/win
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1
  • Boot to Windows and open up and you should be able to see the FAT32 partition. Copy the linux.bin file to C:\. Now run cmd with administrator privileges (navigate to Start > All Programs > Accessories, right-click on Command Prompt and select Run as administrator):
bcdedit /create /d “Linux” /application BOOTSECTOR
  • BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You will need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}.
bcdedit /set {ID} device partition=c:
bcdedit /set {ID}  path \linux.bin
bcdedit /displayorder {ID} /addlast
bcdedit /timeout 30

Reboot and enjoy. In my case I'm using the Windows boot loader so that I can map my Dell Precision M4500's second power button to boot Linux instead of Windows.

UEFI systems

If you already have Windows installed, it will already have created some partitions (on a GPT-formatted disk):

  • a partition of type ef00 EFI System and filesystem FAT32,
  • a partition of type 0c01 Microsoft reserved, generally of size 128 MiB,
  • a partition of type 0700 Microsoft basic data and of filesystem NTFS, which corresponds to C:\,
  • potentially system recovery and backup partitions and/or secondary data partitions (corresponding often to D:\ and above).

Using the Disk Management utility in Windows, check how the partitions are labelled and which type gets reported. This will help you understand which partitions are essential to Windows, and which others you might repurpose: the first 3 bullets in the above list are essential, do not delete them.

You can then proceed with partitioning, depending on your needs. Mind that there is no need to create an additional EFI System Partition, since it already exists (see above): when required, mount this to /boot, install your bootloader to it and save the entry in /etc/fstab.

Concerning bootloaders, systemd-boot and rEFInd autodetect Windows Boot Manager (\EFI\Microsoft\Boot\bootmgfw.efi) and show it in their boot menu automatically. For GRUB follow GRUB#Windows installed in UEFI-GPT Mode menu entry. Syslinux (as of version 6.02 and 6.03-pre9) and ELILO do not support chainloading other EFI applications, so they cannot be used to boot \EFI\Microsoft\Boot\bootmgfw.efi.

Computers that come with newer versions of Windows often have Secure Boot enabled. You will need to take extra steps to either disable Secure Boot or to make your installation media compatible with secure boot (see above and in the linked page).

Troubleshooting

Couldn't create a new partition or locate an existing one

The usb-stick for installing Windows 8.1 seems to need a MBR partition table (not GPT), otherwise the installation gets confused and prints something like "Couldn't create a new partition or locate an existing one", although the partitions were created.

Cannot boot Linux after installing Windows

See UEFI#Windows changes boot order.

Restoring a Windows boot record

By convention (and for ease of installation), Windows is usually installed on the first partition and installs its partition table and reference to its bootloader to the first sector of that partition. If you accidentally install a bootloader like GRUB to the Windows partition or damage the boot record in some other way, you will need to use a utility to repair it. Microsoft includes a boot sector fix utility FIXBOOT and an MBR fix utility called FIXMBR on their recovery discs, or sometimes on their install discs. Using this method, you can fix the reference on the boot sector of the first partition to the bootloader file and fix the reference on the MBR to the first partition, respectively. After doing this you will have to reinstall GRUB[broken link: invalid section] to the MBR as was originally intended (that is, the GRUB bootloader can be assigned to chainload the Windows bootloader).

If you wish to revert back to using Windows, you can use the FIXBOOT command which chains from the MBR to the boot sector of the first partition to restore normal, automatic loading of the Windows operating system.

Of note, there is a Linux utility called ms-sys (package ms-sysAUR in AUR) that can install MBR's. However, this utility is only currently capable of writing new MBRs (all OS's and file systems supported) and boot sectors (a.k.a. boot record; equivalent to using FIXBOOT) for FAT file systems. Most LiveCDs do not have this utility by default, so it will need to be installed first, or you can look at a rescue CD that does have it, such as Parted Magic.

First, write the partition info (table) again by:

# ms-sys --partition /dev/sda1

Next, write a Windows 2000/XP/2003 MBR:

# ms-sys --mbr /dev/sda  # Read options for different versions

Then, write the new boot sector (boot record):

# ms-sys -(1-6)          # Read options to discover the correct FAT record type

ms-sys can also write Windows 98, ME, Vista, and 7 MBRs as well, see ms-sys -h.

Time standard

  • Recommended: Set both Arch Linux and Windows to use UTC, following Time#UTC in Windows. Some versions of Windows revert the hardware clock back to localtime if they are set to synchronize the time online. This issue appear to be fixed in Windows 10.
  • Not recommended: Set Arch Linux to localtime and disable any time-related services, like NTPd . This will let Windows take care of hardware clock corrections and you will need to remember to boot into Windows at least two times a year (in Spring and Autumn) when DST kicks in. So please do not ask on the forums why the clock is one hour behind or ahead if you usually go for days or weeks without booting into Windows.

See also