Dual booting Kali/Ubuntu on a gaming laptop!

Ayush Raj
Nybles
Published in
7 min readJul 3, 2019

Gaming laptops and their features are fun to use but the fact that they are usually exclusively Windows only can’t be denied. Linux operating systems are life to programmers and prove to be better than their windows counterparts at many places.

I have ASUS ROG GL503GE-EN041T laptop which has 8th Gen Intel core i7–8750H processor, 8 GB DDR4 RAM with NVIDIA GeForce GTX 1050 Ti 4GB graphics. My laptop came with pre-installed Windows 10 Home. This laptop has a bunch of fancy gaming features, such as an RGB-lit keyboard, gaming center and some pre-installed softwares for recording game videos,etc .So i preferred on dual booting rather than clean installing windows.

I tried dual booting normally but it didn’t work..WHY??
This is because usually machines with NVIDIA GTX 10xx GPUs and Ryzen CPUs don’t allow Linux usual installation. On normal installation, the screen freezes or black screen appears after login page.
So , is there a workaround?
The answer is YES

Several days of digging the web finally gave the solution which i will explain to you. I would tell how I installed Ubuntu/Kali on my machine. There maybe few slightly different methods.

I will not detail a few basic steps . On any problem, you can get it right quickly by easy googling.

Let’s get started…

DISK PARTITION:

Click on Start and search for “create and format hard disk partitions”.

Now, shrink a volume to get unallocated space which you’ll use for Linux. This process takes a bit of time.

BOOTABLE USB:

Connect to the internet.

Download the latest version of Ubuntu /Kali ISO from the official site.

Now connect a USB device. Remember making it bootable erases all it’s data. So do backup if you didn’t.

I recommend using Rufus USB installer from Rufus website

Now after installing Rufus , open it and select the ISO image from it and then click START.
It will prompt image mode.

Select “Write in DD Image mode” and click OK.

Now this will take time. So, wait..
However ISO image mode may also work in some cases but not all. So, we select DD mode to be on the safe side.

INSTALLATION:

Disable Fast Startup on Windows 10:
To disable Fast Startup, go to Start > Control Panel > Power Options and click “Choose what the power buttons do” from the column on the left.

Restart your windows with USB plugged in and enter in your boot menu(google the key combination for your machine.. It was F8 for my machine).
Go to BIOS settings.

Disable “Fast Boot” and “Secure Boot Control” from BIOS settings. Save changes and boot into your bootable device from boot options.

Select the graphical installer and then set up the kali linux

Kali:

Now you will see the Kali Linux Grub Bootloader with a blue screen. From the GRUB loader select Kali Linux and press E.
Navigate cursor to row where starting with Linux then on the end of the row replace “quiet splash” with “nouveau.modeset=0” (without quote marks).
Then press F10.

Now follow the steps to install Kali Linux and remember not to use any third party software. If you don’t know normal installation then refer to the installation section of this link for normal installation.

Once your back into the desktop open your terminal. Press Ctrl+Alt+T if touch pad is not working and enter:

gedit /etc/default/grub

Find the line that reads ‘GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”‘ and change it to read

‘GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nouveau.modeset=0 tpm_tis.interrupts=0 acpi_osi=Linux i915.preliminary_hw_support=1 idle=nomwait”‘

Ignore this step if touchpad is working else add i8042.reset to read:

‘GRUB_CMDLINE_LINUX_DEFAULT=”i8042.reset quiet splash nouveau.modeset=0 tpm_tis.interrupts=0 acpi_osi=Linux i915.preliminary_hw_support=1 idle=nomwait”‘

Save the changes then exit gedit.

In your terminal run the command: update-grub

Reboot your computer: reboot.

The PC may hang at this point which means the OS doesn’t support restart with dual boot.
Force switch off the PC from power button and on next boot again follow same steps after the F10 step till the reboot step but add acpi=force in quite splash editing window step to read:

‘GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nouveau.modeset=0 tpm_tis.interrupts=0 acpi_osi=Linux i915.preliminary_hw_support=1 idle=nomwait acpi=force”‘

Now you are all set to exploit with your Kali Linux!!!

Ubuntu:

When the grub boot loader menu is visible highlight

“Try Ubuntu GNOME without installing” (use your up and down arrows keys)

Press “e” on your keyboard, this will allow you to edit the boot config. You will be brought to a page where you can make some edits.

add the following right after the word “splash”

nouveau.modeset=0 tpm_tis.interrupts=0 acpi_osi=Linux i915.preliminary_hw_support=1 idle=nomwait

Press the “F10” key to boot into the installer

When the desktop load move your mouse into the upper left hand corner, when the app launcher shows itself click on the very top icon “Install Ubuntu GNOME XX.XX LTS”

Do not install third party software.

Then follow the steps to install Ubuntu.If you don’t know normal installation then refer to the installation section of this link for normal installation.

After installation click “Keep trying Ubuntu”

Shut down (NOT RESTART) your computer, remove installation media, hit enter.

Hold down shift then press the power button to turn on your computer. (holding down shift while powering on will load the grub boot menu)

When the grub boot menu appears press “e” and make the changes in step 3.

Press “F10”

Once your back into the desktop open your terminal. Press Ctrl+Alt+T if touch pad is not working and enter:

