Skip to content

Instantly share code, notes, and snippets.

@vijay-prema
Last active April 26, 2024 20:37
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

@armsp
Copy link

armsp commented Aug 15, 2022

Hi Vijay, I am trying to install the asusctl-gex gnome extension version 3.7.2 like you mentioned, but I get the error that the extension is incompatible with the current GNOME version (my current GNOME version is 42.2).
I am using the latest Ubuntu 22.04.1 LTS on an Asus Zephyrus G15 (2022 model with 6800HS) and I updated my kernel to Xanmod (5.18.17)
Any suggestions on how to get it working.
I really want to turn off the keyboard backlight and have other controls provided by asusctl

@vijay-prema
Copy link
Author

I havent updated this doc in a while, but I have been using 2204 since it came out, and at that point I just stopped using asusctl-gex as the devs don't really support Ubuntu. Instead I just use the asusctl command line tool (version 4.0.7+) and just roll my own Gnome extension using Argos, which you can find here: https://github.com/vijay-prema/asusctl-argos

@l6l6
Copy link

l6l6 commented Sep 5, 2022

Hello. I followed this tutorial but now my laptop can not find the battery anymore. Is there a driver Im missing?

@vijay-prema
Copy link
Author

Hello. I followed this tutorial but now my laptop can not find the battery anymore. Is there a driver Im missing?

Not sure but I would try using the latest kernel version (e.g. Xanmod latest). Parts of this gist might be outdated now.

@hapugov
Copy link

hapugov commented Sep 22, 2022

Hello everyone, I ran into a problem with the operation of input devices on the Asus ROG G14 2021 laptop. Ubuntu 22.04 desktop is installed, it is installed at the end of the disk, and Windows is installed at the beginning. And in general, in Ubuntu, I observe constant brakes, friezes and dulling of the system, although if you boot from Windows, everything works just fine. It's like that for everyone
or is it just me?

@angelsv
Copy link

angelsv commented Nov 6, 2022

hi, some one update the asus zephirus G14 with the latest ubuntu 22.04.1 LTS or 22.10? what happend with all the drivers and the GPU fan performance (drains the battery), top leds screen doesn power off totally..

@vijay-prema
Copy link
Author

hi, some one update the asus zephirus G14 with the latest ubuntu 22.04.1 LTS or 22.10? what happend with all the drivers and the GPU fan performance (drains the battery), top leds screen doesn power off totally..

Im running 2204. Works fine but I had to update the kernel for things to work best. I updated to xanmod kernel stable 6.0. Everything works fine out of the box and to save power (and decrease fan noise etc) just change to Power Saver in Power Settings. There is a new shortcut in the system menu in the top right corner (with the volume control, wifi etc).

@benbaarber
Copy link

I have tried installing the latest xanmod kernel, but when I try to boot, grub gives me a "bad shim signature" error followed by a "you need to load the kernel first" message. Any idea what's up with that?

@vijay-prema
Copy link
Author

I have tried installing the latest xanmod kernel, but when I try to boot, grub gives me a "bad shim signature" error followed by a "you need to load the kernel first" message. Any idea what's up with that?

Did you disable secureboot in your system bios? You can also change the kernel back to the standard Ubuntu kernel in the grub boot settings if required. The standard Ubuntu kernel is signed so it works with safeboot. Xanmod is not, though you can technically sign any kernel yourself, I found the hassle wasnt worth it so just disabled secure boot instead. If you have Windows dual boot with bitlocker just make sure you have the recovery codes handy before doing it.

@dievops
Copy link

dievops commented Dec 7, 2022

Thanks for this guide :) I recommend to change the wifi card. Get an Intel Ax210 and use ubuntu for dual-boot. I'm using this laptop daily at work without issues working in developer area.

@waffle-frame
Copy link

Hello @vijay-prema!
Thanks a lot for the instructions.

I'd like to add a few lines to the software installation, as I personally ran into a number of issues when building on Ubuntu 22.04 Jelly Fish. (perhaps this is due to the fact that I installed the OS with minimal settings, I can’t say for sure)

First, let's install the utilities we'll be working with:

