From f4436afe3cc00f6da9eba4b5b23f3931f122c4d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
 <marmarek@invisiblethingslab.com>
Date: Sun, 6 Mar 2016 00:12:01 +0100
Subject: [PATCH] Add UEFI troubleshooting guide

---
 doc.md                             |  1 +
 installing/uefi-troubleshooting.md | 46 ++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 installing/uefi-troubleshooting.md

diff --git a/doc.md b/doc.md
index 36a501a9..950fefce 100644
--- a/doc.md
+++ b/doc.md
@@ -140,6 +140,7 @@ Troubleshooting
  *  [Solving problems with Macbook Air 2012](https://groups.google.com/group/qubes-devel/browse_thread/thread/b8b0d819d2a4fc39/d50a72449107ab21#8a9268c09d105e69)
  *  [Getting Sony Vaio Z laptop to work with Qubes](/doc/sony-vaio-tinkering/)
  *  [Getting Lenovo 450 to work with Qubes](/doc/lenovo450-tinkering/)
+ *  [Troubleshooting UEFI related problems](/doc/uefi-troubleshooting/)
 
 
 Reference Pages
diff --git a/installing/uefi-troubleshooting.md b/installing/uefi-troubleshooting.md
new file mode 100644
index 00000000..4e18e2f8
--- /dev/null
+++ b/installing/uefi-troubleshooting.md
@@ -0,0 +1,46 @@
+---
+layout: doc
+title: UEFI Troubleshooting
+permalink: /doc/uefi-troubleshooting/
+---
+
+Troubleshooting UEFI related problems
+========================================
+
+
+
+Cannot start installation, it hangs after GRUB menu ("Test media and install Qubes OS")
+---------------------
+
+There is some [common bug in UEFI implementation](http://xen.markmail.org/message/f6lx2ab4o2fch35r), affecting mostly Lenovo systems, but probably some others too. You can try existing workaround:
+
+1. In GRUB menu press `e`.
+2. At the end of `chainloader` line add `/mapbs /noexitboot`.
+3. Perform installation normally, but not reboot system at the end yet.
+4. Go to `tty2` (Ctrl-Alt-F2).
+5. Execute `mount | grep boot/efi` and note device name (first column). It should be something like `/dev/sda1`.
+6. Execute `efibootmgr -v`, search for `Qubes` entry and note its number (it should be something like `Boot0001` - `0001` is an entry number).
+7. Replace existing `Qubes` entry with modified one. Replace `XXXX` with entry number from previous step, `/dev/sda` with your disk name and `-p 1` with `/boot/efi` partition number):
+
+        efibootmgr -b XXXX -B
+        efibootmgr -v -c -u -L Qubes -l /EFI/qubes/xen.efi -d /dev/sda -p 1 "placeholder /mapbs /noexitboot"
+
+8. Compare new entry with the old one (printed in step 6) - it should only differ in additional options at the end.
+9. Now you can reboot the system by issuing `reboot` command.
+
+
+System crash/restart when booting installer
+-------------------------------------------
+
+Some Dell systems and probably others have [another bug in UEFI firmware](http://markmail.org/message/amw5336otwhdxi76). And there is another workaround for it:
+
+
+1. In GRUB menu press `e`.
+2. At the end of `chainloader` line add `-- efi=attr=uc`.
+3. Perform installation normally, but not reboot system at the end yet.
+4. Go to `tty2` (Ctrl-Alt-F2).
+5. Execute:
+
+        sed -i -e 's/^options=.*/\0 efi=attr=uc' /mnt/sysimage/boot/efi/qubes/xen.cfg
+
+6. Now you can reboot the system by issuing `reboot` command.