Re: [PATCH v3 01/14] host/rootfs: Install all programs from util-linuxMinimal

Demi Marie Obenour
2025-11-20T00:12:38Z

[-- Attachment #1.1.1: Type: text/plain, Size: 7301 bytes --]

On 11/19/25 09:14, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> Busybox fdisk doesn't support GPT, only MBR. Busybox programs are also
>> often buggy, so use the util-linux version where possible. This
>> requires disabling a lot of Busybox applets, so move the Busybox config
>> to a separate file that Nix loads via builtins.readFile.
>>
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>> ---
>> Changes since v2:
>> - Split installation of util-linux and of systemd to separate patches.
>> ---
>> host/rootfs/busybox-config | 134 +++++++++++++++++++++++++++++++++++++
>> host/rootfs/busybox-config.license | 4 ++
>> host/rootfs/default.nix | 36 +++-------
>> 3 files changed, 147 insertions(+), 27 deletions(-)
>>
>> diff --git a/host/rootfs/busybox-config b/host/rootfs/busybox-config
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..f2fd5fcab4141ea63c663e433412a253d5235aab
>> --- /dev/null
>> +++ b/host/rootfs/busybox-config
>> @@ -0,0 +1,134 @@
>> +CONFIG_ADDPART n
>> +CONFIG_AGETTY n
>> +CONFIG_BITS n
>> +CONFIG_BLKDISCARD n
>> +CONFIG_BLKID n
>> +CONFIG_BLKPR n
>> +CONFIG_BLKZONE n
>> +CONFIG_BLOCKDEV n
>> +CONFIG_CAL n
>> +CONFIG_CHATTR n
>> +CONFIG_CHCPU n
>> +CONFIG_CHMEM n
>> +CONFIG_CHOOM n
>> +CONFIG_CHRT n
>> +CONFIG_COLCRT n
>> +CONFIG_COLRM n
>> +CONFIG_COLUMN n
>> +CONFIG_CORESCHED n
>> +CONFIG_CTRLALTDEL n
>> +CONFIG_DELPART n
>> +CONFIG_DEPMOD n
>> +CONFIG_DMESG n
>> +CONFIG_EJECT n
>> +CONFIG_ENOSYS n
>> +CONFIG_EXCH n
>> +CONFIG_FADVISE n
>> +CONFIG_FALLOCATE n
>> +CONFIG_FDISK n
>> +CONFIG_FINCORE n
>> +CONFIG_FINDFS n
>> +CONFIG_FINDMNT n
>> +CONFIG_FLOCK n
>> +CONFIG_FSCK n
>> +CONFIG_FSCK_CRAMFS n
>> +CONFIG_FSCK_MINIX n
>> +CONFIG_FSFREEZE n
>> +CONFIG_FSTRIM n
>> +CONFIG_GETOPT n
>> +CONFIG_HALT n
>> +CONFIG_HARDLINK n
>> +CONFIG_HD n
>> +CONFIG_HEXDUMP n
>> +CONFIG_HWCLOCK n
>> +CONFIG_I386 n
>> +CONFIG_INIT n
>> +CONFIG_INSMOD n
>> +CONFIG_IONICE n
>> +CONFIG_IP n
>> +CONFIG_IPCMK n
>> +CONFIG_IPCRM n
>> +CONFIG_IPCS n
>> +CONFIG_ISOSIZE n
>> +CONFIG_KILL n
>> +CONFIG_LAST n
>> +CONFIG_LASTB n
>> +CONFIG_LDATTACH n
>> +CONFIG_LINUX32 n
>> +CONFIG_LINUX64 n
>> +CONFIG_LOGGER n
>> +CONFIG_LOOK n
>> +CONFIG_LOSETUP n
>> +CONFIG_LSATTR n
>> +CONFIG_LSBLK n
>> +CONFIG_LSCLOCKS n
>> +CONFIG_LSCPU n
>> +CONFIG_LSFD n
>> +CONFIG_LSIPC n
>> +CONFIG_LSIRQ n
>> +CONFIG_LSLOCKS n
>> +CONFIG_LSLOGINS n
>> +CONFIG_LSMEM n
>> +CONFIG_LSMOD n
>> +CONFIG_LSNS n
>> +CONFIG_MCOOKIE n
>> +CONFIG_MESG n
>> +CONFIG_MKE2FS n
>> +CONFIG_MKFS n
>> +CONFIG_MKFS_BFS n
>> +CONFIG_MKFS_CRAMFS n
>> +CONFIG_MKFS_EXT2 n
>> +CONFIG_MKFS_MINIX n
>> +CONFIG_MKSWAP n
>> +CONFIG_MODINFO n
>> +CONFIG_MODPROBE n
>> +CONFIG_MOUNT n
>> +CONFIG_MOUNTPOINT n
>> +CONFIG_NAMEI n
>> +CONFIG_NOLOGIN n
>> +CONFIG_NSENTER n
>> +CONFIG_PARTX n
>> +CONFIG_PIPESZ n
>> +CONFIG_PIVOT_ROOT n
>> +CONFIG_POWEROFF n
>> +CONFIG_PRLIMIT n
>> +CONFIG_READPROFILE n
>> +CONFIG_REBOOT n
>> +CONFIG_RENAME n
>> +CONFIG_RENICE n
>> +CONFIG_RESIZEPART n
>> +CONFIG_REV n
>> +CONFIG_RFKILL n
>> +CONFIG_RMMOD n
>> +CONFIG_RTCWAKE n
>> +CONFIG_SCRIPT n
>> +CONFIG_SCRIPTLIVE n
>> +CONFIG_SCRIPTREPLAY n
>> +CONFIG_SETARCH n
>> +CONFIG_SETPGID n
>> +CONFIG_SETPRIV n
>> +CONFIG_SETSID n
>> +CONFIG_SFDISK n
>> +CONFIG_SHUTDOWN n
>> +CONFIG_SULOGIN n
>> +CONFIG_SWAPLABEL n
>> +CONFIG_SWAPOFF n
>> +CONFIG_SWAPON n
>> +CONFIG_SWITCH_ROOT n
>> +CONFIG_TASKSET n
>> +CONFIG_UCLAMPSET n
>> +CONFIG_UMOUNT n
>> +CONFIG_UNAME26 n
>> +CONFIG_UNSHARE n
>> +CONFIG_UTMPDUMP n
>> +CONFIG_UUIDD n
>> +CONFIG_UUIDGEN n
>> +CONFIG_UUIDPARSE n
>> +CONFIG_WAITPID n
>> +CONFIG_WALL n
>> +CONFIG_WDCTL n
>> +CONFIG_WHEREIS n
>> +CONFIG_WIPEFS n
>> +CONFIG_WRITE n
>> +CONFIG_X86_64 n
>> +CONFIG_ZRAMCTL n
>> diff --git a/host/rootfs/busybox-config.license b/host/rootfs/busybox-config.license
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..ba50b647fbfac9b79ecb29f33a36c07d3e332ba2
>> --- /dev/null
>> +++ b/host/rootfs/busybox-config.license
>> @@ -0,0 +1,4 @@
>> +# SPDX-License-Identifier: MIT
>> +# SPDX-FileCopyrightText: 2021-2025 Alyssa Ross <hi@alyssa.is>
>> +# SPDX-FileCopyrightText: 2022 Unikie
>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>> diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
>> index 1578155fa0fb9a4df3fb4884e21ed7d8d8f821dc..84b536eda397adfab0fbb0122a5765571d7d678e 100644
>> --- a/host/rootfs/default.nix
>> +++ b/host/rootfs/default.nix
>> @@ -38,25 +38,8 @@ let
>> virtiofsd xdg-desktop-portal-spectrum-host
>>
>> (busybox.override {
>> - extraConfig = ''
>> - CONFIG_CHATTR n
>> - CONFIG_DEPMOD n
>> - CONFIG_FINDFS n
>> - CONFIG_HALT n
>> - CONFIG_INIT n
>> - CONFIG_INSMOD n
>> - CONFIG_IP n
>> - CONFIG_LSATTR n
>> - CONFIG_LSMOD n
>> - CONFIG_MKE2FS n
>> - CONFIG_MKFS_EXT2 n
>> - CONFIG_MODINFO n
>> - CONFIG_MODPROBE n
>> - CONFIG_MOUNT n
>> - CONFIG_POWEROFF n
>> - CONFIG_REBOOT n
>> - CONFIG_RMMOD n
>> - '';
>> + # Use a separate file as it is a bit too big.
>> + extraConfig = builtins.readFile ./busybox-config;
>> })
>>
>> # Take kmod from pkgsGui since we use pkgsGui.kmod.lib below anyway.
>> @@ -96,6 +79,12 @@ let
>> mkdir -p $out/usr/bin $out/usr/share/dbus-1/services \
>> $out/usr/share/icons/hicolor/20x20/apps
>>
>> + # lndir silently ignores existing links, so run it before ln
>> + # so that ln catches any duplicates.
>> + for pkg in ${escapeShellArgs usrPackages}; do
>> + lndir -ignorelinks -silent "$pkg" "$out/usr"
>> + done
>> +
>> # Weston doesn't support SVG icons.
>> inkscape -w 20 -h 20 \
>> -o $out/usr/share/icons/hicolor/20x20/apps/com.system76.CosmicFiles.png \
>> @@ -110,18 +99,11 @@ let
>> ln -st $out/usr/share/dbus-1/services \
>> ${pkgsGui.xdg-desktop-portal-gtk}/share/dbus-1/services/org.freedesktop.impl.portal.desktop.gtk.service
>>
>> - for pkg in ${escapeShellArgs usrPackages}; do
>> - lndir -ignorelinks -silent "$pkg" "$out/usr"
>> - done
>> + ln -st "$out/usr/bin" ${util-linuxMinimal}/bin/*
>
> Last time[1] I asked why this couldn't just be listed in the packages
> list like everything else. Would still like to know.
>
> [1]: https://spectrum-os.org/lists/archives/spectrum-devel/87ldkaglfc.fsf@alyssa.is

It can and should be listed there. I just forgot to make the change.

>> ${concatStrings (mapAttrsToList (name: path: ''
>> ln -s ${path} $out/usr/lib/spectrum/vm/${name}
>> '') appvms)}
>> -
>> - # TODO: this is a hack and we should just build the util-linux
>> - # programs we want.
>> - # https://lore.kernel.org/util-linux/87zgrl6ufb.fsf@alyssa.is/
>> - ln -s ${util-linuxMinimal}/bin/{findfs,uuidgen,lsblk,mount} $out/usr/bin
>> '';
>> in
>>
>>
>> --
>> 2.52.0
--
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]