Skip to content

Instantly share code, notes, and snippets.

@FrankieWOO
Forked from vijay-prema/ubuntu-on-asus-g14.md
Last active March 1, 2024 17:50
Show Gist options
  • Save FrankieWOO/62e5cd45857eadb09d1345f9c8da017c to your computer and use it in GitHub Desktop.
Save FrankieWOO/62e5cd45857eadb09d1345f9c8da017c 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.

Specs:

  • AMD R9 5900HS 8 core 16 thread (onboard Radeon graphics)
  • NVIDIA RTX 3060
  • 40GB RAM (8GB soldered + 32GB stick)
  • 2TB SSD
  • 14inch 1920x1080 Display @144Hz
  • Original: Mediatek Wifi 6 card. I changed it to intel AX200NGW

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 5.15+ 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 20.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. With lastest 20.04 kernel version 5.13, the mediatek WiFi can be recognised and used during installation.
  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 v3.7.2 (4.0+ version doesnt work without kernel patches and other dependencies which are hard to install on Ubuntu currently). The Ubuntu repository has been deleted so dont follow those instructions, you can just manually install it from source (requires Rust to be installed) instead and then reboot:
    sudo apt install libclang-dev libudev-dev
    git clone -b 3.7.2 https://gitlab.com/asus-linux/asusctl.git
    cd asusctl
    make
    sudo make install
  1. Install asusctl-gex gnome extension using the 3.7.2 package OR my fork which adds a battery charge limit slider 3.7.3 package (Again, 4.0+ version doesnt work without kernel patches)
  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). I would HIGHLY recommend installing 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-470 (replace 470 with whatever NVIDIA driver version you have installed)
  2. Optional but HIGHLY recommended, install Kernel 5.15 or higher for Suspend and latest hardware support. An easy way is to install Xanmod Kernel 5.15, or alternatively use the Mainline tool
  3. Reboot
  4. Enable the asusctl-gex extension in "Gnome Extensions" tool
  5. setup close lid actions. Open the /etc/systemd/logind.conf file in a text editor as root, change #HandleLidSwitch=suspend to HandleLidSwitch=suspend. Same applies to HandleLidSwitchExternalPower and HandleLidSwitchDocked=suspend. Then reboot

Quirks:

  • Errors while updating PPAs: you may need to switch some repos distro branch from impish to hirsute (or even focal if there is no hirsute) because impish (Ubuntu 21.10) 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 21.10 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 to check what apps are using NVIDIA, or radeontop to check if AMD graphics is being used.
    • Worst case you can still log in as Xorg by clicking on the gear button bottom right before you press enter to login.
  • Power/fans: The fan profiles on the current version are not great but are being worked in in future versions. For now I run mainly on "silent" profile in asusctl, which just disables turbo.
  • 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 10-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 acting strange (no WebGL, drag and drop issues, Gnome extensions connection fail): Probably the Snap version got installed. Run: snap remove firefox and sudo apt install firefox. In general avoid installing applications via Snap, instead firstly try, in this order of preference:
    • Ubuntu repositories (unless outdated, run apt-cache show [package] to check available version)
    • A trusted PPA
    • Flatpak (flathub)
    • Home brew
    • deb file (if issues with flatpak version)
  • 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.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. Suggest also enabling these flags in the chrome://flags page:
    • #ignore-gpu-blocklist
    • #enable-gpu-rasterization
    • #enable-zero-copy
    • #enable-vulkan (warning buggy, disable again if issues)
    • #canvas-oop-rasterization
  • 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 5.15. An easy way is to install Xanmod Kernel 5.15 Edge (also run sudo apt install nvidia-dkms-470 to enable NVIDIA GPU for non-Ubuntu kernels). You might also want to disable keyboard LED pulse during sleep asusctl led-mode -s false
  • 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 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. 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). You can also check for errors in Intel wifi using sudo dmesg | grep iwl.

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 it not recommended to install their latest work on a production Ubuntu system which has older packages. In future, we may see these features supported in Ubuntu with future kernel updates, and asusctl-gex will provide additional functionality. You can join their Discord to be involved.

Links

@amicalmant
Copy link

Hi Frankie! Nine months have passed since your latest update of this page. I wonder if the current kernel is now compatible with asusctl 4.0+. Have you tested it? Do you plan to maintain this page and update it soon?
I'm asking this because I run Linux Mint 21.3 which is based on Ubuntu LTE 22.04.3 with the latest supported kernel 5.15.0-97.
Thanks for your work and knowledge sharing! :-)

@FrankieWOO
Copy link
Author

FrankieWOO commented Mar 1, 2024

Hi @amicalmant , thank you for asking. I haven't updated this since I switched to Garuda (a Arch-based distro) on this laptop.

I think it should be compatible with kernel 5.15, when I forked this from the original author, what I did differently was I installed different Ubuntu version and tried 5.15-stabe, while the original author at that time wrote 5.15-edge. Other different things was I changed different WiFi card and set up close lid behaviour.

Now if you check the original gist post (please check where I forked from), the content seems to be updated and it mentions asusctl 4.0+.

PS: on my Garuda linux my asusctl is v5.0.7 with kernel 6.7.5-zen now.

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