User:Vokiel/Asus-ProArt-P16-2024

From Gentoo Wiki
Jump to:navigation Jump to:search

Asus ProArt P-16 H7606 (2404) Installation Log

This page is an installation log of gentoo linux on an Asus ProArt P-16 Ryzen 9 laptop. I won't go into detailed technical explanations in this log. I may drop a number of links which may eventually die and become inaccessible. I will however document everything that I've done, what worked well and what didn't. I will try to log everything in a neutral position as much as possible. I'll set my own requirements, and make my own choices. Some of which will most likely be wrong, so don't take this page as a Guide without asking for multiple opinions on it. If you find some problematic setup, don't hesitate to share it under the Discussions tab.

This is the product string I get from dmidecode:

user $dmidecode -s system-product-name
ProArt P16 H7606WV_H7606WV

Requirements

  1. Must not dual boot Windows
  2. Must use an EFI boot partition on a GPT disk.
  3. Must run an encrypted production partition with enough space for LVM Snapshots
  4. Must run an encrypted staging partition with enough space to install new Gentoo layouts
  5. I need to be able to boot either of the 2 encrypted partitions from grub
  6. I'll try getting an encryption key on usb thumb drive again.
  7. Must have a steam library partition with no encryption on ext4
  8. Could have an opt partition with no encryption on ext4
  9. Must be able to suspend/hibernate
  10. Must use the Nvidia proprietary driver
  11. Could have KDE
  12. Must have XFCE
  13. Should use OpenRC
  14. Should use GRUB 2 with a custom Asus theme
  15. Should use SDDM with a custom Asus theme
  16. Should be able to have Steam with 32 bit libs

Custom Live USB Key

The currently available Live USB keys are running a kernel without support for the laptop's WIFI hardware: Mediatek MT7925. This is part of the kernel 6.7, stable gentoo-sources are at 6.6.30 at the moment of this writing. I will need to craft a custom boot key with a masked kernel package.

The following are interesting resources:


Warning
Catalyst is a scripting tool with which it's easy to mess up and I ended up messing the configs a couple of time before producing a key that would boot the latest masked kernel. The easy check is to compare the size of the iso with the official one. If it's not roughly the same size, something went wrong

From the Catalyst Guide:

root #emerge --ask dev-util/catalyst
root #mkdir -p /var/tmp/catalyst/builds/default
root #git clone -o upstream https://github.com/gentoo/releng.git
root #cd /var/tmp/catalyst/builds/default
root #cd /var/tmp/catalyst
root #catalyst -s stable
root #cp ~/releng/releases/specs/amd64/installcd-stage1.spec .
root #cp ~/releng/releases/specs/amd64/installcd-stage2-minimal.spec .

Next I had to edit the kernel configs, copying the configs from 6.6.30, to add the MT7925 driver

root #echo "=sys-kernel/gentoo-sources-6.10.4 ~amd64" > /etc/portage/package.accept_keywords/gentoo-sources
root #emerge --ask sys-kernel/gentoo-sources
root #cd /usr/src/linux-6.10.4-gentoo
root #cp ~/releng/releases/kconfig/amd64/amd64-6.6.30.config .
root #make menuconfig
root #cp /usr/src/linux-6.10.4-gentoo/.config ~/releng/releases/kconfig/amd64/amd64-6.10.4.config

Next I edited both files:

FILE /var/tmp/catalyst/installcd-stage1.spec
subarch: amd64
version_stamp: 2024-08-11
target: livecd-stage1
rel_type: default
profile: default/linux/amd64/23.0/no-multilib
snapshot_treeish: f0f83c4ebfd190a5054916ab74fdeed2241b83bf
source_subpath: default/stage3-amd64-openrc-20240804T163558Z
compression_mode: pixz
portage_confdir: /root/releng/releases/portage/isos

livecd/use:
	alsa
	compile-locales
	fbcon
	livecd
	portaudio
	socks5
	unicode
	xml

