Gentoo Linux for Minisforum EliteMini UM780 XTX with Radeon 780M Graphics "Phoenix"

If a line starts with "cat<<EOT", then the following lines are part of the command to paste; the command goes till (including) the single line "EOT".

And the guide also is not ready, but working good enough so far. I write this text on the newly installed UM780 XTX, installed with this guide.

Abstract

Enabling the graphics card was a bit difficult. Therefore I grabbed the kernel settings from the live gui cd. It works. This works clearly also on other hardware. You need not to do all steps. Most is my personal style. You can stop as soon as you have a booting system an do your own things after.

Plan

- Distro: Gentoo linux.

- File system: Btrfs.

- Encryption: OPAL.

- Modules: No.

- Bootloader: None.

- TPM: No.

Hardware used

- Minisforum EliteMini UM780 XTX

- 2 x Samsung 990 PRO NVMe M.2 SSD, 2 TB, PCIe 4.0, 7.450 MB/s Read, 6.900 MB/s Write

- Kingston FURY Impact PnP 64GB (2x32GB) 5600MT/s DDR5 CL40 SODIMM

On old system

Navigate to any gentoo mirror https://www.gentoo.org/downloads/mirrors/

Open the folder /gentoo/releases/amd64/autobuilds/current-livegui-amd64/

Find the ISO image of the live gui cd and download it.

Burn it or copy it to a pendrive ore use an iodd st400. Make the image bootable.

On new system

Boot the image.

Goto settings/Power Management and disable "energy saving" and "suspend session".

Open a console and do

sudo bash
/etc/init.d/sshd start

Ups, you did not set your local keyboard layout. The '/' is left of the right shift key. :)

passwd
ip addr

Remember the ip address!

On old system

To enter the live cd start on Windows

putty root@{the-remembered-ip-adress}

or on other system

ssh root@{the-remembered-ip-adress}

In live cd

Now the installation starts.

Create a gpt partion table.

Create a partition with 32M with type "EFI System".

Create a partion with using the rest of the SSD type "Linux root (x86_64)"

cfdisk /dev/nvme0n1

You will find out, which keys to press. Don't forget to write out the partition table before "Quit".

Create the main file system and mount it.

With this nodesize and no inline files, I pay 5% over default settings. But I think it's okay for me. Maybe you should use the defaults and "compress=zstd".

mkfs.btrfs --nodesize 64k --metadata single /dev/nvme0n1p2
mkdir /mnt/gentoo
mount -o noatime,compress-force=lzo,user_subvol_rm_allowed,max_inline=0, /dev/nvme0n1p2 /mnt/gentoo

Create and mount the file system for the boot partition.

mkfs.fat /dev/nvme0n1p1
mkdir /mnt/gentoo/efi
mount /dev/nvme0n1p1 /mnt/gentoo/efi

Get a gentoo stage3 archive.

cd /mnt/gentoo
wget https://mirror.leaseweb.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64-nomultilib-systemd-mergedusr/stage3-amd64-nomultilib-systemd-mergedusr-20240312T171909Z.tar.xz

Uups, 404! Your timestamp was wrong. Find out the current timestamp with

curl https://mirror.leaseweb.com/gentoo/releases/amd64/autobuilds/latest-stage3-amd64-nomultilib-systemd-mergedusr.txt

and download the right file.

Extract the archive.

tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner

Copy nameserver information into the new gentoo.

cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

Enter the new gentoo as chroot environment.

mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
source /etc/profile

In gentoo

Put the mouse away.

Get the packet information of today.

emerge-webrsync

All packets should assume to use systemd.

The paket manager (named portage and called emerge) shall use all cores for compiling.

cat<<EOT >>/etc/portage/make.conf
USE="systemd"
MAKEOPTS="-j$(nproc)"
EOT

Allow "weak" passwords. Not recommended. :)

cat<<EOT >>/etc/portage/package.use/pambase
sys-auth/pambase -passwdqc
EOT

We will use utf8 only.

cat<<EOT >/etc/locale.gen
C.UTF8 UTF-8
en_US.UTF-8 UTF-8
EOT

Update world the gentoo way.

time emerge -uDN @world

This might run 5 minutes or 20 minutes, depending mainly on if gcc is to be updated.

Accept the licenses for linux-firmware.

cat<<EOT > /etc/portage/package.license
sys-kernel/linux-firmware linux-fw-redistributable
sys-kernel/linux-firmware @BINARY-REDISTRIBUTABLE
EOT

Updating the kernel sources must also actualize the symlink /usr/src/linux to the newest kernel source directory.

