Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

39.2. util-linux-2.42.4

Miscellaneous system utilities for Linux

Version 2.42.4, release 1
Shelf base — The minimal userland and system daemons that every KDOS image boots with
Phase 30_foundation (Build Foundation), 35 of 127 in build order
Licence GPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-3-Clause
Homepage https://github.com/util-linux/util-linux
Build time 0.8 SBU
Installed size 16.1 MiB in 421 files
Recipe ports/core/base/util-linux/kpkgbuild

About

util-linux is the collection of Linux system programs that are not part of coreutils: mount and umount, blkid, fdisk and sfdisk, losetup, swapon, switch_root, agetty and sulogin, dmesg, lsblk, setpriv, last, wall, kill and many more, and the libraries libblkid, libmount, libuuid, libfdisk, libsmartcols and liblastlog2.

On KDOS these are load-bearing at boot. The initramfs copies switch_root, mount, umount, losetup, dmesg, setsid and blkid and checks that each is util-linux’s (Tools that must be util-linux’s), every text-console login is answered by agetty, single-user mode is sulogin, and service scripts such as 86_kiwix-serve.sh drop privileges with setpriv. Many ports depend on its libraries, among them python3, glib, eudev, e2fsprogs and lvm2.

The build leaves out every program another package owns here. su, nologin, chsh and chfn are shadow’s, and login is util-linux-login’s, a second build of this tarball once PAM is installed; kpkg refuses to install a path a second package already claims (Who owns a file).

Why it is in KDOS

The comment above the 8 ports from skalibs to sed in script/phases/30_foundation/packages.txt:

utmps, the utmp and wtmp service over skalibs (shelves auth and base-libs): coreutils, sysvinit, util-linux and shadow build against it, and coreutils' depends installs both in the pinned run above, ahead of the other three.

Sources

Dependencies

Depends on: sqlite, ncurses, readline, zlib, libcap-ng, utmps.

Required by (57): aerc, btrfs-progs, cryptsetup, e2fsprogs, elogind, endless-sky, eudev, exfatprogs, f2fs-tools, fcitx5, fwupd, glib, glib-introspection, gnuhealth, gparted, gptfdisk, hfsprogs, horizon-eda, jfsutils, kcoreaddons, kdf, kinfocenter, kio, kpmcore, ledger, libblockdev, libewf, libgig, libSM, libvirt, linuxcnc, lvm2, maddy, ndctl, nfs-utils, ngircd, nilfs-utils, ntfs-3g, obs-studio, openldap, partclone, parted, postgresql, python3, qemu, radicale, samba, solid, taskwarrior, testdisk, tpm2-tss, udisks2, veracrypt, volume_key, xapian-core, xfsprogs, xmlto.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install util-linux'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base/util-linux.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/base/util-linux
echo 'fbd62a100ab7bb8746ba0661255c3c48185b1e9021507c624da01fbc696330ec  util-linux-2.42.4.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/util-linux
SRC=$SRC_ROOT/util-linux-2.42.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf util-linux-2.42.4.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/utmps-paths.patch"
./configure \
	--prefix=/usr \
	--disable-chfn-chsh \
	--disable-login \
	--disable-nologin \
	--disable-su \
	--enable-setpriv \
	--with-cap-ng \
	--disable-runuser \
	--disable-pylibmount \
	--without-python \
	--without-systemd \
	--without-systemdsystemunitdir \
	--without-udev \
	--disable-libmount-udev-support \
	--with-libz \
	--with-btrfs \
	--with-readline \
	--with-ncursesw \
	--enable-liblastlog2 \
	--without-libmagic \
	--disable-pam-lastlog2 \
	--without-econf \
	--without-user \
	--disable-asciidoc \
	--disable-poman \
	--disable-nls \
	--disable-makeinstall-chown \
	--disable-makeinstall-setuid \
	CPPFLAGS=-I/usr/include/utmps
make LIBS="-lutmps -lskarnet"
make LIBS="-lutmps -lskarnet" DESTDIR=$PKG install

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/util-linux, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf util-linux-2.42.4-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/util-linux, and runs the triggers its paths call for.

Contents

Installed programs: addpart, agetty, bits, blkdiscard, blkid, blkpr, blkzone, blockdev, cal, cfdisk, chcpu, chmem, choom, chrt, colcrt, colrm, column, copyfilerange, coresched, ctrlaltdel, delpart, dmesg, eject, enosys, exch, fadvise, fallocate, fdisk, fincore, findfs, findmnt, flock, fsck, fsck.cramfs, fsck.minix, fsfreeze, fstrim, getino, getopt, hardlink, hexdump, hwclock, i386, ionice, ipcmk, ipcrm, ipcs, irqtop, isosize, kill, last, lastb, lastlog2, ldattach, linux32, linux64, logger, look, losetup, lsblk, lsclocks, lscpu, lsfd, lsipc, lsirq, lslocks, lslogins, lsmem, lsns, mcookie, mesg, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap, more, mount, mountpoint, namei, nsenter, partx, pipesz, pivot_root, prlimit, readprofile, rename, renice, resizepart, rev, rfkill, rtcwake, script, scriptlive, scriptreplay, setarch, setpgid, setpriv, setsid, setterm, sfdisk, sulogin, swaplabel, swapoff, swapon, switch_root, taskset, uclampset, ul, umount, uname26, unshare, utmpdump, uuidd, uuidgen, uuidparse, waitpid, wall, wdctl, whereis, wipefs, x86_64, zramctl.

Installed libraries: libblkid.a, libblkid.so, libfdisk.a, libfdisk.so, liblastlog2.a, liblastlog2.so, libmount.a, libmount.so, libsmartcols.a, libsmartcols.so, libuuid.a, libuuid.so.

