Posts tagged linux
I really wanted to look into the new kernel building solutions for Gentoo and maybe migrate to dracut, but last time I tried, ~1.5 years ago, the initreamfs was now working for me.
And now in 2023 I’m still running genkernel for my personal boxes as well as other servers running Gentoo.
I guess some short term solutions really become defined tools :P
So this is how I rebuild my kernel nowadays:
Copy old config
cp linux-6.1.38-gentoo/.config linux-6.1.41-gentoo/
Remove old kernel build directories
rm -r linux-6.1.31-gentoo
Run initial preparation
( eselect kernel set 1 && cd /usr/src/linux && make olddefconfig )
--kernel-localversion="-$(hostname)-$(date '+%Y.%m.%d')" \
Rebuild the modules
If in your
/etc/genkernel.conf you have
MODULEREBUILD turned off, then also call emerge:
emerge -1 @module-rebuild
static-user USE enabled and your wanted architectures.
app-emulation/qemu QEMU_SOFTMMU_TARGETS: aarch64 arm x86_64
app-emulation/qemu QEMU_USER_TARGETS: aarch64 arm x86_64
rc-update add qemu-binfmt default
rc-service qemu-binfmt start
- select chroot location (eg
- unpack the desired rootfs
- create needed directories
mkdir -p /chroots/gentoo-arm64-musl-stable/var/cache/distfiles
- with last
ro-bind mount the qemu emulator binary (eg
- execute the mounted emulator binary giving it a shell program (eg
--bind /chroots/gentoo-arm64-musl-stable / \
--dev /dev \
--proc /proc \
--perms 1777 --tmpfs /dev/shm \
--tmpfs /run \
--ro-bind /etc/resolv.conf /etc/resolv.conf \
--bind /var/cache/distfiles /var/cache/distfiles \
--ro-bind /usr/bin/qemu-aarch64 /usr/bin/qemu-aarch64 \
/usr/bin/qemu-aarch64 /bin/bash -l
By default you would probably have something like this, the user-mode network:
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
Bridges can be easily created using the NetworkManager’s TUI tool called
Bridge XML configuration for Libvirt
<address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
Be sure the following options are enabled (
and the following options are disabled (
Init basic functions
- be the first started process - PID 1
- continue running until the system is shut down
Why systemd is more than init
Full system management
systemd needs to run as PID 1 to parenthood other services and… other parts of itself (listed below).
- cron -> timers
- seat tracker -> systemd-logind
- service manager -> systemd-systemctl
- udev -> systemd-udevd
- system logger -> systemd-journald
- network manager -> systemd-networkd
- bootloader -> systemd-boot
- hostname -> systemd-hostnamed
- chroot -> systemd-nspawn
- resolv.conf generator -> systemd-resolved
Additionally systemd is also
- QR code generator
- http server (cockpit)
- home manager -> systemd-homed
- tmp manager -> systemd-tmpfiles
Why it's bad
systemd growth to cover more and more of other services capabilities is dangerous. It can mean that if we find a exploit in one part of systemd it will be easy to compromise the whole system. Actually, there is a even bigger problem - most of the time a user would like to run a standalone service covering one of the uses already covered by systemd - like cronie or rsyslog.
But what about cgroups
Cgroups are nothing new, they are available in other service managers too. Check out cgroups in OpenRC.
Primarily used by Gentoo based systems. Was adopted to Devuan and Artix. Alpine Linux uses it probably because it started out as a Gentoo-based system. Is also available in Debian - though that will still use some systemd services, notably systemd-udevd.
Avalible in Void Linux - the recommended init for that system.
Pure System V init
Most popular use of this is found in old CentOS, Slackware, Antix and MX Linux.
Check out Devuan if you want to dive into this topic.
systemd + Emacs
One could think that because systemd and Emacs cover a lot of things - systemd - system management and emacs - user utilities - a fusion of two would be very good and will lack so-called bloat. There is one "problem" however - Emacs can be used also as a init! And that doesn't necessarily mean a lot more code being added. So i guess Emacs + Linux (kernel) is the way to go ;P
Was systemd a inside job?
Probably not - Microsoft made their own init for Azure because… systemd was to big… systemd is a history of what happens when everybody wants to be like the rest - adoption of systemd.
Is systemd the new busybox?
This is an interesting concept. There is one bad thing however - you can compile bysybox with any of its utilities and it will work - you can't do that with systemd, you will have to modify and fork it - like eudev and elogind projects
Many people think of OpenRC as a old SysVinit. I encourage you to check it out and see that most stuff you probably do with systemd you can get from OpenRC (service manager) + cronie (cron/timers) + htop/pstree (full description of system as opposed to "systemctl status")
Basic OpenRC vs systemd commands
OpenRC systemd ————————— ————————— rc-status -a systemctl status rc-service SERVICE start systemctl start SERVICE rc-service SERVICE stop systemctl stop SERVICE rc-update add SERVICE systemctl enable SERVICE rc-update del SERVICE systemctl disable SERVICE