$ sudo apt-get install build-essential make cmake git curl clang libudev-dev libudev-dev libgtk-3-dev

The second step is to install the Rustlang:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Next:

$ source "$HOME/.cargo/env"

We clone the repository and go to it:

$ git clone https://gitlab.com/asus-linux/asusctl.git
$ cd asusctl

And finally the build:

$ make
$ sudo make install

Please take this into account, perhaps it will help many people.
If you have any suggestions, I'm ready to listen. Thank you!

@vijay-prema
Copy link
Author

vijay-prema commented Jan 9, 2023

@waffle-frame Good point, thanks for this. I think I already had rust setup previously so I didn't need to do much. I put a link to your comment in the doc in case people need help with it.

@antoniofranky
Copy link

I dont use it on battery that much but I do get about 8h doing light work on Ubuntu, with CPU on silent, GPU suspended (but not disabled), temps about 40C idle in my summer

I build it using your guide yesterday on Ubuntu 22.04 and now everything works perfectly. Thanks! How do you get these temps? How do I put my CPU on silent and suspend my GPU?

@andrewigk
Copy link

Hey guys, installed asusctl on my 2021 G14, but annoyingly it doesn't seem like the daemon is running when I first boot up the machine. I have to enter 'systemctl start asusd' in the terminal before I'm able to actually use the GUI or any of the commands in the terminal. In addition, it doesn't seem like my settings I've set (charge limit, for example) are saving and staying persistent through reboots. Anyone know how to fix this? Thanks in advance.

@Yurko-Fedoriv
Copy link

I'd like to share my finding regarding enabling S3 sleep on g14
https://www.reddit.com/r/ZephyrusG14/comments/xrkr8u/enable_s3_sleepdisable_modern_standby/

Now my laptop can actually be used in portable mode, without heating and draining the battery in a few hours while in [s2idle] (which is the only option available by default).

For me, after applying the instructions from the link, [deep] sleep became available and default.

This also seems to have fixed random/occasional issue with the screen not waking up after the sleep when on Integrated-only graphics.

Makes me quite happy, hope it helps someone else.

@vijay-prema
Copy link
Author

Hey guys, installed asusctl on my 2021 G14, but annoyingly it doesn't seem like the daemon is running when I first boot up the machine. I have to enter 'systemctl start asusd' in the terminal before I'm able to actually use the GUI or any of the commands in the terminal. In addition, it doesn't seem like my settings I've set (charge limit, for example) are saving and staying persistent through reboots. Anyone know how to fix this? Thanks in advance.

Try enable it as a service then reboot sudo systemctl enable asusd

@andrewigk
Copy link

Hey guys, installed asusctl on my 2021 G14, but annoyingly it doesn't seem like the daemon is running when I first boot up the machine. I have to enter 'systemctl start asusd' in the terminal before I'm able to actually use the GUI or any of the commands in the terminal. In addition, it doesn't seem like my settings I've set (charge limit, for example) are saving and staying persistent through reboots. Anyone know how to fix this? Thanks in advance.

Try enable it as a service then reboot sudo systemctl enable asusd

I tried this, but terminal returned this:

"glutes@GLUTES-VirtualBox:~$ sudo systemctl enable asusd
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.

Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
instance name specified."

@holloway
Copy link

I have the exact same issue as @glutes83

@vijay-prema
Copy link
Author

I have the exact same issue as @glutes83

Which kernel version are you using? (check using uname -a) I have kernel 6.1 from Xanmod. I think older kernel like 5.15 might have issues

@meowmeoe
Copy link

Has anybody been able to make sure the dgpu is disabled? I have the R9 6900 + RX 6700 2022 G14 and I'm getting about 9-11 W of power draw at idle and I suspect it may be the dgpu.

@rasmusravn
Copy link

rasmusravn commented Mar 5, 2023

Thank you so much for this!
It helped with some of my current issues, but also got me up to speed on some of the nice to now linux stuff as a newly migrated windows user. I will definitely check out your linux guide for windows power users!

@dievops
Copy link

dievops commented Jun 14, 2023

Update:

Ubuntu 23 works better thatn 22, big hardware support, everything works for me just installed and ready to go.

@vijay-prema
Copy link
Author

