Skip to content

Instantly share code, notes, and snippets.

@Raltar
Created May 6, 2023 02:13
Show Gist options
  • Save Raltar/586be522a0f3ddf2a52c5ba71533bdfc to your computer and use it in GitHub Desktop.
Save Raltar/586be522a0f3ddf2a52c5ba71533bdfc to your computer and use it in GitHub Desktop.
Ubuntu 22.04 on Asus ROG Zephyrus G14 (2023 Version)
Here are my notes on how to set up an Asus ROG Zephyrus G14 2023 edition (with Ryzen 7940HX and Nvidia 4060) with Ubuntu 22.04
Thanks and respect to Vijay Prema whose earlier guide to the 2021 version of this laptop would have saved me a lot of time if I'd read it earlier. It still contains great info and is the inspiration for this 2023 version.
https://gist.github.com/vijay-prema/cfcf8cc4085663b7bb48f34172c10629
Currently I have most everything functioning correctly EXCEPT:
- It doesn't seem to bring video back after waking up from suspend. Currently I have to hold down the button to force it to turn off then reboot any time it suspends, so for now I just disable automatic suspension.
- NVIDIA-Prime, the plugin that lets you select between Ryzen integrated and Nvidia discrete graphics works only from the command line and with a reboot. It does not show up in the Nvidia control panel, and when it's in dynamic mode, it always seems to activate the Nvidia discrete graphics. The command-line selection "intel" plus a reboot causes it to correctly use the AMD integrated graphics, and those are powerful enough for most things short of the more intensive games, or if you just need the highest framerates. I've found leaving it in AMD mode most of the time works well, and I can always force it over to Nvidia if I want to do more serious gaming. This is probably just a temporary artifact of doing the manual install of the latest Nvidia drivers instead of waiting for the supported release in Ubuntu. Once the Ubuntu-supported release catches up to supporting this hardware, that will be preferable. For now, the ubuntu-supported proprietary Nvidia packages make the GUI un-bootable.
- It has quiet and very tinny audio. Seems like the sound is only coming from the small tweeters at the top and not going to the larger down-facing speakers at the bottom. I haven't yet attempted to fix this, since audio output to my Thunderbolt 3 dock works just fine. I will eventually update this if I get it fixed.
- The Mediatek bluetooth wasn't working out of the box. (Though Wifi was.) I didn't bother to install the proper drivers for it because I was replacing it with an Intel AX210 anyway. The Intel card works perfectly with both Wifi and bluetooth
- I haven't yet set up the fancy linux Asus utilities. These are supported for Fedora and Arch, but not Ubuntu. I will eventually take a shot at getting them up and running if I have time. For now, all the temp and hardware sensors seem to work using Hardware Sensors Indicator.
- The GRUB bootloader menu doesn't work reliably. Sometimes it worked when graphics drivers were hosed, most of the time, including now that I've got everything else working, it doesn't. Not sure what the issue is here, but I suspect the Asus BIOS animation of having a role.
- Custom Asus shortcut keys and RGB controls I haven't attempted yet. May be included in a future edit/update.
For Reference, here's the exact hardware I'm using:
- Asus ROG Zephyrus G14 (2023) GA402XV
- AMD Ryzen R9 7940HS (Zen 4) with Radeon 780M Graphics (RDNA 3)
- NVIDIA RTX 4060
- 32GB DDR5 4800 RAM (16 GB soldered, 16 added. 4800 because that's what Asus had listed for the higher-spec models that came with more RAM. Not sure the CL on theirs, but mine is CL40 and seems to work well.)
- 2TB SK Hynix Platinum P41 PCIE Gen 4 SSD. (I don't plan to use Windows, so I am not dual-booting. I just replaced the stock WD Black SSD that came with the laptop without ever booting it.)
- Intel AX210 Wifi 6/BT 5.1 card. (Replaced the stock Mediatek. Wifi on the Mediatek worked out of the box with Ubuntu 22.04, but bluetooth didn't.
- 14 inch 2560x1600 Mini-LED screen. (Wonderful 16x10 aspect ratio. Not as good as a 4:3, but well suited to this laptop.)
Ubuntu 22.04 OS installation:
- Disable Secure Boot in BIOS. It doesn't like the USB boot, and you're going to need some of the newer kernels, which may be unsigned. Eventually you'll be able to turn this back on.
- Burn a Ubuntu 22.04 Desktop ISO (I used Ubuntu Unity 22.04) to a usb flash drive using startup disk creator, Mkusb, or whatever you like. I recommend using something that burns the ISO directly rather than a persistent USB, because otherwise you may run into issues with UEFI vs classic BIOS. The Zephryus only supports UEFI, no compatibility mode is available, so a UEFI-capable installer is mandatory.
- Install the OS as usual. The mediatek wifi adapter did show up for me, but I installed without connecting to the network because the installer sometimes hangs up on updates, and it's easy enough to install them once you're running from the SSD.
- I let it do automatic setup since I was using a completely blank SSD. If you want to Dual-boot, check settings accordingly. Automatic on a blank SSD gives you a gpt partition table with a 512 MiB EFI partition mounted to /boot/efi and the rest will be a single EXT4 partition.
- LUKS encryption is nice, but can hinder troubleshooting/recovery. Later, I'll link to instructions on how to encrypt the home directory structure the way Ubuntu used to do by default. It's not perfect by itself, but it's a helpful layer of security you can use.
- Reboot and load into the Ubuntu 22.04 graphical desktop environment of your choice. The integrated screen worked for me right away in Unity at its full native resolution. I wasn't able to change the resolution and desktop scaling didn't work. Also, extenal video was flaky at best. The updates in the next section adress that...
- Get yourself connected to the internet somehow...
Kernel and Driver updates:
- Open up a terminal window, and lock to launcher or bookmark or whatever so that you have easy access to it. Start with:
sudo apt update
sudo apt upgrade
- Install the Ubuntu Mainline kernel installer for access to much more recent Linux kernel builds:
sudo add-apt-repository ppa:cappelikan/ppa -y
sudo apt install mainline
- Once installed, open up the Mainline kernel installer GUI and have it install the latest mainline Kernel. At the time of this writing 6.3.1. The functionality referenced above will work with this version of the kernel.
- Reboot with the newer kernel.
- I've heard the Mediatek bluetooth might just work with this Kernel without any further intervention. Haven't tried it.
- Make sure that all the build requirements for gcc-12 are in place. In my setup, they were only partially there, and the system was set to use gcc-11 by default. This is a problem because the 6.3.1 kernel built itself in 12, and you really want to build all the drivers in the same version of gcc as the kernel. I fixed it using update-alternatives, making 12 the preferred option:
sudo apt install build-essential libglvnd-dev pkg-config gcc-12 cpp-12 g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11
sudo update-alternatives --install /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 11
sudo update-alternatives --install /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-11 11
sudo update-alternatives --install /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 11
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-11 11
sudo update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-11 11
sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-11 11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
sudo update-alternatives --install /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-12 12
sudo update-alternatives --install /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-12 12
sudo update-alternatives --install /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-12 12
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 12
sudo update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-12 12
sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 12
- sudo update-alternatives --config gcc should show
- Install the proprietary AMD Radeon drivers (possibly not necessary, but RDNA3 is bleeding edge at the time of writing)
- download from https://www.amd.com/en/support/linux-drivers
- go to the directory where you downloaded this and
sudo dpkg -i amdgpu-install_5.4.50403-1_all.deb
- Reboot
- Install Nvidia latest drivers:
- Here's a useful reference if you get stuck: https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-22-04 Scroll down to the section on manual installation. The ones that come from the Ubuntu repository don't work for this 4060 yet.
- download from https://www.nvidia.com/Download/index.aspx
- At time of writing, you'll get: NVIDIA-Linux-x86_64-525.116.03.run
- You'll need to close out of the X window system and drop to a full terminal (Make sure you have these instructions somewhere other than the machine you're working on!)
- Open a terminal and:
sudo telinit 3
- cd to the directory where you put the Nvidia driver .run file
- Run the installer
sudo bash NVIDIA-Linux-x86_64-525.116.03.run
- And reboot:
sudo shutdown -r now
- At this point, most all of the hardware should be working, with the caveats listed at the beginning.
Want to be able to manually switch which graphics you are using?
For some reason, Nvidia Prime switching utility wasn't installed with the latest manual driver version from their website. Maybe the script didn't see intel graphics and decided not to bother?
sudo apt install nvidia-prime
- Show which graphics is active:
sudo prime-select query
- change to use AMD integrated graphics:
sudo prime-select intel
(Nvidia didn't give an AMD option, but setting it to intel causes the kernel to use the AMD driver for integrated graphics as it should.)
- Change to use Nvidia:
sudo prime-select nvidia
- Theoretically auto-switching is enabled by:
sudo prime-select on-demand
but as far as I can tell it's always choosing nvidia in that mode. At least I haven't seen it choose AMD ever under idle conditions. May be because Nvidia chose to design this for Nvidia/Intel setups initially and this version of prime-select doesn't fully recognize the AMD integrated graphics that were previously less common.
- This is what it looks like with AMD graphics preferred:
sudo lspci -k | grep -A 2 -i "VGA"
pcilib: Error reading /sys/bus/pci/devices/0000:00:08.3/label: Operation not permitted
01:00.0 VGA compatible controller: NVIDIA Corporation Device 28e0 (rev a1)
Subsystem: ASUSTeK Computer Inc. Device 180d
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
--
65:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Device 15bf (rev c1)
Subsystem: ASUSTeK Computer Inc. Device 180d
Kernel driver in use: amdgpu
- Troubleshooting: After you reboot that final time, everything should come up using the Nvidia proprietary drivers. The Nvidia control panel should be available and should show the status of the card. System settings details should show the Nvidia card as well
- I had a lot of trouble with the Nvidia driver installation. I believe installing the 6.3.1 Linux kernel first, then installing the 525.116.03 driver from Nvidia was the fix.
- If you get in trouble, Ctrl-alt-F2 or whatever you have to do to get to a terminal and:
- sudo bash NVIDIA-Linux-x86_64-525.116.03.run --uninstall
- sudo sudo apt purge nvidia*
- sudo lshw -c video
- Under "configuration" look for "driver=" that will tell you if you're successfully loading a driver for that device.
- sudo xrandr --listproviders
- Shows what's active. If you use PRIME to set graphics to "intel" the Nvidia card won't show here. You'll have to go to "dynamic" or "nvidia" to see it.
- Here's another helpful reference from NVIDIA in case you get stuck: http://us.download.nvidia.com/XFree86/Linux-x86_64/525.116.03/README/index.html
- Wanna encrypt your home directory like it's 2012?
sudo apt install ecryptfs-utils cryptsetup
- Create another temporary user with sudo (Administrator) ability, log out, and log in as that user, then:
sudo ecryptfs-migrate-home -u <user-to-Encrypt-Home>
- Then log into your user account again (the one you just migrated) and run:
ecryptfs-unwrap-passphrase
- Then delete the temp user and their files/home folders, as you don't need it any more.
- Credit to Catalyph's response to this topic: https://askubuntu.com/questions/1409307/encrypt-the-home-directory-in-ubuntu-22-04
@rawnam
Copy link

rawnam commented Jun 16, 2024

Has this been tried on the 2024 version?

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