Dual Booting Windows and Linux

Tips and Tricks for Peaceful Coexistence

Christopher Dent
6 min readSep 8, 2021

I finally partitioned my hard drive and installed Ubuntu 20.04 following this excellent guide. The guide is great, and there are dozens of others out there, so I am not going to spend this blog article going over how to install the thing. Rather, I’m going to address the issues that I’d faced with previous dual boot setups which led to my hesitancy in doing this to my new laptop. Now that these are fixed, I wish I’d done it months ago. These were not all easily solvable, so I’m writing this up in the hopes that someone else using a similar setup will find this useful someday.

LONG LIVE THE FOCAL FOSSA.

There were three main issues I had with Ubuntu/Windows dual-boot on my old machine:

  • Unexplained time difference on the clocks between the two OS’s
  • Bluetooth devices needing to be re-paired every time I switched OS’s
  • NVIDIA driver compatibility issues.

I’ll explain how I fixed all three of them below.

NVIDIA Issues

If you’re on a gaming machine like I am, or anything with an NVIDIA card, this may well by the first frustration you encounter so let’s address that first.

So you’ve successfully installed Ubuntu alongside Windows 10. Horray! But something’s not right — maybe your second screen isn’t being detected, maybe your gaming graphics look 15 years old — something just isn’t right display-wise. If you have an NVIDIA graphics card, its driver is most certainly the culprit. The Ubuntu community maintains a generic driver called Nouveau for NVIDIA cards, but it’s limited — 3D games typically don’t work as well and in my case, with one of the newest NVIDIA cards on the market, it couldn’t even properly extend the screen. Google around a bit and you’ll be directed to to the “additional drivers” window in the Ubuntu GUI. It looks something like this:

Currently selected is 460, the one that randomly worked.

The guide I was using said to choose the latest proprietary driver that was also tested — that was 470, top of the list. So I did, and I restarted. And nothing happened. Panic! My computer wouldn’t even boot! I had to restart using the Ubuntu live USB disk I’d created and drop into the terminal from there. In the terminal I typed the following command:

sudo prime-select intel

This told Nvidia to stand down and let the system use the integrated Intel graphics card. Definitely not a great long term solution, but it should allow your machine to at least boot up. Once back in the Ubuntu GUI, I opened another terminal and typed

prime-select query

The output of which was “Intel”. This confirmed that I was using the Intel integrated graphics card, not my NVIDIA card. Now, on my last laptop, the one I made it through Flatiron with, I actually left it at that- the Intel chip was fine for coding and I did all of my gaming on Windows anyway. But I didn’t want the same shortcomings on my new machine so I pushed onward to find a fix. So I returned to ‘Additional Drivers” and one by one I tried the different proprietary drivers offered to me, and fortunately, one of these worked just fine. Screen extended, games fine, boots smoothly. Success!

If you are unlucky and can’t get one of the Nvidia proprietary drivers to work, you can stick with Nouveau or Intel (either of these should make the OS at least usable) and do all of your GPU-heavy stuff on your other OS. I did that for the year or so I was at Flatiron and it wasn’t a terrible system, wouldn’t have been too bad at all actually if I had known how to fix these next two issues back then….

Bluetooth Issues

If you’re dual booting and you use Bluetooth devices you’ll know that, after switching from one OS to the other, you probably have to remove and then re-pair your Bluetooth devices if you’ve been using them on the other OS. When one of your Bluetooth devices is your keyboard, this is extremely annoying!

This was not an easy fix to figure out and it’s not for the faint of heart, but as long as you pay very close attention and don’t make any typos, it should work for you as well as it did for me.

You’ll start in Linux terminal. Drop down to ROOT (sudo -s will get you into root.)

Then go all the way to the top of your Linux file tree and get to var/lib/bluetooth/XX:XX:XX:XX:XX:XX:XX (where the X’s are a series of hex letters and numbers that represent your Bluetooth adapter). cd into that directory and you’ll see some more similar looking keys. These numbers represent your actual Bluetooth devices.

i like pictures.

Cd into the appropriate device directory (for me it was C4:6E:7B:EB:CC:E3) and there should be a file called “info.” If you have multiple devices, it will take some trial and error to figure out which you are working on, but all you need to do to check is access the ‘info’ file, which you need to do anyway. Open it with vim or whatever command line text editor you use. It will look something like this:

Name=Muzen OTR MetalClass=0x240404SupportedTechnologies=BR/EDR;Trusted=trueBlocked=falseServices=0000110b-0000-1000-8000-00805f9b34fb;[LinkKey]Key=AB2B74C1B0B28312993D6942017E6EC9Type=4PINLength=0

I can see at the top that this info file is supporting my Muzen Bluetooth Speaker. Then copy the file and save it somewhere you can access it from both devices, like a Google Doc or a USB drive. The KEY towards the end there will be critical in the coming steps. Also save the name of the directory you found the correct info file in (C4:6E:7B:EB:CC:E3), that will help you identify the correct key in Windows.

With the text from your ‘info’ file saved somewhere you can access it from either OS, boot up Windows. You’ll need psexec to do the next step. Download it and drop the psexec.exe file right into the C:\Windows directory. You can ignore/delete the other files that came with PsTools.

Open a plain old Windows command prompt with administrator privileges. From here, cd into C:\Windows and execute this command:

psexec -s -i regedit.exe

Your Windows registry editor will open. From there, navigate to:

hkey_local_machine\system\controlset001\services\BHPORT\parameters\keys\(Your_Adapter_ID)

Within that adapter ID folder, you should see the 12 digit hex key that identified the device in question back in Linux, in my case C6:6E:7B:EB:CC:E3 (but without the colons, and the letters may be lower case). Right click it and select ‘modify binary data.’ You should have been going very carefully this whole time, but here’s where you really, really don’t want to make a typo….

OVERWRITE any key already in there with the link key you got from Linux earlier. Click OK. Close regedit, and BAM, your Bluetooth device should be working immediately. Very cool!

Time Zone Issues

This was the last thing that drove me crazy on my old dual boot laptop and turned out to be by far the easiest fix of the three. In Linux, Just open up a terminal and type

timedatectl set-local-rtc 1

This tells Linux to use t he local time for the hardware clock rather than offsetting you to UTC/GMT as it loves to do by default because, England.

Conclusion

In my opinion, Linux or Mac are the best environments for programming. But many people can’t afford a Mac or just don’t want one for whatever reason. In my case, I wanted a gaming laptop but I also wanted to be able to code on it. I didn’t want to get rid of Windows altogether, for all its faults it provides consistent updates, the best drivers, superior compatibility, and is probably the better gaming environment. But WSL just was not cutting it anymore as a coding environment. So for me, dual boot was the best option and with these three tweaks implemented, it’s smooth sailing over here on this beast of a laptop. Signing off for today! ~christopher j dent.

--

--

Christopher Dent

student of code. var my_homes = [‘NY’, ‘MTL’, ‘DC’, ‘EDI’, ‘FL’, ‘?’]