sudo gedit /etc/default/grub

Find the line that reads ‘GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”‘ and change it to read

‘GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nouveau.modeset=0 tpm_tis.interrupts=0 acpi_osi=Linux i915.preliminary_hw_support=1 idle=nomwait”‘

Ignore this step if touchpad is working else add i8042.reset to read:

‘GRUB_CMDLINE_LINUX_DEFAULT=”i8042.reset quiet splash nouveau.modeset=0 tpm_tis.interrupts=0 acpi_osi=Linux i915.preliminary_hw_support=1 idle=nomwait”‘

Save the changes then exit gedit.

In your terminal run the command: sudo update-grub

Reboot your computer: sudo reboot.

The PC may hang at this point which means the OS doesn’t support restart with dual boot.
Force switch off the PC from power button and on next boot again follow same steps after the F10 step till the reboot step but add acpi=force in quite splash editing window step to read:

‘GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nouveau.modeset=0 tpm_tis.interrupts=0 acpi_osi=Linux i915.preliminary_hw_support=1 idle=nomwait acpi=force”‘

Now enjoy your installed UBUNTU GNOME!!!

FINALLY LETS INSTALL NVIDEA:

You should install nvidea else your laptop will drain out too often and will overheat easily. For that you have to disable noveau…Follow the steps below and enjoy:

Kali:

Connect to network Run these commands-

apt-get update
apt-get upgrade
apt-get dist-upgrade

This may take few minutes to download and install updates. After that follow the steps below to install Nvidia drivers-
You’ll need to make sure you have the kernel headers for your currently active kernel, in order to build the NVIDIA driver kernel modules type. Open up your terminal

apt install linux-headers-$(uname -r)

Now to disable nouveau

echo -e "blacklist nouveau\noptions nouveau modeset=0\nalias nouveau off" > /etc/modprobe.d/blacklist-nouveau.conf
update-initramfs -u && reboot

System shall reboot and nouveau should be disabled.
Now again open up the termnial and verify if nouveau is disabled

lsmod |grep -i nouveau

If it shows nothing,means nouveau is successfully disabled.
Now, we will install nvidia driver from kali repository-

apt-get install nvidia-driver nvidia-xconfig

Now we have to find bus id of our nvidia card:

nvidia-xconfig — query-gpu-info | grep ‘BusID : ‘ | cut -d ‘ ‘ -f6

It will output something like “ ROG GL503GE result: PCI:1:0:0”…Then PCI:1:0:0 will be our Bus ID

Now we generate /etc/X11/xorg.conf file with this bus ID( Change your Bus ID according to your case in the text)

Section “ServerLayout”
Identifier “layout”
Screen 0 “nvidia”
Inactive “intel”
EndSection
Section “Device”
Identifier “nvidia”
Driver “nvidia”
BusID “PCI:1:0:0”
EndSection
Section “Screen”
Identifier “nvidia”
Device “nvidia”
Option “AllowEmptyInitialConfiguration”
EndSection
Section “Device”
Identifier “intel”
Driver “modesetting”
EndSection
Section “Screen”
Identifier “intel”
Device “intel”
EndSection

Remember to change the BusID above to your own BusID and save it to /etc/X11/xorg.conf
Now we have to create some scripts according to our display manager .Since im using default Kali linux which is GDM, i created two files-

/usr/share/gdm/greeter/autostart/optimus.desktop
/etc/xdg/autostart/optimus.desktop

Add the following content to the above two files-

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c “xrandr — setprovideroutputsource modesetting NVIDIA-0; xrandr — auto”
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

After writing, save and exit.
Now reboot your machine. Now you be using nvidea drivers.
To check open up the terminal and type:

apt-get install mesa-utils
glxinfo | grep -i “direct rendering”

If the output is direct rendering: Yes then you are all set. Enjoy!!!

Ubuntu:

Switch off secure boot if it isn’t.
Connect to a network and open up your terminal.
Remove all Nvidia installs(if any), run this command:

sudo apt-get purge nvidia* & sudo apt autoremove & sudo apt auto-clean

Open the file sudo vim /etc/modprobe.d/blacklist.conf and add these lines at the end:

blacklist nouveau
blacklist vga16fb
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
blacklist amd76_edac
alias nouveau off
alias lbm-nouveau off
options nouveau modeset=0

Add the PPA graphic drivers:

sudo add-apt-repository ppa:graphics-drivers/ppa

Check recommended drivers and autoInstall recommended drivers

 ubuntu-drivers devices
sudo ubuntu-drivers autoinstall

If secure boot is not switched off, while installing it asks for a password, enter and remember it. Shutdown the PC (DONT RESTART).

Verify Nvidia installation and use “nvidia-X-server” from applications or following command to select profile for next boot

nvidia-smi
sudo prime-select nvidia

Now it’s all set!!!

Thank you for reading out my article. Hope that helped you out . Also please feel free to suggest edits and comment anything if you are stuck.

About Me: I am a cyber-security enthusiast here at IIIT-Allahabad. Listening to good songs and helping people is what makes my day :)

--

--

Ayush Raj
Nybles
Writer for

Cybersecurity Enthusiast and Android Developer…Following up the technical trends!