Installed directories: /usr/include/blkid, /usr/include/libfdisk, /usr/include/liblastlog2, /usr/include/libmount, /usr/include/libsmartcols, /usr/include/uuid, /usr/share/doc/util-linux, /usr/share/licenses/util-linux.

Short descriptions

addpart tell the kernel about the existence of a partition
agetty alternative Linux getty
bits convert bit masks or lists from/to various formats
blkdiscard discard sectors on a device
blkid locate/print block device attributes
blkpr run a persistent-reservations command on a device
blkzone run zone command on a device
blockdev call block device ioctls from the command line
cal display a calendar
cfdisk display or manipulate a disk partition table
chcpu configure CPUs
chmem configure memory
choom display or adjust OOM-killer score
chrt manipulate the real-time attributes of a process
colcrt filter nroff output for CRT previewing
colrm remove columns from a file
column columnate lists
copyfilerange copy range(s) from source to destination file
coresched manage core scheduling cookies for tasks
ctrlaltdel set the function of the Ctrl-Alt-Del combination
delpart tell the kernel to forget about a partition
dmesg print or control the kernel ring buffer
eject eject removable media
enosys utility to make syscalls fail with ENOSYS
exch atomically exchanges paths between two files
fadvise utility to use the *posix_fadvise*(2) system call
fallocate preallocate or deallocate space to a file
fdisk manipulate disk partition table
fincore count pages of file contents in core
findfs find a filesystem by label or UUID
findmnt find a filesystem
flock manage locks from shell scripts
fsck check and repair a Linux filesystem
fsck.cramfs fsck compressed ROM file system
fsck.minix check consistency of Minix filesystem
fsfreeze suspend access to a filesystem (Ext3/4, ReiserFS, JFS, XFS)
fstrim discard unused blocks on a mounted filesystem
getino print the unique inode number associated to a process file descriptor or namespace for a given PID
getopt parse command options (enhanced)
hardlink link multiple copies of a file
hexdump display file contents in hexadecimal, decimal, octal, or ascii
hwclock time clocks utility
ionice set or get process I/O scheduling class and priority
ipcmk make various IPC resources
ipcrm remove certain IPC resources
ipcs show information on IPC facilities
irqtop display kernel interrupt information
isosize output the length of an iso9660 filesystem
kill terminate a process
last show a listing of last logged in users
lastlog2 displays date of last login for all users or a specific one
ldattach attach a line discipline to a serial line
logger enter messages into the system log
look display lines beginning with a given string
losetup set up and control loop devices
lsblk list block devices
lsclocks display system clocks
lscpu display information about the CPU architecture
lsfd list file descriptors
lsipc show information on IPC facilities currently employed in the system
lsirq utility to display kernel interrupt information
lslocks list local system locks
lslogins display information about known users in the system
lsmem list the ranges of available memory with their online status
lsns list namespaces
mcookie generate magic cookies for xauth
mesg display (or do not display) messages from other users
mkfs build a Linux filesystem
mkfs.bfs make an SCO bfs filesystem
mkfs.cramfs make compressed ROM file system
mkfs.minix make a Minix filesystem
mkswap set up a Linux swap area
more display the contents of a file in a terminal
mount mount a filesystem
mountpoint see if a directory or file is a mountpoint
namei follow a pathname until a terminal point is found
nsenter run program in different namespaces
partx tell the kernel about the presence and numbering of on-disk partitions
pipesz set or examine pipe and FIFO buffer sizes
pivot_root change the root filesystem
prlimit get and set process resource limits
readprofile read kernel profiling information
rename rename files
renice alter priority of running processes
resizepart tell the kernel about the new size of a partition
rev reverse lines characterwise
rfkill tool for enabling and disabling wireless devices
rtcwake enter a system sleep state until specified wakeup time
script make typescript of terminal session
scriptlive re-run session typescripts, using timing information
scriptreplay play back typescripts, using timing information
setarch change reported architecture in new program environment and/or set personality flags
setpgid run a program in a new process group
setpriv run a program with different Linux privilege settings
setsid run a program in a new session
setterm set terminal attributes
sfdisk display or manipulate a disk partition table
sulogin single-user login
swaplabel print or change the label or UUID of a swap area
swapon enable/disable devices and files for paging and swapping
switch_root switch to another filesystem as the root of the mount tree
taskset set or retrieve a processs CPU affinity
uclampset manipulate the utilization clamping attributes of the system or a process
ul do underlining
umount unmount filesystems
unshare run program in new namespaces
utmpdump dump UTMP and WTMP files in raw format
uuidd UUID generation daemon
uuidgen create a new UUID value
uuidparse a utility to parse unique identifiers
waitpid utility to wait for arbitrary processes
wall write a message to all users
wdctl show hardware watchdog status
whereis locate the binary, source, and manual page files for a command
wipefs wipe a signature from a device
zramctl set up and control zram devices
blkid.pc Block device id library
fdisk.pc fdisk library
lastlog2.pc Y2038 safe version of lastlog
mount.pc mount library
smartcols.pc table or tree library
uuid.pc Universally unique id library

Notes

blkid, losetup and switch_root live in /usr/sbin. A second copy of any of them under /usr/bin, which $PATH searches first, would shadow util-linux’s everywhere except in the initramfs, which copies them by full path.

agetty built against musl has no issue-directory support, since musl has no scandirat(), and that build reads no issue file unless --issue-file names one. The agetty command lines in /etc/inittab and kdos-dm pass --issue-file /etc/issue.