Skip to content

Instantly share code, notes, and snippets.

@vijay-prema
Last active November 2, 2024 16:32
Show Gist options
  • Save vijay-prema/cfcf8cc4085663b7bb48f34172c10629 to your computer and use it in GitHub Desktop.
Save vijay-prema/cfcf8cc4085663b7bb48f34172c10629 to your computer and use it in GitHub Desktop.
Ubuntu on Asus ROG Zephyrus G14 2021

Ubuntu on Asus ROG Zephyrus G14 2021 (Setup guide)

Here is a way to do a robust install of Ubuntu (+ optional Windows 11 dual boot and LUKS encryption) on an Asus laptop, with minimal usable hardware support, without a significant amount of tinkering that may break in future or require frequent technical attention.

In summary, the key thing is to have an up to date kernel, which usually means disabling secure-boot and installing the latest stable (6.0+) using mainline or xanmod, and as well as making sure the latest nvidia driver and dkms is installed.

Specs:

  • Model Asus G14 2021 (GA401QC)
  • AMD R7 5800 8 core 16 thread (onboard Radeon graphics)
  • NVIDIA RTX 3050 4GB (60W +15W boost)
  • 40GB RAM (8GB soldered + 32GB stick added)
  • 2TB SSD
  • 14inch 1920x1080 Display @144Hz
  • Mediatek Wifi 6 card Intel AX210 Wifi 6 card (Replaced built-in Mediatek card)

OS Install:

  • Recommend disable secure boot (in BIOS) if you dont care about secure boot and would rather have freedom to install any unsigned kernel in future (recommended if you want unsigned Kernel 6.0+ with all the features working).
  • Optionally dual boot: first install Windows 11 or 10 (you may need a USB ethernet/wifi dongle during install as Windows 11 may not have the wifi driver) from the prepared USB stick (turn off bitlocker for now), and resize its partition to say 1/4 the disk or so
  1. Get Ubuntu 22.04 ISO burned onto a USB stick (e.g. using Balena Etcher). Could also use Kubuntu or other flavours.
  2. Boot into the USB stick (repeatedly tap ESC during power on)
  3. Its best to make sure you have an internet connection during install. If the built in wifi is not detected, get a USB wifi/ethernet dongle.
  4. Start Ubuntu installer, I prefer minimal bloat install, and install all 3rd party/proprietary software.
  5. If you want full disk encryption (LUKS), choose "something else" for partitions, and make a 1GB EXT4 partition mounted as /boot and the rest of the drive a container for encryption, then mount the contained EXT4 as /. DONT forget your encryption password!
  6. Finish installation of Ubuntu and reboot.

Software Setup:

  1. Install asusctl v4.0+. The Ubuntu repository has been deleted, so you can just manually build and install it (including rust/cargo) from source using these commands (if it doesnt work for you, try more detailed instruction.):
    git clone https://gitlab.com/asus-linux/asusctl.git
    cd asusctl
    apt install libclang-dev libudev-dev
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    make
    sudo make install
  1. OPTIONALLY Install GUI application asusctl-gex gnome extension. Update Dec 2022: it seems this app is no longer updated and not recommended. Instead the latest asusctl already comes with a GUI called ROG Control Center, find it in your apps menu after intall, or run rog-control-center in terminal
  2. Install an up to date pipewire version and bluetooth audio support
sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream
sudo apt install pipewire
sudo apt install libspa-0.2-bluetooth
  1. Make sure recommended Ubuntu NVIDIA driver is installed (use "Additional Drivers" tool). Install nvidia-dkms as well which will enable the driver for 3rd party kernels (such as what I recommend in step 5 next) you might install in future sudo apt install nvidia-dkms-525 (replace 525 with whatever NVIDIA driver version you have installed). Note: there is a partially open source "Open Kernel" version of the NVIDIA driver, I currently don't recommend this as it seems to have issues.
  2. Optional but HIGHLY recommended, disable secure-boot in your BIOS, then install Kernel 6.1 or higher for Suspend and latest hardware support. An easy way is to install Xanmod Kernel 6.1 LTS, or alternatively use the Mainline tool. Note that sometimes installing a very new kernel will result in NVIDIA driver not working, in this case, downgrade to previous. If you use a LTS kernel you likely wont have this issue.
  3. Reboot
  4. Enable the asusctl-gex extension in "Gnome Extensions" tool

