Dual boot with Win10 on Lenovo X1 Carbon Gen7 Carbon-fiber Weave 20QD Thinkpad

Asked by Viktors Berstis on 2019-11-26

The X1 Carbon type 20QD system comes with Window 10 pro installed. I made the windows main partition smaller by using their Disk Manager. I then installed Ubuntu 19.10. It seems to install and does put its files there, but dual boot does not work. The system always boots back into Windows. I was able to install 19.10 if I erase the drive and install it alone. I have restored the Windows system. There is no option in BIOS for anything like legacy boot. Windows has an efi partition, but I don't see a way to make Ubuntu an option at boot time even though there seems to me an Ubuntu directory there. Any suggestions?

Incidentally Ubuntu 18 and 16 do not boot successfully in trial mode (from DVD) on this machine. But interestingly 14.04.3 does boot but you need a magnifyling glass to read the tiny text on the 3840 x 2160 display.

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Last query:
Last reply:

This question was reopened

Viktors Berstis (berstis) said : #1

If I move /EFI/Microsoft/Boot/bootmgfw.efi to / in the original boot partiion and then point /boot/grub/grub.cfg to the new location for this file, then the grub boot menu does appear instead of automatically booting Windows without any choice. So there is something in the Ubuntu install procedure that sets up grub that seems to be the ultimate problem.

Viktors Berstis (berstis) said : #2

After much experimentation, if /EFI/Microsoft/Boot/bootmgfw.efi exists, then BIOS boots Windows 10 no matter what you did with grub. Renaming this file lets grub boot. If you rename this file in the entry in /boot/grub/grub.cfg then you can get Windows on the grub menu. If you run update-grub however, there seems to be some other problem because it shows no menu and just boots the first menu item which is Ubuntu, and the cfg file does not have Windows in it. The grub.cfg created using the install process from the DVD somehow works, but the font is infinitesimal. I tried creating a larger font and then grub again does not show the menu. So there must be some problem with grub handling the display adapter / screen on this particular machine.

I am not a grub expert, but there is something wrong with the way it discovers things on this machine.

Bernard Stafford (bernard010) said : #3

Did you try changing the Boot order in the BIOS ? To Ubuntu First. Turn off Secure Boot In BIOS.
The idea is to have the boot loader load which OS you prefer to load first then the other second.
This should all be in the BIOS.

Viktors Berstis (berstis) said : #4

I had "secure boot" turned off. "Platform mode" to "setup", not "User mode" which "uses platform key for secure boot." "Secure boot mode" to "custom" instead of "Standard mode" where "only microsoft or lenovo certified program can be executed." Varying these did not make update-grub do any better. There is no option in BIOS to select the operating system, only the boot devices. If the file /EFI/Microsoft/Boot/bootmgfw.efi is there by that name, it boots Windows no matter what. So I just changed that name and made the same name change in the grub.cfg file created during installation of Ubuntu. That is the only grub config that works. Running update-grub creates a grub.cfg that does not work. You cannot see the menu, and it does not seem to respond to the keyboard either (hitting enter or up down keys). The update-grub created grub.cfg boots the first menu item after the timeout (if bootmgfw.efi has been renamed). So it looks like update-grub does not handle the display device and keyboard drivers correctly somehow.

To change that file name bootmgfw.efi I have to boot a trial version of Ubuntu, mount that first partition and change that name. Likewise for changing the name in /boot/grub/grub.cfg in the Ubuntu main partition.

This hack works, except that updates to grub will cause problems. Furthermore, the font is way too small. I tried creating a larger font for grub, substituting the new font file for the default one. But then it brings up a blank screen with no menu like the one that update-grub creates.

Viktors Berstis (berstis) said : #5

So I really don't have a fix for what update-grub does, nor how to get it to work with the larger font. There may also be a bug in Lenovo's EFI support prioritizing Windows 10 over everything else.

Bernard Stafford (bernard010) said : #6

What I was referring to in the BIOS was Boot EFI first instead of Boot Legacy. It is on the Boot options. When changed it will only boot that option first being the EFI. Secure boot off to install Linux. The Font should not make any difference in the boot loader operations. Hope that works . I am not familiar with the trial mode from a DVD. My preference is to install the New OS on a USB using Etcher. Then optional live boot or install OS onto Hard drive.

Viktors Berstis (berstis) said : #7

It is set to use EFI. But this machine apparently does not follow the rules. If that Windows boot file is present, it uses it in priority over everthing else. By renaming this file to something else, then that does not happen and I can boot with my grub.cfg file created by the DVD Ubuntu disk.

However, update-grub somehow does not apparently recognize the display support properly and creates a config file which is useless on this machine. To debug this, I imagine you would have to actually use one of these unusual thinkpads.

Launchpad Janitor (janitor) said : #8

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Viktors Berstis (berstis) said : #9

I thought I would summarize the details of my hack to get dual boot with Windows 10 and Ubuntu working:

Starting with the Lenovo X1 gen 7 carbon weave machine (20QD001XUS) with windows 10 installed:
1. Backup your hard drive in case of trouble
2. Resize windows partition to leave room for ubuntu using gparted or something
3. Install ubuntu 19 in freed up space
4. Boot ubuntu 19 trial
5. alt-F4 to get out of error screen
6. enter to login
7. ctrl-alt-T to get terminal
8. sudo bash
9. mkdir /x
10. mount /dev/nvme0n1p3 /x (or whatever partition has the following dir)
11. cd /x/EFI/Microsoft/Boot
12. mv bootmgfw.efi bootw10.efi
13. umount /x
14. mount /dev/nvme0n1p4 /x (or the ubuntu partition with the following)
15. cd /x/boot/grub
16. Change bootmgfw.efi to bootw10.efi in grub.cfg file
17. Move the menuentry section for windows to the first position if you want
  windows to be the default
18. Get out your magnifyling glasses and reboot
19. Save your /boot/grub/grub.cfg file in case grub gets updated, so you can restore it
The grub update seems to create a grub.cfg file that does not work. You will have to use
a trial boot of Ubuntu to get in there and restore the grub.cfg file, unless someone fixes grub.