patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Subject: [PATCH 2/5] host/rootfs: install shadow
Date: Tue,  9 Dec 2025 09:56:25 +0100	[thread overview]
Message-ID: <20251209085628.603316-2-hi@alyssa.is> (raw)
In-Reply-To: <20251209085628.603316-1-hi@alyssa.is>

Busybox's adduser is hardcoded to operate on /etc/passwd and create
/etc/passwd+ as a temporary file, which won't work for us with
read-only /.  Shadow's useradd supports specifying a prefix, so it
will be able to operate on /run/etc/passwd and create sibling
temporary files.  This will let us create new users at runtime.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 host/rootfs/busybox-config |  3 +++
 host/rootfs/default.nix    | 11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/host/rootfs/busybox-config b/host/rootfs/busybox-config
index f2fd5fc..1868773 100644
--- a/host/rootfs/busybox-config
+++ b/host/rootfs/busybox-config
@@ -11,6 +11,7 @@ CONFIG_CHATTR n
 CONFIG_CHCPU n
 CONFIG_CHMEM n
 CONFIG_CHOOM n
+CONFIG_CHPASSWD n
 CONFIG_CHRT n
 CONFIG_COLCRT n
 CONFIG_COLRM n
@@ -57,6 +58,7 @@ CONFIG_LDATTACH n
 CONFIG_LINUX32 n
 CONFIG_LINUX64 n
 CONFIG_LOGGER n
+CONFIG_LOGIN n
 CONFIG_LOOK n
 CONFIG_LOSETUP n
 CONFIG_LSATTR n
@@ -88,6 +90,7 @@ CONFIG_NAMEI n
 CONFIG_NOLOGIN n
 CONFIG_NSENTER n
 CONFIG_PARTX n
+CONFIG_PASSWD n
 CONFIG_PIPESZ n
 CONFIG_PIVOT_ROOT n
 CONFIG_POWEROFF n
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index abdd8b2..d86d8cc 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -13,7 +13,7 @@ pkgsMusl.callPackage (
 , btrfs-progs, bubblewrap, busybox, cloud-hypervisor, cosmic-files
 , crosvm, cryptsetup, dejavu_fonts, dbus, execline, foot, fuse3
 , iproute2, inotify-tools, jq, kmod, mdevd, mesa, mount-flatpak, s6
-, s6-linux-init, socat, systemd, util-linuxMinimal, virtiofsd
+, s6-linux-init, shadow, socat, systemd, util-linuxMinimal, virtiofsd
 , westonLite, xdg-desktop-portal, xdg-desktop-portal-gtk
 , xdg-desktop-portal-spectrum-host
 }:
@@ -27,8 +27,8 @@ let
   packages = [
     btrfs-progs bubblewrap cloud-hypervisor cosmic-files crosvm cryptsetup dbus
     execline fuse3 inotify-tools iproute2 jq kmod mdevd mount-flatpak s6
-    s6-linux-init s6-rc socat spectrum-host-tools spectrum-router
-    util-linuxMinimal virtiofsd xdg-desktop-portal-spectrum-host
+    s6-linux-init s6-rc shadow socat spectrum-host-tools spectrum-router
+    virtiofsd xdg-desktop-portal-spectrum-host
 
     (foot.override { allowPgo = false; })
 
@@ -36,6 +36,11 @@ let
       # Use a separate file as it is a bit too big.
       extraConfig = builtins.readFile ./busybox-config;
     })
+
+    (util-linuxMinimal.overrideAttrs ({ configureFlags ? [], ... }: {
+      # Conflicts with shadow.
+      configureFlags = configureFlags ++ [ "--disable-nologin" ];
+    }))
   ];
 
   nixosAllHardware = nixos ({ modulesPath, ... }: {
-- 
2.51.0


  reply	other threads:[~2025-12-09  8:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09  8:56 [PATCH 1/5] host/rootfs: make passwd and group links into /run Alyssa Ross
2025-12-09  8:56 ` Alyssa Ross [this message]
2025-12-09  8:56 ` [PATCH 3/5] host/rootfs: move Wayland out of XDG_RUNTIME_DIR Alyssa Ross
2025-12-09  8:56 ` [PATCH 4/5] host/rootfs: weston: add XDG_RUNTIME_DIR note Alyssa Ross
2025-12-09  8:56 ` [PATCH 5/5] host/rootfs: add wayland group Alyssa Ross
2025-12-09 10:55   ` Demi Marie Obenour
2025-12-09 10:59     ` Alyssa Ross
2025-12-09 11:02       ` Demi Marie Obenour
2025-12-09 11:09         ` Alyssa Ross
2025-12-09 10:42 ` [PATCH 6/6] host/rootfs: run crosvm device gpu as non-root Alyssa Ross
2025-12-09 10:52 ` [PATCH 1/5] host/rootfs: make passwd and group links into /run Demi Marie Obenour
2025-12-09 10:57   ` Alyssa Ross
2025-12-09 11:03     ` Demi Marie Obenour
2025-12-09 11:11       ` Alyssa Ross
2025-12-09 11:15         ` Demi Marie Obenour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251209085628.603316-2-hi@alyssa.is \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).