Knowledge Base : Install Qubes OS 3.2 on Lenovo Thinkpad T540p

Initially, I had a tough time installing QubesOS on a Thinkpad. Qubes wouldn’t boot at all from the installation medium, and after I doctored the installer on an USB stick, it did boot, but froze immediately with a blinking cursor. The only Linux distribution which did boot from DVD or USB stick was Fedora.

This is how I finally got QubesOS 3.2 running on a Thinkpad:

  1. Create a Fedora 27 Live DVD using the Fedora LiveCD creator available at: https://getfedora.org/workstation/download/
  2. Start Thinkpad, press F12 (or, on a Thinkpad X61s, the blue ThinkAdvantage button followed by F12). Make sure the function lock key is activated on a 102-key-notebook like the 540 to access function keys
  3. Enter BIOS and set the following things:
    1. USB UEFI BIOS Support: Enabled
    2. UEFI/Legacy Boot: UEFI Only
    3. Secure Boot: Disabled
  4. Boot Thinkpad from Fedora DVD to get a live system, skipping the installer
  5. Write the Qubes installer image onto an USB stick of 16G size:
    1. First, install “livecd-tools” into the Fedora live system: # dnf install livecd-tools 
    2. Make sure the root file system of the Fedory live installation did not run out of space
    3. Download the Qubes OS 3.2 ISO image at: https://mirrors.kernel.org/qubes/iso/Qubes-R3.2-x86_64.iso into the live system using Firefox or better wget. It will not fit into the live system disk, but you can format and mount the Thinkpads internal HDD to obtain space. I just installed a Fedora Linux onto the Thinkpad useing the install DVD before, but you might also just use fdisk and create a new partition, or use any existing partition of the noteboosks internal disk (which will of course be deleted in this process)
  6. Within Fedora, attach the USB stick that you would like to turn into your Qubes Installation USB Stick. Use dmesg to figure out what the device name of that stick is. For these instructions, I assume it’s /dev/sdb
  7. Umount any volumes of the USB stick which might have been mounted: # umount /dev/sdb*
  8. Use livecd-tools to copy the image: # livecd-iso-to-disk --format --efi /mnt/Qubes-R4.0-rc3-x86_64.iso /dev/sdb
  9. When imaging is complete, change the partition label to BOOT: # dosfslabel /dev/sdd1 BOOT
  10. Now create a mount point and mount the partition:
      1. # mkdir /mnt/qinst
      2. # mount /dev/sdd1 /mnt/qinst/
  11. Use your favorite editor to edit the file /mnt/qinst/EFI/BOOT/xen.cfg: Replace all instances of LABEL=Qubes-R4.0-rc3-x86_64 with LABEL=BOOT. There is typically no space in front of LABEL, but there is a space at the end of the portion you replace.
  12. Unmount the Qubes Installation USB stick: # umount /dev/sdb* and disconnect it
  13. Reboot, remove DVD and USB stick, boot from the stick, but dont run the installer, but in GRUB menu, select “Troubleshoot”, then “Boot from device”, then press “e"
  14. At the end of the “chainloader" line add the text: “/mapbs /noexitboot"
  15. Perform the Qubes OS installation normally. After installation, reboot. In my case, the notebook froze on trying to get a shell after the installation by pressing CTRL-Alt-F2. Now, the system will not boot.
  16. Reboot from the Fedora live DVD
  17. Mount the Thinkpads disk, where Qubes has been installed onto, like, /mnt
  18. Edit /mnt/sysimage/boot/efi/EFI/qubes/xen.cfg and add to every kernel section:
    mapbs=1
    noexitboot=1
    You must add these parameters on two separate new lines (one paramater on each line) at the end of each section that includes a kernel line
  19. Copy /mnt/sysimage/boot/efi/EFI/qubes/ to /mnt/sysimage/boot/efi/EFI/BOOT/.
  20. Rename /mnt/sysimage/boot/efi/EFI/BOOT/xen.efi to /mnt/sysimage/boot/efi/EFI/BOOT/BOOTX64.efi.
  21. Rename /mnt/sysimage/boot/efi/EFI/BOOT/xen.cfg to /mnt/sysimage/boot/efi/EFI/BOOT/BOOTX64.cfg.
  22. Unmount /mnt and reboot
  23. Your Qubes will hopefully boot now.

See also: https://www.qubes-os.org/doc/thinkpad-troubleshooting/ and https://www.qubes-os.org/doc/uefi-troubleshooting/