Update:

Ubuntu 23 works better thatn 22, big hardware support, everything works for me just installed and ready to go.

Thanks for the info, that is great to hear.

@tomyummmm
Copy link

Just to update, Ubuntu 22.04 linux-generic-hwe-22.04 is now Linux Kernel 6.2.0 by default. There is no need to install a separate kernel, and sleep / suspend works fine.

❯ apt search linux-image-generic-hwe-22.04
Sorting... Done
Full Text Search... Done
linux-image-generic-hwe-22.04/jammy-updates,jammy-security,now 6.2.0.26.26~22.04.7 amd64 [installed,automatic]
  Generic Linux kernel image

❯ uname -a
Linux ROG-Zephyrus-G15 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

In other news, I have email-ed ASUS so many times, they finally agreed to fix the BIOS for the 2021 Zephyrus G15 secondary NVME suspend patch and will release it in 1-2 months. So this should also fix sleep issues for Windows as well.

Upon further checking with the relevant department, they have confirmed that your request will be addressed in the upcoming BIOS version, estimated to be Version 416.

Therefore, kindly be informed that before the release of the BIOS, it requires thorough verification and testing, which will span over a month's duration. ASUS is committed to promptly conducting the necessary BIOS update.

However, this process is expected to take approximately 1 to 2 months. We would like to reassure you that ASUS is positively engaged in resolving this matter.

Original issue from the ASUS-Linux FAQ

2021 G15 secondary NVMe suspend patch

If you have a 2021 G15 and use a second NVMe drive you might experience a problem while using s0ix (s2idle) resulting in a delayed system suspend.

The problem lies within a faulty DSDT table and the secondary NVMe drive does not enter suspend properly.

With an updated DSDT table you can apply the necessary patches to make it suspend properly.

https://gitlab.com/smbruce/GA503QR-StorageD3Enable-DSDT-Patch

Important: This is not necessary if you want to use S3 (see above). It applies only if you want to further use the standard suspend method s0ix.

Fixed in kernels versions 6.1.x and up.

@yarfomin
Copy link

yarfomin commented Oct 5, 2023

Did you guys have problems with sound? The sound from the laptop speakers is terrible on Ubuntu, but it was pretty good on Windows

@EXJUSTICE
Copy link

EXJUSTICE commented Dec 4, 2023

Update:

Ubuntu 23 works better thatn 22, big hardware support, everything works for me just installed and ready to go.

@dievops If Ubuntu 23 works fine, what steps could you skip from the install guide?

@vijay-prema
Copy link
Author

vijay-prema commented Dec 4, 2023

Update:
Ubuntu 23 works better thatn 22, big hardware support, everything works for me just installed and ready to go.

@dievops If Ubuntu 23 works fine, what steps could you skip from the install guide?

Yes Ubuntu 23+ works fine out of the box as it has Kernel 6+ and Pipewire already installed by default.

So the only "Software Setup" step you need to do is Step 1, install Asusctl to enable control of laptop-specific features like fans, LEDs, power setting, charge limit, GPU mode etc. I would also suggest check Step 4, make sure latest proprietary NVIDIA driver installed and dkms.

@El-Richie
Copy link

Hello, how are you?
I have an Asus Zephyrus G14 2023 with ryzen 9 7000 series, a 4060 nvidia and 48 gb RAM and 2Tb NVME. My problem is that when I try to install ubuntu along with Windows 11 is not possible to install it because the screen goes crazy and does not let me see anything, it seems to freeze but there are parts where I can see how the mouse moves so it is not possible to install Ubuntu. I have tried with ubuntu 22.04, 23, Pop OS, Lubuntu, Linux Mint, Kubuntu, and others, some distros seem to work fine but after a while the problems with the screen return. It is worth mentioning that with windows 11 the screen goes very well and does not give me those screen problems. I have searched the internet for solutions, I have tried them all and they don't seem to work, has anyone had this problem with the same model? I like the computer and I do not want to change it, it is not so urgent to install ubuntu but at some point I will need it and running it in virtual machine is not an option because I need the use of the GPU to run some programs. Please help this soul in pain. Thanks in advance.

@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.

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