It’s 2019 and dual-booting Windows/Linux is still not an easy feast!

Ever since I moved to Apple ecosystem few years ago, I used Mac exclusively for desktops and Linux exclusively for servers and therefore don’t ever feel the need to touch a Windows machine. However recently I found myself occasionally need to have access to a Windows machine to upgrade firmwares, play games and stuffs. So with my Intel NUC, the obvious choice would be to dual-boot between Windows and Linux. My choices are Windows 10 (because I can use it indefinitely without activation) and Ubuntu 18 LTS. But man, dual-booting comes with so many problem.

Clock time is off in dual-boot

I am on EST timezone. Every time I boot in to Linux the time is correct, but every time I boot into Windows the clock is 5 hours off. Turns out OSes store and retrieve time in hardware clock. However the way they store time is different. Linux uses UTC while Windows use local time. The solution is to switch Linux to use local time, or Windows to use UTC. Full instructions here.

Bluetooth keyboard needs to pair again every time

When you pair a bluetooth device, the information about the device is stored on the OS, and information about the OS is also stored on the device. When you switch between OSes and pair again, the pairing key on the device is overwritten by the OS. The solution is to use the same pairing key on both systems. It’s not possible to manually change pairing key on Windows, but we can do that on Linux. Full instructions is here, but the basic steps are:

  • Pair all devices on Linux
  • Pair all devices on Windows
  • From Windows, extract pairing keys using Registry
  • Turn off all bluetooth devices, then boot to Linux (to prevent fail pairing)
  • Modify pairing keys on Linux

Boot to the other system without a wired keyboard.

I don’t have a wired keyboard, and don’t plan to buy one just so I can switch between systems. There comes the third problem. During boot, grub does not recognize bluetooth keyboards, therefore I cannot choose systems during boot. From Linux, I can change grub config to select a different default, but from Windows, I have no mean to do that.

The solution is Grub Environment Block. The next_entry setting in /boot/grub/grubenv controls which entry will be selected on the next boot. grub will clear that value after the next boot, and in fact it’s how grub-reboot operate if I understand it correctly. In my grub menu, Ubuntu is 0 and Windows is 2

From Linux to Windows
sudo grub-reboot 2
sudo reboot
From Windows to Linux

I need to be able to mount the Linux partition in order to modify grubenv. I use Linux File Systems for Windows by Paragon Software. It comes with 10-day trial and then throttled access after that, but I don’t need high speed transfer to edit a text file, so it serves the purpose.

Dual-booting Windows 10/Ubuntu 18
Tagged on:                                             

Leave a Reply