Quirks:

  • Errors while updating PPAs: you may need to switch some repos distro branch from jammy to impish (or even hirsute if there is no impish) because jammy (Ubuntu 22.04) is too new. Do this in the "Software & Updates" app under the Other Software tab. At some point most of these PPAs will catch up and you can change it back to impish.
  • Wayland: The default login session for Ubuntu 22.04 is Wayland (rather than Xorg). It provides a smoother and more secure experience but has compatibility issues with some software (e.g. blank screen sharing in Discord):
    • To run an application with NVIDIA GPU in Wayland, you should right click on its icon and choose "Launch using Dedicated Graphics Card", for example Steam games (For Xorg graphics switching, just use the "Nvidia X Server" tool). Use nvtop (suggest installing latest ppa version) to check what apps are using NVIDIA, or radeontop to check if AMD graphics is being used (although the latest nvtop version shows both nvidia and integrated radeon stats).
    • Worst case you can still log in as Xorg by clicking on the gear button bottom right before you press enter to login. Personally I am sticking to xorg for now.
  • Keyboard LEDs flashing during sleep mode: to stop them type asusctl led-mode -s false
  • Built in microphone can be very noisy unless you turn its volume down to about 15%. If it still doesnt work at all or always shows as "unplugged" then try this strange hack.
  • Mute Microphone key. There is a simple hack to get this to work.
  • Battery maintenance: You can keep the battery in better condition when you use the laptop mostly plugged in, by only charging to 60%: asusctl -c 60.
  • Disable boot up sound effect - this can be disabled in the bios (tap ESC during power on) or run: asusctl bios -p false
  • Improve power efficiency of NVIDIA card: sudo sh -c 'echo \'options nvidia "NVreg_DynamicPowerManagement=0x02"\' > /etc/modprobe.d/nvidia.conf' Then reboot.
  • Firefox high CPU usage especially when playing youtube videos (e.g. 4k 60p video): Enable video acceleration.
    • sudo apt install mesa-va-drivers
    • Open Firefox and go to about:config in url bar. Then search for following keys, enable or disable them one by one:
      • media.ffmpeg.vaapi.enabled set to true
      • media.ffvpx.enabled set to false.
      • media.rdd-vpx.enabled set to false.
      • media.rdd-process.enabled set to false.
      • media.navigator.mediadatadecoder_vpx_enabled set to true.
      • If you experience page crashes, try setting security.sandbox.content.level to 0.
  • Google Chrome high CPU usage especially when playing youtube videos (e.g. 4k 60p video): Enable video acceleration (update: link possibly out of date for latest Chrome). Suggest also enabling these flags in the chrome://flags page:
    • #ignore-gpu-blocklist
    • #enable-gpu-rasterization
    • #enable-zero-copy
    • #canvas-oop-rasterization
    • Also try running with google-chrome --enable-unsafe-webgpu --enable-features=Vulkan,UseSkiaRenderer. You can check gpu status by going to chrome://gpu/ in the browser.
  • Suspend/sleep In kernels older than 5.15 this has unpredictable behaviour (sometimes it might just work, other times it appears to work but fails to resume). To fix that, I HIGHLY recommend upgrading to kernel 6.1 or higher. An easy way is to install Xanmod Kernel 6.1 LTS (also remember to install nvidia-dkms-* as mentioned earlier, to enable NVIDIA GPU for non-Ubuntu kernels).
  • Hibernate To enable Hibernate (i.e. Suspend to Disk), first make sure swap file at least as large as RAM (e.g. I used 50GB for my 40GB RAM bs=1G count=50) and then enable hibernate.

Non-functioning and Semi-issues:

  • Fingerprint reader. There are people working on this and making progress but it is very rudamentary. The real issue is even if they get it woring perfectly, this device cant work with multiple OS on the same system with dual boot, as each OS will try to install its own keys on the device causing conflict.
  • Mediatek Wifi/BT Update Dec 2022: apparently with the latest kernels (6.0+) these types of issues are gone. The 2021 model comes with a Mediatek wifi chip which sucks (dropouts and crashes requiring fully powering off the device for minutes), even in Windows 11, and the Bluetooth doesn't work in Linux. Replace it with an Intel AX200 or AX210. If after replacing it with Intel AX your wifi device disappears from Linux at some point, try a hard power off and reboot into Linux (by holding power button until shut down, while on battery).

Future...

There are some guys at Asus Linux doing some great work to improve Linux support on these exceptional laptops. They work primarily on Arch so they often do not recommended to install their latest work on a production Ubuntu system which may have older packages, and may not be able to help you. Personally I found it works fine with the Ubuntu 2204+ and kernel 6.0+. You can join the Asus Linux Discord to be involved or to seek help if you need it.

Guide to Desktop Linux for Windows Power Users

This is a big guide I wrote, which started off as a bunch of notes that I wrote for myself, and I decided to publish it publically. It may not always be up to date but it stands as a great reference for advanced Windows users who want to ditch the increasingly toxic Windows world, dont want to live in an expensive walled-garden, and who dont really care too much about AAA gaming. https://linuxguide.techoneer.com/

Links

@Yurko-Fedoriv
Copy link

Yurko-Fedoriv commented Mar 11, 2024

@El-Richie hello.
there should be an option to boot linux installer in a safe graphics mode.
That one has a good chance to work for you.

After the installation and probably nvidia driver in the mix you likely will get it running fine.

Please note, that it is from a general linux installation experience, not from your particular model.

@vijay-prema
Copy link
Author

vijay-prema commented Mar 11, 2024

@El-Richie I'm not certain but this could be the common problem happening with all Nvidia drivers on Linux for decades. Basically as suggested, boot in safe-graphics then try switching to the latest proprietary driver using Software & Updates tool:
image

Note: DO NOT use nouveau, "server", nor "open kernel" versions unless you know what you are doing.

@vanisyd
Copy link

vanisyd commented Apr 28, 2024