livecd/packages:
	app-accessibility/brltty
	app-accessibility/espeakup
	app-admin/hddtemp
	app-admin/pwgen
	app-admin/syslog-ng
	app-arch/unzip
	app-crypt/gnupg
	app-editors/mg
	app-editors/nano
	app-misc/livecd-tools
	app-misc/screen
	app-misc/tmux
	app-portage/cpuid2cpuflags
	app-portage/mirrorselect
	app-text/wgetpaste
	dev-debug/strace
	media-gfx/fbgrab
	media-sound/alsa-utils
	net-analyzer/traceroute
	net-dialup/mingetty
	net-dialup/pptpclient
	net-dialup/rp-pppoe
	net-fs/cifs-utils
	net-fs/nfs-utils
	net-irc/irssi
	net-misc/chrony
	net-misc/dhcpcd
	net-misc/iputils
	net-misc/ndisc6
	net-misc/openssh
	net-misc/rdate
	net-misc/rsync
	net-misc/vconfig
	net-proxy/dante
	net-proxy/tsocks
	net-wireless/b43-fwcutter
	net-wireless/iw
	net-wireless/wireless-tools
	net-wireless/wpa_supplicant
	sys-apps/arch-chroot
	sys-apps/busybox
	sys-apps/cpuid
	sys-apps/dmidecode
	sys-apps/ethtool
	sys-apps/fxload
	sys-apps/gptfdisk
	sys-apps/hdparm
	sys-apps/iproute2
	sys-apps/kexec-tools
	sys-apps/lshw
	sys-apps/memtester
	sys-apps/memtest86+
	sys-apps/netplug
	sys-apps/nvme-cli
	sys-apps/pciutils
	sys-apps/pcmciautils
	sys-apps/pv
	sys-apps/sdparm
	sys-apps/usbutils
	sys-auth/ssh-import-id
	sys-block/parted
	sys-block/partimage
	sys-boot/efibootmgr
	sys-firmware/b43-firmware
	sys-firmware/ipw2100-firmware
	sys-firmware/ipw2200-firmware
	sys-fs/bcache-tools
	sys-fs/btrfs-progs
	sys-fs/cryptsetup
	sys-fs/dmraid
	sys-fs/dosfstools
	sys-fs/e2fsprogs
	sys-fs/f2fs-tools
	sys-fs/genfstab
	sys-fs/jfsutils
	sys-fs/lsscsi
	sys-fs/lvm2
	sys-fs/mac-fdisk
	sys-fs/mdadm
	sys-fs/multipath-tools
	sys-fs/ntfs3g
	sys-fs/reiserfsprogs
	sys-fs/xfsdump
	sys-fs/xfsprogs
	sys-kernel/linux-firmware
	#force rebuild for USE="(-multilib*)"
	sys-libs/glibc
	sys-libs/gpm
	sys-power/acpid
	www-client/links


I've added:

  • sys-apps/lshw
  • sys-apps/cpuid


FILE /var/tmp/catalyst/installcd-stage2-minimal-20240811.spec
subarch: amd64
version_stamp: 2024-08-11
target: livecd-stage2
rel_type: default
profile: default/linux/amd64/23.0/no-multilib
snapshot_treeish: f0f83c4ebfd190a5054916ab74fdeed2241b83bf
source_subpath: default/livecd-stage1-amd64-2024-08-11
portage_confdir: /root/releng/releases/portage/isos

livecd/bootargs: dokeymap
livecd/fstype: squashfs
livecd/iso: install-amd64-minimal-2024-08-11.iso
livecd/type: gentoo-release-minimal
livecd/volid: Gentoo amd64 2024-08-11

boot/kernel: gentoo

boot/kernel/gentoo/sources: gentoo-sources
boot/kernel/gentoo/config: /root/releng/releases/kconfig/amd64/amd64-6.10.4.config

boot/kernel/gentoo/packages: --usepkg n broadcom-sta

livecd/unmerge:
	app-admin/eselect
	app-admin/eselect-ctags
	app-admin/eselect-vi
	app-admin/perl-cleaner
	app-admin/python-updater
	app-arch/cpio
	dev-build/libtool
	dev-lang/rust-bin
	dev-libs/gmp
	dev-libs/libxml2
	dev-libs/mpfr
	dev-python/pycrypto
	dev-util/pkgconfig
	dev-util/pkgconf
	perl-core/PodParser
	perl-core/Test-Harness
	sys-apps/debianutils
	sys-apps/diffutils
	sys-apps/groff
	sys-apps/man-db
	sys-apps/man-pages
	sys-apps/memtest86+
	sys-apps/miscfiles
	sys-apps/sandbox
	sys-apps/texinfo
	sys-devel/autoconf
	sys-devel/autoconf-wrapper
	sys-devel/automake
	sys-devel/automake-wrapper
	sys-devel/binutils
	sys-devel/binutils-config
	sys-devel/bison
	sys-devel/flex
	sys-devel/gcc
	sys-devel/gcc-config
	sys-devel/gettext
	sys-devel/gnuconfig
	sys-devel/m4
	sys-devel/make
	sys-devel/patch
	sys-libs/db
	sys-libs/gdbm
	sys-kernel/genkernel
	sys-kernel/linux-headers

livecd/empty:
	/boot
	/etc/cron.daily
	/etc/cron.hourly
	/etc/cron.monthly
	/etc/cron.weekly
	/etc/logrotate.d
	/etc/modules.autoload.d
	/etc/rsync
	/etc/runlevels/single
	/etc/skel
	/root/.ccache
	/tmp
	/usr/diet/include
	/usr/diet/man
	/usr/include
	/usr/i?86-gentoo-linux-uclibc
	/usr/i?86-pc-linux-uclibc
	/usr/lib/X11/config
	/usr/lib/X11/doc
	/usr/lib/X11/etc
	/usr/lib/awk
	/usr/lib/ccache
	/usr/lib/gcc-config
	/usr/lib/nfs
	/usr/lib/perl5/site_perl
	/usr/lib/portage
	/usr/lib64/X11/config
	/usr/lib64/X11/doc
	/usr/lib64/X11/etc
	/usr/lib64/awk
	/usr/lib64/ccache
	/usr/lib64/gcc-config
	/usr/lib64/nfs
	/usr/lib64/perl5/site_perl
	/usr/lib64/portage
	/usr/local
	/usr/portage
	/usr/share/aclocal
	/usr/share/baselayout
	/usr/share/binutils-data
	/usr/share/consolefonts/partialfonts
	/usr/share/consoletrans
	/usr/share/dict
	/usr/share/doc
	/usr/share/emacs
	/usr/share/et
	/usr/share/gcc-data
	/usr/share/genkernel
	/usr/share/gettext
	/usr/share/glib-2.0
	/usr/share/gnuconfig
	/usr/share/gtk-doc
	/usr/share/i18n
	/usr/share/info
	/usr/share/lcms
	/usr/share/libtool
	/usr/share/man
	/usr/share/rfc
	/usr/share/ss
	/usr/share/state
	/usr/share/texinfo
	/usr/share/unimaps
	/usr/share/zoneinfo
	/usr/src
	/var/cache
	/var/empty
	/var/lib/portage
	/var/log
	/var/spool
	/var/state
	/var/tmp

livecd/rm:
	/boot/System*
	/boot/initr*
	/boot/kernel*
	/etc/*-
	/etc/*.old
	/etc/default/audioctl
	/etc/dispatch-conf.conf
	/etc/env.d/05binutils
	/etc/env.d/05gcc
	/etc/etc-update.conf
	/etc/hosts.bck
	/etc/issue*
	/etc/genkernel.conf
	/etc/make.conf*
	/etc/make.globals
	/etc/make.profile
	/etc/man.conf
	/etc/resolv.conf
	/usr/lib*/*.a
	/usr/lib*/*.la
	/usr/lib*/cpp
	/root/.bash_history
	/root/.viminfo
	/usr/bin/*.static
	/usr/bin/fsck.cramfs
	/usr/bin/fsck.minix
	/usr/bin/mkfs.bfs
	/usr/bin/mkfs.cramfs
	/usr/bin/mkfs.minix
	/usr/bin/addr2line
	/usr/bin/ar
	/usr/bin/as
	/usr/bin/audioctl
	/usr/bin/c++*
	/usr/bin/cc
	/usr/bin/cjpeg
	/usr/bin/cpp
	/usr/bin/djpeg
	/usr/bin/ebuild
	/usr/bin/egencache
	/usr/bin/emerge
	/usr/bin/emerge-webrsync
	/usr/bin/emirrordist
	/usr/bin/elftoaout
	/usr/bin/f77
	/usr/bin/g++*
	/usr/bin/g77
	/usr/bin/gcc*
	/usr/bin/genkernel
	/usr/bin/gprof
	/usr/bin/i?86-gentoo-linux-uclibc-*
	/usr/bin/i?86-pc-linux-*
	/usr/bin/jpegtran
	/usr/bin/ld
	/usr/bin/libpng*
	/usr/bin/nm
	/usr/bin/objcopy
	/usr/bin/objdump
	/usr/bin/piggyback*
	/usr/bin/portageq
	/usr/bin/ranlib
	/usr/bin/readelf
	/usr/bin/size
	/usr/bin/strip
	/usr/bin/tbz2tool
	/usr/bin/xpak
	/usr/bin/yacc
	/usr/lib*/*.a
	/usr/lib*/*.la
	/usr/lib*/perl5/site_perl
	/usr/lib*/gcc-lib/*/*/libgcj*
	/usr/bin/archive-conf
	/usr/bin/dispatch-conf
	/usr/bin/emaint
	/usr/bin/env-update
	/usr/bin/etc-update
	/usr/bin/fb*
	/usr/bin/fixpackages
	/usr/bin/quickpkg
	/usr/bin/regenworld
	/usr/share/consolefonts/1*
	/usr/share/consolefonts/7*
	/usr/share/consolefonts/8*
	/usr/share/consolefonts/9*
	/usr/share/consolefonts/A*
	/usr/share/consolefonts/C*
	/usr/share/consolefonts/E*
	/usr/share/consolefonts/G*
	/usr/share/consolefonts/L*
	/usr/share/consolefonts/M*
	/usr/share/consolefonts/R*
	/usr/share/consolefonts/a*
	/usr/share/consolefonts/c*
	/usr/share/consolefonts/dr*
	/usr/share/consolefonts/g*
	/usr/share/consolefonts/i*
	/usr/share/consolefonts/k*
	/usr/share/consolefonts/l*
	/usr/share/consolefonts/r*
	/usr/share/consolefonts/s*
	/usr/share/consolefonts/t*
	/usr/share/consolefonts/v*
	/usr/share/misc/*.old

Next copying the iso to the key:

root #dd if=/var/tmp/catalyst/builds/default/install-amd64-minimal-2024-08-11.iso of=/dev/sda status=progress

And that was it, booting the key found a kernel module for the Mediatek MT7925 device

Connecting to the Network

Awful, if you use the key above, you can use something like net-setup wlp99s0 and follow the setup scripts. You can do this except the autoconfig service, which is not meant for an installation key, will always barge in and reset everything as it doesn't match its little perfect world.

root #net-setup wlp99s0
root #/etc/init.d/autoconfig stop
Warning
Then you'll soon find out that the network configuration is as buggy as it use to be and not working.
root #route add default gw 192.168.1.1
root #echo "nameserver 8.8.8.8" >> /etc/resolv.conf
root #ping google.ca
Note
Eventually that worked, because I had to stop/start autoconfig a couple of times.

Creating the Partitions

LVM will be used on this laptop, but I will keep one supplementary encrypted partition to install other distributions and another one for un-encrypted game files. The standard EFI partition required for booting will be in UEFI mode and the actual Luks encrypted partition will contain all system files and folders.

root #fdisk /dev/nvme0n1

With fdisk, we create a new GPT partition table and dump whatever was there before (g). After, it's simply a matter of creating an EFI partition (n, default, default, +512M, t, 1) and then the LVM Linux Filesystem partition. (n, default, default, +832G). Finally the extra partition (n, default, default, default)

Warning
This is a log. Only do this if you don't want to dual boot
root #fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 953.87 Gib, 1024209543168 bytes, 20004092254 sectors
Disk model: MTFDKBA1T0QFM-1BD1AABGB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: ...

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048    1050623    1048576   512M EFI System
/dev/nvme0n1p2    1050624 1074792447 1073741824   512G Linux filesystem
/dev/nvme0n1p3 1074792448 1343227903  268435456   128G Linux filesystem
/dev/nvme0n1p4 1343227904 2000408575  657180672 313.4G Linux filesystem


EFI Partition

Needs to be vfat according to the EFI System Partition Guide.

root #mkfs.vfat -F 32 /dev/nvme0n1p1


Main Partition

First step is to erase or randomize the disk data to avoid usage pattern attacks. Taken from Arch's DM-crypt Drive Preparation

root #cryptsetup open --type plain -d /dev/urandom /dev/nvme0n1p2 crypt-wipe
root #dd if=/dev/zero of=/dev/mapper/crypt-wipe status=progress
root #cryptsetup close crypt-wipe

Encryption scheme is chosen to match cryptsetup's default values:

root #cryptsetup luksFormat /dev/nvme0n1p2
WARNING!
========
This will overwrite data on /dev/nvme0n1p2 irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/nvme0n1p2:
Note
At this stage a simple passphrase is used to keep things simple. An encrypted key file will be added later.
root #cryptsetup luksOpen /dev/nvme0n1p2 gentoo
Enter passphrase for /dev/nvme0n1p2:


LVM Layout

The LVM partitions created are: / (root), swap, /var, /var/log (log), /home and /opt. There is space left for creating snapshots.

root #pvcreate /dev/mapper/gentoo
root #vgcreate vg0 /dev/mapper/gentoo
root #lvcreate --size 48G --name root vg0
root #lvcreate --size 32G --name swap vg0
root #lvcreate --size 128G --name var vg0
root #lvcreate --size 8G --name log vg0
root #lvcreate --size 64G --name home vg0
root #lvcreate --size 128G --name opt vg0
root #vgchange --available y
root #pvdisplay
--- Physical volume ---
PV Name               /dev/mapper/gentoo
VG Name               vg0
PV Size               511.98 GiB / not usable 4.00 MiB
...
root #vgdisplay
--- Volume group ---
VG Name               vg0
System ID
Format                lvm2
...
root #lvdisplay
--- Logical volume ---
LV Path               /dev/vg0/root
LV Name               root
VG Name               vg0
...
LV Size               48.00 GiB

--- Logical volume ---
LV Path               /dev/vg0/swap
LV Name               swap
VG Name               vg0
...
LV Size                32.00 GiB

--- Logical volume ---
LV Path               /dev/vg0/var
LV Name               var
VG Name               vg0
...
LV Size               128.00 GiB

--- Logical volume ---
LV Path               /dev/vg0/log
LV Name               log
VG Name               vg0
...
LV Size               8.00 GiB

--- Logical volume ---
LV Path               /dev/vg0/home
LV Name               home
VG Name               vg0
...
LV Size               64.00 GiB

--- Logical volume ---
LV Path               /dev/vg0/opt
LV Name               opt
VG Name               vg0
...
LV Size               128.00 GiB

Format all partitions, XFS will be used for only /var/log reads/writes whereas the other file systems can just use EXT4:

root #mkfs.ext4 -L "root" /dev/mapper/vg0-root
root #mkswap -L "swap" /dev/mapper/vg0-swap
root #mkfs.ext4 -L "var" /dev/mapper/vg0-var
root #mkfs.ext4 -L "home" /dev/mapper/vg0-home
root #mkfs.ext4 -L "opt" /dev/mapper/vg0-opt
root #mkfs.xfs -l internal,size=128m -d agcount=8 /dev/mapper/vg0-log


Secondary Partition

Installing Gentoo from Stage 3

Configuring make.conf

Chroot to /mnt/gentoo

Configuring the kernel

Installing kernal, modules/firmware

Installing an initramfs

Configuring /etc/fstab