cat<<EOT > /etc/portage/package.use/gentoo-sources
sys-kernel/gentoo-sources symlink
EOT

Install packets the gentoo way.

emerge sys-kernel/gentoo-sources sys-kernel/linux-firmware

Borrow a kernel configuration the volkard way.

cd /usr/src/linux
zcat /proc/config.gz > .config
yes "" | make olddefconfig

This will produce a BIG kernel (12M) and many modules. It's fine for now. Later we reduce the kernel size and remove the kernel modules.

Enable, what's absolutely neccessary to boot without initrd.

cat<<EOT >>".config"
CONFIG_BLK_DEV_NVME=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="root=/dev/nvme0n1p2"
CONFIG_GENTOO_LINUX_INIT_SCRIPT=n
CONFIG_GENTOO_LINUX_INIT_SYSTEMD=y
CONFIG_CGROUP_BPF=y
CONFIG_FANOTIFY=y
CONFIG_KCMP=y
CONFIG_AUTOFS_FS=y
EOT

And integrate our settings.

make olddefconfig

Compile the kernel!

make -j$(nproc) && make modules_install

Copy the kernel to to boot partition.

mkdir -p /efi/efi/gentoo
cp arch/x86/boot/bzImage /efi/efi/gentoo/current

It's name "current", because later we add "old" and "fallback".

Let's add our kernel to the efi boot menu.

emerge efibootmgr
efibootmgr --create -D --disk /dev/nvme0n1p1 --part 1 --loader '/efi/gentoo/current' --label "current"

Of cource we need this file.

cat<<EOT >"/etc/fstab"
UUID=$(blkid -s UUID -o value /dev/nvme0n1p2)  /  btrfs  noatime,compress-force=lzo,user_subvol_rm_allowed,max_inline=0  0 0
UUID=$(blkid -s UUID -o value /dev/nvme0n1p1)  /efi  vfat  noauto,noatime,x-systemd.automount,x-systemd.idle-timeout=60  0 0
EOT

The network should simply use DHCP for now.

cat<<EOT >/etc/systemd/network/default.network
[Match]
Name=*
[Network]
DHCP=yes
EOT

Add the main user. It may be possible, you're not named "volkard".

useradd -m -G users,wheel,audio -s /bin/bash volkard

And set for now some weak passwords. Or strong passwords, if you did not disable passwdqc in pambase.

cat<<EOT | chpasswd
root:1234
volkard:1234
EOT

Now follows a hack. systemd-firstboot can with --root= manipulate foreign systems. But if the root is the default "/", then it assumes to manipulate the local system and will not work without a running systemd. So we fake to have our system in /mnt/gentoo.

We will never convert an ext3/4 filesystem to btrfs.

cat<<EOT >>/etc/portage/package.use/btrfs-progs
sys-fs/btrfs-progs -convert
EOT

Get mount.btrfs

emerge btrfs-progs

Mount / also on /mnt/gentoo

mkdir /mnt/gentoo
mount -onoatime,compress-force=lzo,user_subvol_rm_allowed,max_inline=0 /dev/nvme0n1p2 /mnt/gentoo

Make some local settings.

rm /mnt/gentoo/root/etc/localtime
rm /mnt/gentoo/root/etc/locale.conf
rm /mnt/gentoo/root/etc/hostname
systemd-firstboot --root="/mnt/gentoo" --locale="en_US.UTF-8" --locale-messages="C.UTF-8" --timezone="Europe/Berlin" --hostname="gentoo" --keymap="de-latin1-nodeadkeys"

And give /mnt/gentoo free.

umount /mnt/gentoo

Initialize systemd further.

systemd-machine-id-setup

Enable the first services.

systemctl preset-all
systemctl enable sshd.service

All okay, we can clean up the stage3 tarball.

rm /stage3-*.tar.xz

Leave the chroot environment.

exit

And have fun!

poweroff

You now have a working Gentoo Linux on hardware, where you and me had no clue, how to configure the kernel.

From now on you can leave this guide an do whatever you want.

On old system

putty volkard@gentoo

or

ssh volkard@gentoo

In gentoo

su -

Remove unused packages.

emerge --depclean

Ups, nano vanished. I can not work with vim.

emerge nano

Of course, you can instead emerge vim, if you like.

Make the system more native: Use all instructions, the processor provides.

emerge -1 app-portage/cpuid2cpuflags
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags
emerge -uDN @world

Make the system more native: Use all instructions, the processor provides.

nano /etc/portage/make.conf

Set COMMON_FLAGS="-O3 -march=native -pipe"

Personal preference.

cat<<'EOT' > /etc/bash/bashrc.d/histcontrol.d
export HISTCONTROL="ignoreboth:erasedups"
EOT

And I love to have the $ or # in the prompt to be red or green depending on if the last command had an error.

cat<<'EOT' > /etc/bash/bashrc.d/ps1.d
if [[ ${EUID} == 0 ]] ; then
         export PS1='\[\e[1;31m\]\u@\h \[\e[1;34m\]\w $(if [[ $? == 0 ]]; then echo "\[\e[1;32m\]"; else echo "\[\e[1;31m\]"; fi)\$ \[\e[0m\]'
else
         export PS1='\[\e[1;32m\]\u@\h \[\e[1;34m\]\w $(if [[ $? == 0 ]]; then echo "\[\e[1;32m\]"; else echo "\[\e[1;31m\]"; fi)\$ \[\e[0m\]'
fi
EOT
source /etc/profile

Switch emerge --sync from rsync to git. Blazing fast.

emerge dev-vcs/git
emerge -1 app-eselect/eselect-repository
eselect repository enable gentoo
rm -r /var/db/repos/gentoo
emerge --sync

I use the midnight-commander all the night.

emerge app-misc/mc

htop to watch in another window how strongly the cpus are utilized.

emerge sys-process/htop

Utility to find btrfs compression type/ratio on a file or set of files.

emerge sys-fs/compsize
compsize -x /

I use never info. I use man or google. So dint create info files globally.

nano /etc/portage/make.conf

Set FEATURES="noinfo".

Install ccache, the fast compiler cache.

emerge dev-util/ccache

And let it use the Btrfs feature of reflinks. More speed.

cat<<EOT > /etc/ccache.conf
file_clone=true
EOT

Enable ccache for portage.

nano /etc/portage/make.conf

Add FEATURES="ccache".

Uups, not multi lines with FEATURES=, only one line like USE=. So you want perhaps FEATURES="noinfo ccache".

Some tools for portage, especially euse. We will use euse later.

emerge gentoolkit

And now the graphical user interfacxe.

cat <<EOT >> /etc/portage/package.use/xfce
xfce-base/xfce4-meta minimal pulseaudio
EOT
euse -E X pulseaudio gtk3
euse -D thunar qt5
euse -E gtk policykit udisks
emerge -1 xfce-extra/xfce4-notifyd
emerge xfce-base/xfce4-meta

A browser.

euse -E postproc
emerge www-client/firefox

And a mail client.

emerge mail-client/thunderbird

Go to bleeding edge.

nano /etc/portage/fstab
ACCEPT_KEYWORDS="~amd64"

A good console.

cat<<EOT > /etc/portage/package.use/rxvt-unicode
x11-terms/rxvt-unicode xft perl
EOT
emerge x11-terms/rxvt-unicode

TODO: install pirx

Best-Effort Extent-Same, a btrfs dedup agent

(sorry, no html tables so far.)

Example output of compsize before deduplicating.

Processed 1060140 files, 1697243 regular extents (1718585 refs), 0 inline.

Type Perc Disk Usage Uncompressed Referenced

TOTAL 71% 107G 150G 151G

none 100% 84G 84G 84G

lzo 34% 23G 65G 67G

Example output of compsize after deduplicating.

Processed 1061138 files, 1203375 regular extents (6187340 refs), 0 inline.

Type Perc Disk Usage Uncompressed Referenced

TOTAL 81% 52G 64G 151G

none 100% 42G 42G 90G

lzo 46% 10G 22G 60G

Attention! Bees uses kernel internal structures and looks in /usr/src/linux. Everytime, you upgrade the kernel, you MUST recompile bees. If you have installed pirx, this goes automagically. But not now. You must it do by hand.

emerge sys-fs/bees
cat<<EOT > /etc/bees/root.conf
UUID=$(blkid -s UUID -o value /dev/nvme0n1p2)
OPTIONS="--strip-paths --no-timestamps --thread-count 1 --verbose 0"
DB_SIZE=$((256*1024*1024*4))
EOT
systemctl enable beesd@$(blkid -s UUID -o value /dev/nvme0n1p2)
systemctl start beesd@$(blkid -s UUID -o value /dev/nvme0n1p2)
systemctl status beesd@$(blkid -s UUID -o value /dev/nvme0n1p2)

Todo

copy system to other ssd and make that also bootable as fallback

shrinken kernel and remove kernel modules

write initrd, gathering keys, router hw-address and that of the light bulb and so on and mybe a password

enable OPAL

scite

pirx

share sources