#Dual-booting Windows 10 and Ubuntu 18.04 LTS on the ASUS UX331UN
I recently bought an ASUS UX331UN laptop.
It packs an NVIDIA MX150 into a thin, light machine. That seemed like a good balance, although the GPU turned out to be the trickiest part of the setup.
I dabble in machine learning and wanted to run inference on small models, so I installed Ubuntu 18.04 LTS alongside Windows.
A note for myself regarding the setup of the environment.
##In this article
- Replace the SSD in UX331UN with one compatible with NVMe.
- Build a dual boot environment with Windows 10 Home and Ubuntu 18.04 LTS on UX331UN.
- Install the NVIDIA GPU driver and stabilize its operation
- Switching between Intel's Integrated GPU and NVIDIA's GPU manually
##Replacing the SSD
In UX331UN, it initially comes with a M.2 SATA SSD 256GB.
If it's 256GB, when divided simply between Windows and Ubuntu, each will get 128GB.
This is a bit unconvincing.
Also, it seems that there are also versions with NVMe SSD in the overseas models.
So, it seems that it will support NVMe as well as SATA on the hardware side.
It will be much more advantageous in terms of access speed, so if possible, I would like to go with NVMe instead of SATA.
After looking it up, I found that there were pioneers in SSD replacement, so I referred to them for reference.
I followed that procedure successfully. Here are the details that were easiest to miss.
###Backing up Windows 10 Home
First, take a backup of the pre-installed Windows 10 Home.
The steps are as follows.
- Disabling BitLocker
BitLocker encrypts the drive.
If someone steals the laptop, they still need the key to read the encrypted data.
For the system-image backup I made below, I first disabled BitLocker.
Refer to the following page to disable BitLocker.
-
Creating a System Image
Back up the Windows 10 Home installation as it stands.
Write the image to an external drive with at least as much space as the SSD you’re backing up. I used 128 GB as the minimum.
It would be good to refer to the following page.
-
https://pc-karuma.net/windows-10-create-a-system-image-backup/
-
Create a recovery drive
Next, create the recovery drive.
Booting from the recovery drive lets you restore the system image to the replacement SSD.
I used a USB stick with at least 32 GB of capacity.
The detailed steps can be referred to on the following page...
Now you can create a backup of the current Windows 10.
###Replacing the SSD
With both backups ready, I moved on to the hardware.
I chose the SSD below because another UX331UN owner had already tested it.
The exchange procedure is as follows.
- Remove the ten T5 screws from the bottom cover.
- Lift the rubber feet on the hinge side and remove the two Phillips-head screws underneath.
- The feet are hard to lift. The construction matched the one in these photos.
- Slowly lift the cover, starting at the edge opposite the hinge.
- Work gently around the clips on the hinge side so they don’t snap.
- Remove the single screw holding the SSD in its M.2 slot, then slide the original SSD out.
- Fit the replacement NVMe SSD.
- Refit the cover in the reverse order.
- Make sure all the clips engage.
Now the SSD replacement is complete.
##Restoring Windows 10 Home
Restore Windows 10 Home from a backup to a newly installed SSD.
The steps are as follows.
- Plug in both the recovery USB stick and the external drive containing the image, then turn on the UX331UN.
- Hold F2 as soon as it powers on to open the BIOS.
- Press F8 and select the USB recovery drive as the boot device.
- Follow the recovery guide to restore the system image to the new SSD.
- Choose System Image Recovery and follow the prompts.
- When the restore finishes, shut down and unplug both external drives.
- My first normal boot failed, so I started Windows in Safe Mode.
- After two failed boot attempts, run Startup Repair.
- When Windows reports that Startup Repair couldn’t repair your PC, choose Advanced options.
- Go to Troubleshoot → Advanced options → Startup Settings → Restart.
- At the Startup Settings screen, press F4 for Safe Mode.
- Reference
- Once you can log in to Windows 10 in Safe Mode, restart the machine.
- Check that it now boots normally.
That brought back my original Windows installation.
##Creating Ubuntu 18.04 LTS installation media
Next, create the Ubuntu 18.04 LTS installation media.
I will proceed using the Windows 10 that I restored just now.
Follow these steps and there should be no problem.
- Downloading the ISO file
Here to download the Ubuntu 18.04 LTS ISO file.
Download from your preferred server and hit OK. - Install Rufus.
- Write an Ubuntu ISO file to a USB flash drive
- Since you might need it again, it's best to keep the USB memory you used as a Windows recovery drive and, if possible, use a different one.
- Choose the partition layout as GPT.
- The following site may be helpful.
##Installing Ubuntu 18.04 LTS
Finally, it's time to install Ubuntu.
From here on, there are a few more details to watch for.
I referred to the following page, but there were also some differences in my environment.
Now, I will explain the actual steps I took.
- Boot the UX331UN while inserting the USB memory with Ubuntu installed.
- Hold down the F2 key to boot into the BIOS screen.
- Press F8 to boot from the Ubuntu USB memory.
- When the GRUB screen appears, select "Install Ubuntu" and then press
e. - Change the
quiet splashin lines starting with the characterlinuxtonouveau.runpm=0. - Press F10 to start the Ubuntu installation.
- Follow the usual steps to proceed with the installation.
- Not only this time, but we recommend selecting English instead of Japanese when installing.
- When installed in Japanese, some of the folder names become partially in Japanese, which is very inconvenient (you can fix it later).
- It's best to change the language to Japanese after the installation is complete.
- Proceed without checking the "Install third-party software for graphics and Wi-Fi hardware and additional media formats" step in the middle.
- It's best not to touch any parts that seem to be related to the graphics driver as much as possible.
- I haven't actually verified whether it's related or not.
- Not only this time, but we recommend selecting English instead of Japanese when installing.
- After completing, restart and choose Ubuntu from the GRUB menu to boot.
The installation is now complete.
However, on laptops with NVIDIA GPUs, various malfunctions occur in this state.
Then, I will go on to correct that part.
##Updating the GPU driver
As mentioned earlier, it is known that there are various issues with this state.
The issues I have confirmed are as follows.
- When I try to log out, restart, or shut down, it freezes.
- Little freeze-like phenomena occur occasionally, causing the cursor's movement to stop.
It could be considered a critical issue if shutting down properly fails.
These issues are similar to problems that occur with the graphics drivers that Ubuntu uses by default.
-
Change grub parameters and stop the nouveau driver
- Open
/etc/default/gruband change thequiet splashin the lines starting withlinuxtonouveau.runpm=0. - Run the following command to apply the changes.
$ sudo update-grub - Open
-
Installing NVIDIA drivers
- Run the following command to check if the GPU is recognized correctly.
$ sudo ubuntu-drivers devices- Once you have confirmed that you are correctly recognizing it, run the following command.
$ sudo ubuntu-drivers autoinstall- On the "Configure Secure Boot" screen, set the password.
- Restart once
-
Input the Secure Boot password
- Select "Enroll MOK" on the screen displayed before the OS starts.
- Enter the password you set just now
-
Checking the installation of NVIDIA drivers
- After logging in, run the following command
$ nvidia-smi- If the GPU information is correctly displayed, that's okay.
- If it does not display properly, please run the following command again.
$ sudo ubuntu-drivers autoinstall
-
Restart and shut down the system to verify that it operates without issues.
The steps that worked for me were as follows.
By the way, I referred to the following site.
##Switching GPUs
As an additional note, since NVIDIA GPUs consume a lot of power, it is said that if you don't use them, it's better to use an Intel integrated GPU, which has better battery life.
- Command for switching GPUs
# Check which GPU is active
$ sudo prime-select query
# Switch to the integrated Intel GPU
$ sudo prime-select intel
# Switch to the NVIDIA GPU
$ sudo prime-select nvidia
You need to log out once after running the command and then log in again.
Also, when you set up Bumblebee, it seems that it can automatically switch to an NVIDIA GPU when the GPU load is high.
I don't really need automatic switching, so I haven't set it up, but if you want to set it up, the following website might be helpful...
For initial setup of Ubuntu, it's good to refer to the following site.
At first, you won't be able to input Japanese, so you'll need to set that up as well.
##Wrapping up
It seems that setting up a laptop environment with Windows 10 + Ubuntu 18.04LTS + NVIDIA GPU isn't straightforward.
It took a fair amount of reading and trial and error to get here.
I wrote this for anyone setting up a similar laptop. I’ve only done it once, so some steps may be redundant, and other machines may need something I haven’t accounted for.
If a step doesn’t work for you, I’d like to hear about it.