If someone will have issues with running command make these commands could be helpful
sudo apt install libinput-dev
sudo apt install libgbm-dev

@XavDesbordes
Copy link

Same issue as Cyerii here

@CiprianStoicescu
Copy link

Hello!
Has anyone tested ubuntu 24.04 ? How does it work on an ROG Zephyrus G14 GA401IHR_GA401IHR laptop? But especially in Dual Boot with Windows 11? Thanks!

@vijay-prema
Copy link
Author

Hello! Has anyone tested ubuntu 24.04 ? How does it work on an ROG Zephyrus G14 GA401IHR_GA401IHR laptop? But especially in Dual Boot with Windows 11? Thanks!

Yes I updated mine from 2204 to 2310 and then to 2404. I upgraded in-place with Linux full disk encryption, Windows11 dual boot (bitlocker) on same SSD. No issues, other than needing to delete and reinstall a few things that broke like gnome extensions and dkms drivers (nvidia, virtualbox, droidcam etc). I suspect everything basically works out of the box with a clean install of 2404, just install asusctl to get controls for all the specific asus features. Also I still keep secureboot turned off in BIOS, but I heard it works fine turned on with 2404 and official Kernel.

@CiprianStoicescu
Copy link

Hello! Has anyone tested ubuntu 24.04 ? How does it work on an ROG Zephyrus G14 GA401IHR_GA401IHR laptop? But especially in Dual Boot with Windows 11? Thanks!

Yes I updated mine from 2204 to 2310 and then to 2404. I upgraded in-place with Linux full disk encryption, Windows11 dual boot (bitlocker) on same SSD. No issues, other than needing to delete and reinstall a few things that broke like gnome extensions and dkms drivers (nvidia, virtualbox, droidcam etc). I suspect everything basically works out of the box with a clean install of 2404, just install asusctl to get controls for all the specific asus features. Also I still keep secureboot turned off in BIOS, but I heard it works fine turned on with 2404 and official Kernel.

Thanks!
Do you use Wayland or Xorg?
I've tested so far Ubuntu 24.04 in VirtualBox, on Wayland everything runs smoothly, fast, no problems.
But on Xorg, in WM, I have a infernal lag, everything moves very slowly.
I need to use remote desktop applications, like Anydesk or Rustdesk, which unfortunately don't work on Wayland :(

@vijay-prema
Copy link
Author

Thanks! Do you use Wayland or Xorg? I've tested so far Ubuntu 24.04 in VirtualBox, on Wayland everything runs smoothly, fast, no problems. But on Xorg, in WM, I have a infernal lag, everything moves very slowly. I need to use remote desktop applications, like Anydesk or Rustdesk, which unfortunately don't work on Wayland :(

I always use xorg. I usually give wayland a shot after upgrades to see if it improved, but honestly didn't even bother trying this time. xorg is smooth for me, on a 4k monitor. I only run Ubuntu natively, not in a VM so I'm not sure whats the issue sorry.

@s0m31unkn0wn
Copy link

s0m31unkn0wn commented Oct 18, 2024

I have G14 GA402RK (2022, Ryzen 9 6900HS + Radeon 6800 8gb, similar 40 gb ram). press f2 to get into asus bios utility, but in the utility the drive with the iso (of kali, but not the point here) is not recognized, bios only sees the in-built ssd with windows, or the recovery windows on external ssd if that one is connected. Bios sees the drive itself as plugged in but doesn't offer an option to boot from it. Suggestions? Goal is to have dual boot, windows partition has been resized to give 85gb unallocated (i don't think i'll need more for coding). Used rufus 4.5.2180 to burn a 2023.3 kali iso of 3.9 GB onto a fat32 8gb drive in DD mode, GPT partition scheme (mbr is default but doesn't work on new systems - learned that when reinstalling windows in september 2023). No bitlocker, not a pro windows. Fast boot disabled. Secure boot is active and not changeable ("secure boot control" i set to disabled).

@s0m31unkn0wn
Copy link

I have G14 GA402RK (2022, Ryzen 9 6900HS + Radeon 6800 8gb, similar 40 gb ram). press f2 to get into asus bios utility, but in the utility the drive with the iso (of kali, but not the point here) is not recognized, bios only sees the in-built ssd with windows, or the recovery windows on external ssd if that one is connected. Bios sees the drive itself as plugged in but doesn't offer an option to boot from it. Suggestions? Goal is to have dual boot, windows partition has been resized to give 85gb unallocated (i don't think i'll need more for coding). Used rufus 4.5.2180 to burn a 2023.3 kali iso of 3.9 GB onto a fat32 8gb drive in DD mode, GPT partition scheme (mbr is default but doesn't work on new systems - learned that when reinstalling windows in september 2023). No bitlocker, not a pro windows. Fast boot disabled. Secure boot is active and not changeable ("secure boot control" i set to disabled).

Ok so the solution ended up being tricking the sensor on usb ports. It only starts reading when you put in the drive , not when the drive's already in when entering bios. And Ventoy rules, i can "just copy" iso, and it overcomes 4gb size limit because it uses exfat on the "larger" partition, so i can just install 2024.3 straight away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment