Gentoo Handbook: arm64 on the gentoo-vm (/dev/vda)
The full install, adapted for the emulated arm64 VM at gentoo.apps.sabhya.me.
About this guide
This is the Gentoo Handbook install, chapter by chapter, rewritten for the arm64 VM at gentoo.apps.sabhya.me: every disk is /dev/vda, the firmware is UEFI, and the console is a serial terminal. It follows the official Handbook:ARM64 and fills its gaps from Handbook:AMD64, whose structure it keeps.
| Part | In the official Handbook | On this VM |
|---|---|---|
| CPU | amd64 / arm64 hardware | arm64 (-cpu max), 2 vCPUs, 4 GiB RAM, software-emulated (no KVM) |
| Firmware | BIOS or UEFI | UEFI only (AAVMF); boot entries persist |
| Disk | /dev/sda or /dev/nvme0n1 |
/dev/vda (virtio-blk), 40 GiB, partitions /dev/vda1, /dev/vda2… |
| Network | Ethernet or Wi-Fi | virtio-net behind QEMU NAT: DHCP gives 10.0.2.15, gateway 10.0.2.2, DNS 10.0.2.3 |
| Console | screen + keyboard | serial ttyAMA0 in the browser terminal; the graphical screen at /screen/ for KDE Plasma |
| Install media | minimal install ISO | latest arm64 minimal ISO, already inserted |
Conventions: a command starting with root # runs on the live CD; (chroot) root # runs inside the new system. Copy everything after the prompt. Emulation makes compiling roughly 10–20× slower than real hardware, so this guide uses binary packages and the prebuilt distribution kernel wherever the Handbook offers a choice.
Adapted from the Gentoo Handbook, © Gentoo Foundation, licensed CC BY-SA 4.0; this adaptation is under the same license.
1. Booting the installation media
The VM already has the arm64 minimal install ISO inserted, so this chapter replaces the Handbook's download, verify and burn steps. Open the console page and you are at the live CD.
- Open gentoo.apps.sabhya.me and sign in with your Orchard account.
- On a fresh VM the screen shows UEFI, then GRUB, then kernel messages scrolling on
ttyAMA0. Under emulation this takes 2–4 minutes. - At
<< Load keymap (Enter for default):press Enter for US English, or type the number of your layout. - You land at a root shell:
root@livecd ~ #. The live CD scrambles the root password, which you only need for SSH.
Check you are on the right machine:
root # uname -m
aarch64
root # lsblk /dev/vda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
vda 254:0 0 40G 0 disk
The console is shared: anyone else signed in sees the same screen. Closing the tab does not stop the VM, and restarts of the container resume it where it was.
2. Configuring the network
The live CD normally gets an address by itself from QEMU's built-in DHCP server, so this chapter is a check. There is no Wi-Fi, no static setup and no proxy to configure.
root # ip -br addr
lo UNKNOWN 127.0.0.1/8 ::1/128
enp0s1 UP 10.0.2.15/24 ...
root # curl -sI https://distfiles.gentoo.org | head -1
HTTP/2 200
The interface name can differ (enp0s1, enp0s3, eth0); ip -br link lists it. If it has no 10.0.2.15 address, ask for one:
root # dhcpcd enp0s1
| Setting | Value |
|---|---|
| Address | 10.0.2.15/24 (DHCP) |
| Gateway | 10.0.2.2 |
| DNS server | 10.0.2.3 |
| Inbound connections | none from the internet; guest port 22 is forwarded only inside the container |
curl is the reliable check: ping may fail behind QEMU's NAT even when the network works, because the host may not allow the unprivileged ping sockets it uses. net-setup from the Handbook also works and leads to the same result. The Handbook's optional SSH step is not useful here, since nothing outside the container can reach the VM.
3. Preparing the disks
The 40 GiB disk /dev/vda gets a GPT table with three partitions: an EFI system partition, swap, and root. Everywhere the Handbook writes /dev/sda or /dev/nvme0n1, use /dev/vda; partitions are /dev/vda1, /dev/vda2, /dev/vda3 (no p before the number).
| Partition | Size | Type | Filesystem | Mount point |
|---|---|---|---|---|
/dev/vda1 |
1 GiB | EFI System | FAT32 | /efi |
/dev/vda2 |
4 GiB | Linux swap | swap | none |
/dev/vda3 |
rest (~35 GiB) | Linux root (ARM-64) | ext4 | / |
Partition with fdisk
root # fdisk /dev/vda
Type these at the Command (m for help): prompts:
g— create a new empty GPT partition table.n, Enter, Enter,+1G— partition 1. Thent,1(or the aliasuefi) to make it an EFI System partition.n, Enter, Enter,+4G— partition 2. Thent,2,swap.n, Enter, Enter, Enter — partition 3 takes the rest. Thent,3,27— type 27 is Linux root (ARM-64); the Handbook's x86-64 example uses 23, which is wrong here. Leaving it as Linux filesystem also works.pto check the table, thenwto write it and exit.
If fdisk warns about an old signature on a reused disk, answer Y to remove it.
Create the filesystems
root # mkfs.vfat -F 32 /dev/vda1
root # mkswap /dev/vda2
root # swapon /dev/vda2
root # mkfs.ext4 /dev/vda3
The Handbook lists xfs, btrfs and others as alternatives for root; ext4 is the simplest choice for a VM disk.
Mount the root partition
root # mkdir --parents /mnt/gentoo
root # mount /dev/vda3 /mnt/gentoo
root # mkdir --parents /mnt/gentoo/efi
The EFI partition is mounted later, from inside the chroot (chapter 5).
4. Installing the stage file
Pick the init system now. Planning KDE Plasma? Use systemd: Gentoo's prebuilt Plasma packages are built for systemd, so on OpenRC Plasma compiles from source for many hours. Otherwise OpenRC is the Handbook's default. The commands below use openrc; swap in systemd for the other stage3 (about 260 MB).
Set the clock
TLS downloads and signature checks fail with a wrong clock. Sync it once:
root # chronyd -q
root # date
Download and verify the stage3
The Handbook browses the mirror with links; on a serial console it is quicker to read the latest file name from the index:
root # cd /mnt/gentoo
root # B=https://distfiles.gentoo.org/releases/arm64/autobuilds
root # S=$(wget -qO- $B/latest-stage3-arm64-openrc.txt | awk '/tar.xz/{print $1}')
root # echo $S
20261129T234603Z/stage3-arm64-openrc-20261129T234603Z.tar.xz
root # wget $B/$S $B/$S.asc
root # gpg --import /usr/share/openpgp-keys/gentoo-release.asc
root # gpg --verify stage3-arm64-*.tar.xz.asc
Look for Good signature from "Gentoo Linux Release Engineering (Automated Weekly Release Key)".
Unpack it
root # tar xpf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo
This is the Handbook's command without v: printing every file name to the emulated serial port can triple the time. Expect 3–6 minutes.
Configure compile options
Edit /mnt/gentoo/etc/portage/make.conf with nano:
COMMON_FLAGS="-O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
MAKEOPTS="-j2 -l2"
FEATURES="getbinpkg binpkg-request-signature"
ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"
LC_MESSAGES=C.utf8
- Keep
-O2 -pipe. Binary packages are chosen by USE flags, not CFLAGS, so the Handbook's-march=nativeis harmless but only affects what you compile locally. MAKEOPTSmatches the 2 vCPUs and 3 GiB of RAM; higher values only add memory pressure.getbinpkgpulls prebuilt packages from the Gentoo arm64 binhost, which the stage3 already lists in/etc/portage/binrepos.conf/gentoo.conf. This is what makes the install practical under emulation.
5. Installing the base system
Enter the new environment
root # cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
root # arch-chroot /mnt/gentoo
root # source /etc/profile
root # export PS1="(chroot) ${PS1}"
(chroot) root # mount /dev/vda1 /efi
arch-chroot mounts /proc, /sys, /dev and /run for you. The Handbook's manual mount --rbind sequence works too if you prefer to see each step.
Sync the ebuild repository
(chroot) root # emerge-webrsync
(chroot) root # getuto
(chroot) root # eselect news read
emerge-webrsync downloads one GPG-verified snapshot, which is faster here than emerge --sync. getuto sets up the keys that check binary-package signatures (emerge would also run it on first use). Skip mirrorselect: the default CDN mirror is fine.
Choose a profile
(chroot) root # eselect profile list
(chroot) root # eselect profile set default/linux/arm64/23.0
Pick default/linux/arm64/23.0 for OpenRC or default/linux/arm64/23.0/systemd for systemd, matching your stage3. For KDE Plasma, stay on the plain systemd profile for now and switch to the Plasma profile in chapter 11, once the system boots.
Update the @world set
(chroot) root # emerge --ask --verbose --update --deep --newuse --getbinpkg @world
In the list, [binary] means a download and [ebuild] means a compile. With an unmodified stage3 and profile nearly everything should be [binary]. If many lines say [ebuild], a USE flag or profile change made the binaries not match; undo it rather than wait hours.
The Handbook's CPU_FLAGS_ARM step (cpuid2cpuflags) is optional here. Setting it changes USE flags, which makes Portage compile instead of downloading.
Time zone
(chroot) root # ln -sf ../usr/share/zoneinfo/Europe/London /etc/localtime
Replace Europe/London with your zone (ls /usr/share/zoneinfo). On systemd use timedatectl set-timezone after the first boot instead.
Locales
(chroot) root # nano /etc/locale.gen
en_US.UTF-8 UTF-8
(chroot) root # locale-gen
(chroot) root # eselect locale list
(chroot) root # eselect locale set en_US.utf8
(chroot) root # env-update && source /etc/profile && export PS1="(chroot) ${PS1}"
6. Configuring the kernel
Use the prebuilt distribution kernel, gentoo-kernel-bin: it installs in minutes and already has every driver this VM needs. Compiling a kernel under emulation takes several hours.
Skip the Handbook's firmware and microcode steps: the VM has no hardware that needs linux-firmware, and microcode does not apply to an emulated CPU.
Set up installkernel
installkernel copies each new kernel to /boot and, with the grub flag, regenerates the GRUB menu; dracut builds the initramfs.
(chroot) root # mkdir -p /etc/portage/package.use
(chroot) root # echo "sys-kernel/installkernel dracut grub" > /etc/portage/package.use/installkernel
(chroot) root # emerge --ask sys-kernel/installkernel
Install the distribution kernel (recommended)
(chroot) root # emerge --ask sys-kernel/gentoo-kernel-bin
(chroot) root # ls /boot
/boot should now hold vmlinuz-* and initramfs-*. Later kernel updates arrive through normal @world updates.
Alternative: compile your own kernel
Only if you want the Handbook's manual-configuration experience and can leave it building for hours:
(chroot) root # emerge --ask sys-kernel/gentoo-sources
(chroot) root # eselect kernel set 1
(chroot) root # cd /usr/src/linux
(chroot) root # make defconfig
(chroot) root # make menuconfig
(chroot) root # make -j2 && make modules_install && make install
The arm64 defconfig already covers this VM. If you start from a smaller config, these must be built in (=y):
| Option | Why the VM needs it |
|---|---|
CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BLK |
finds /dev/vda |
CONFIG_VIRTIO_NET |
the network card |
CONFIG_HW_RANDOM_VIRTIO |
entropy from the host |
CONFIG_SERIAL_AMBA_PL011, CONFIG_SERIAL_AMBA_PL011_CONSOLE |
the ttyAMA0 serial console you type in |
CONFIG_EFI, CONFIG_EFI_STUB |
booting from UEFI |
CONFIG_EXT4_FS |
the root filesystem |
CONFIG_VFAT_FS, CONFIG_NLS_CP437, CONFIG_NLS_ISO8859_1 |
mounting /efi |
CONFIG_DEVTMPFS, CONFIG_DEVTMPFS_MOUNT |
device nodes at boot |
7. Configuring the system
fstab
(chroot) root # nano /etc/fstab
/dev/vda1 /efi vfat umask=0077 0 2
/dev/vda2 none swap sw 0 0
/dev/vda3 / ext4 defaults,noatime 0 1
Device names are stable in this VM, so /dev/vda* is safe. To follow the Handbook's preference for persistent names, replace each with PARTUUID=... from blkid /dev/vda1 (and so on).
Hostname
(chroot) root # echo gentoo-vm > /etc/hostname
On OpenRC the Handbook also requires the name in /etc/hosts. Edit it with nano /etc/hosts so it has:
127.0.0.1 gentoo-vm localhost
::1 gentoo-vm localhost
Network at boot
(chroot) root # emerge --ask net-misc/dhcpcd
(chroot) root # rc-update add dhcpcd default # OpenRC
(chroot) root # systemctl enable dhcpcd # systemd
Run the line for your init system only. DHCP is all this VM needs; skip the Handbook's netifrc static configuration.
Root password
(chroot) root # passwd
A login prompt on the serial console
The VM's text console is the serial port ttyAMA0, so the login prompt must run there.
- OpenRC: nothing to add. The arm64 stage3's
/etc/inittabalready ends withf0:12345:respawn:/sbin/agetty 9600 ttyAMA0 vt100; do not add a second line for the same port. Optionally change9600to-L 115200in that line. - systemd: a getty starts on
ttyAMA0automatically once chapter 9 putsconsole=ttyAMA0on the kernel command line. Enabling it explicitly does no harm:
(chroot) root # systemctl enable serial-getty@ttyAMA0.service
Init and boot settings
- OpenRC: leave
/etc/conf.d/hwclockatclock="UTC"./etc/conf.d/keymapscan stay atus: on a serial console your browser handles the keyboard layout. - systemd: run
systemd-machine-id-setupandsystemd-firstboot --prompt, thensystemctl preset-all --preset-mode=enable-only, as in the Handbook.
8. Installing system tools
One emerge installs the Handbook's recommended tools. Nearly all come from the binhost; plocate and bash-completion are small and compile locally.
(chroot) root # emerge --ask app-admin/sysklogd sys-process/cronie sys-apps/plocate net-misc/chrony sys-fs/dosfstools app-shells/bash-completion
Then enable the services for your init system:
| Tool | Purpose | OpenRC | systemd |
|---|---|---|---|
sysklogd |
system logger | rc-update add sysklogd default |
not needed (journald) |
cronie |
scheduled jobs | rc-update add cronie default |
systemctl enable cronie |
chrony |
keeps the clock right | rc-update add chronyd default |
systemctl enable chronyd |
plocate |
locate file index |
runs from cron | runs from cron |
dosfstools |
checks the FAT /efi partition at boot |
nothing to enable | nothing to enable |
dosfstools matters here: /etc/fstab asks for a check of /dev/vda1 at boot, which fails without fsck.vfat.
SSH (rc-update add sshd default) is optional. Nothing outside the container can reach the VM, so it is only useful from inside the guest itself.
9. Configuring the bootloader
GRUB for arm64-efi goes on the EFI partition /dev/vda1, mounted at /efi, and its menu sends the kernel console to the serial port.
Install GRUB
(chroot) root # emerge --ask --verbose sys-boot/grub sys-boot/efibootmgr
Install efibootmgr with GRUB: on arm64 GRUB does not pull it in, and without it grub-install stops with efibootmgr: not found. Leave GRUB_PLATFORMS unset. It is empty on arm64 and the binary GRUB package already contains the arm64-efi target, while setting it makes GRUB compile from source.
(chroot) root # grub-install --efi-directory=/efi
Installing for arm64-efi platform.
Installation finished. No error reported.
The VM keeps its UEFI variables between boots, so the Gentoo boot entry this creates sticks. The firmware tries the disk before the ISO.
Point the console at the serial port
Edit /etc/default/grub:
GRUB_CMDLINE_LINUX="console=ttyAMA0,115200"
GRUB_TERMINAL=console
GRUB_TIMEOUT=3
The Handbook has no equivalent step; on real hardware the kernel picks the screen. Here, without console=ttyAMA0, boot messages may not reach the browser terminal.
Generate the menu
(chroot) root # grub-mkconfig -o /boot/grub/grub.cfg
Found linux image: /boot/vmlinuz-...
Found initrd image: /boot/initramfs-....img
done
Because installkernel has the grub flag, this runs again on every kernel update.
If the VM later boots back into the live CD instead of your system, rerun grub-install --efi-directory=/efi --removable. That also writes \EFI\BOOT\BOOTAA64.EFI, the fallback path every UEFI firmware tries.
10. Finalizing
Reboot into the new system
(chroot) root # exit
root # cd
root # umount -R /mnt/gentoo
root # reboot
The ISO stays inserted, but the firmware now boots /dev/vda first. You should see the GRUB menu, kernel messages, then a gentoo-vm login: prompt in the same browser terminal. Log in as root.
A reboot inside the guest is a real reboot. A restart of the container (a redeploy) instead pauses the VM and resumes it exactly where it was.
Add a user
root # useradd -m -G users,wheel -s /bin/bash larry
root # passwd larry
root # emerge --ask app-admin/doas
root # echo "permit :wheel" > /etc/doas.conf
Replace larry with your name. sudo works too if you prefer it.
Clean up
root # rm /stage3-*.tar.*
That frees about 250 MB.
Where to go next
The Handbook's Working with Gentoo and Working with Portage parts apply to this VM unchanged; they are written once for all architectures. Keep using binary packages for anything large.
11. KDE Plasma (optional)
Plasma needs the systemd stage3 and profile from chapters 4–5, a user account from chapter 10, and the browser screen at gentoo.apps.sabhya.me/screen/. Do this after the first boot, logged in as root on the serial console.
Switch to the Plasma profile
root # eselect profile set default/linux/arm64/23.0/desktop/plasma/systemd
root # emerge --ask --verbose --update --deep --newuse --getbinpkg @world
The desktop profile turns on USE flags for graphics, sound and Qt, so this update pulls in a few hundred packages. Check the list says [binary]: Gentoo's arm64 binhost builds Plasma for exactly this profile.
Install Plasma
root # emerge --ask kde-plasma/plasma-meta
root # usermod -aG video,audio larry
root # systemctl enable sddm
root # reboot
plasma-meta brings in the Plasma desktop, the SDDM login screen and the basic KDE apps; add kde-apps/konsole and kde-apps/dolphin if they are not already listed. Expect roughly 3 GB of downloads and 10–12 GB used on / afterwards, which the 35 GiB root partition holds comfortably.
Use it
After the reboot, open /screen/. SDDM shows a login screen; log in as your user and Plasma starts. Everything is drawn by the emulated CPU, so expect several seconds per frame: fine for setting things up, not for daily use. The serial terminal at / keeps working alongside it.
Appendix: quick reference and troubleshooting
Handbook name → this VM
| Handbook says | Use here |
|---|---|
/dev/sda, /dev/nvme0n1 |
/dev/vda |
/dev/sda1, /dev/nvme0n1p1 |
/dev/vda1 (EFI, /efi) |
/dev/sda2 |
/dev/vda2 (swap) |
/dev/sda3 |
/dev/vda3 (root) |
stage3-amd64-* |
stage3-arm64-* |
default/linux/amd64/23.0 |
default/linux/arm64/23.0 |
x86_64-efi, grubx64.efi, BOOTX64.EFI |
arm64-efi, grubaa64.efi, BOOTAA64.EFI |
CPU_FLAGS_X86 |
CPU_FLAGS_ARM (optional; forces source builds) |
tty1, ttyS0 |
ttyAMA0 |
-march=native |
optional; binary packages are matched on USE flags, not CFLAGS |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Blank console after reboot | no console=ttyAMA0 or no serial getty |
boot the live CD (see below), mount /dev/vda3 and /dev/vda1, chroot, redo the chapter 7 login prompt step and chapter 9 |
| Reboot lands in the live CD again | GRUB missing from the ESP | in the chroot: grub-install --efi-directory=/efi --removable |
emerge compiles everything |
USE flags or profile differ from the binhost (Plasma on OpenRC, for example) | revert USE changes; check emerge -pv shows [binary] |
grub-install: efibootmgr: not found |
efibootmgr not installed | emerge --ask sys-boot/efibootmgr, then run grub-install again |
| Downloads fail with certificate errors | clock wrong | chronyd -q |
| No network | DHCP did not run | dhcpcd enp0s1 (name from ip -br link) |
| Console looks frozen | emulation is slow, or output scrolled off | wait a minute, press Enter |
/screen/ says "Display output is not active" |
the guest has not started its graphics yet (normal on the text-only live CD) | use the serial terminal at /; the screen comes alive once Plasma or a framebuffer console runs |
To get back to the live CD after installing, power off from inside the guest (poweroff) and press Enter to boot again; at the UEFI splash press Esc and choose the CD in the Boot Manager.
Starting over
To wipe the VM completely, ask for /data/gentoo.qcow2 and /data/efivars.fd to be deleted and the gentoo-vm deployment restarted on Orchard. A new blank disk and fresh UEFI variables are created on the next start.