February 2017 1 post
Dual-booting Fedora 25 and Windows 10 on Thinkpad T560 with UEFI
Tuesday, February 28, 2017
I just bought a new Lenovo Thinkpad T560. It runs both Windows 10 and Fedora 25 quite well, but I had a lot of trouble getting the system to dual-boot. In hopes of helping somebody, here are the steps I had to take to get it to work. I'm assuming you're starting with a new laptop with Windows 10 installed, since that's what it comes with from the factory.
- Before doing anything else, open Power Options in Windows and turn off "fast startup" so that Windows fully shuts down.
- Open Disk Management and shrink the Windows partition, leaving enough space for the Linux installation. Luckily, the Windows 10 Disk Management tool makes this very easy and very fast — it wasn't so in the past!
- Head over to a different machine already running Fedora, and grab the netinst iso image. I got mine from here; see the links on the right-hand side of the page.
- Create USB boot media using
livecd-iso-to-disk
:# livecd-iso-to-disk Fedora-netinst-x86_64-25-1.3.iso /dev/sdb1
- The Thinkpad has UEFI Secure Boot enabled by default, which prevents it from booting off of this USB drive. Reboot the laptop and enter the Thinkpad setup utility by hitting F1 at the boot screen. Disable Secure Boot, and enable UEFI + Legacy boot. Save and exit the setup utility.
- At the boot screen again, hit F12 to enter the boot menu and choose the USB drive.
- Follow the Fedora installer like normal, taking care of course to only create partitions in the free space and not overwrite any existing partitions. Since this is a laptop with one drive, I didn't see any need for LVM and I chose the "standard" partitioning + encryption.
- After Fedora setup finished, I wasn't able to boot off the hard drive at all, not even into windows. So, boot off of the USB drive again. Choose the recovery option. It will find the new Fedora installation.
chroot
into your system:# chroot /mnt/sysimage
- Fedora's installer seems to have detected the system as a BIOS (not EFI) booting system. Let's fix that. Open
parted
:# parted /dev/sda
- At the
parted
prompt, toggle thepmbr_boot
flag off:(parted) toggle disk_toggle pmbr_boot (parted) q
You can verify this worked by issuingprint
. The "Disk Flags" list should not containpmbr_boot
. At this point, Windows should be bootable if you hit F12 at the startup screen and choose the Windows Boot Manager, but Fedora still won't boot. - Locate your EFI partition, which is the one with type
EFI System
. Mine is/dev/sda1
, and yours probably is too.# fdisk -l Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 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: (a UUID here) 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 205367295 204800000 97.7G Microsoft basic data ...
- Get the EFI partition's UUID:
# blkid /dev/sda1
- Add a line to
/etc/fstab
so it always gets mounted:UUID=abcd-0123 /boot/efi vfat defaults 0 2
- Mount it:
# mount -a
You should see some files in /boot/efi now. - Install stuff needed for EFI boot. Remember, you are still booted into the USB recovery system, but these will install into the right place since the system is
chroot
'ed.# dnf install grub2-efi grub2-efi-modules shim
- Because the system is still booted off of the USB drive,
grub2-mkconfig
doesn't think the system is an EFI system at this point. We'll need to manually copy the GRUB config file:# cp /boot/grub2/grub.cfg /boot/efi/EFI/fedora/grub.cfg
- Open
/boot/efi/EFI/fedora/grub.cfg
(e.g. withvi
) and search/replacelinux16
andinitrd16
withlinuxefi
andinitrdefi
. - Now reboot and hit F12 at the boot screen to open the boot menu. Choose to boot off of the hard drive. You should get the GRUB menu and Fedora should boot!
- To be sure that this will survive kernel updates, once you've successfully booted into Fedora, try this and make sure it still boots:
# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
- Go back into the Thinkpad setup utility, switch it to boot from UEFI only, and re-enable Secure Boot.
At this point, Fedora should show up in the boot menu that appears when you hit F12, and it can be set as the default using the setup utility. To boot Windows, either choose the Windows Boot Manager from the boot menu, or choose Windows from the GRUB menu. Either way works.
Aside from this painful series of steps which almost made me want to give up and just wipe Windows off of it completely, the T560 actually works really well with Fedora. I guess Linux isn't what it was 15 years ago — wifi, audio, suspend, OpenGL, display brightness, everything just works fine out of the box. No screwing with wpa_supplicant
, xorg.conf
, or any of that! And the battery life on this machine is magnificent!