patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Demi Marie Obenour <demiobenour@gmail.com>
Cc: Spectrum OS Development <devel@spectrum-os.org>
Subject: Re: [PATCH 08/20] Standardize directories and symlinks in images
Date: Fri, 19 Sep 2025 19:53:45 +0200	[thread overview]
Message-ID: <87zfaqqqfq.fsf@alyssa.is> (raw)
In-Reply-To: <d8ac360f-b16a-4c76-9b14-a0a04abe1c78@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3204 bytes --]

Demi Marie Obenour <demiobenour@gmail.com> writes:

> On 9/8/25 04:59, Alyssa Ross wrote:
>> Demi Marie Obenour <demiobenour@gmail.com> writes:
>> 
>>>  DIRS = \
>>> -	dev \
>>>  	etc/s6-linux-init/env \
>>>  	etc/s6-linux-init/run-image/configs \
>>>  	etc/s6-linux-init/run-image/service/dbus/instance \
>>> @@ -90,14 +89,11 @@ DIRS = \
>>>  	etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/instances \
>>>  	etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/data \
>>>  	etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/env \
>>> -	etc/s6-linux-init/run-image/user \
>>>  	etc/s6-linux-init/run-image/vm/by-id \
>>>  	etc/s6-linux-init/run-image/vm/by-name \
>>>  	etc/s6-linux-init/run-image/wait \
>>>  	ext \
>>> -	run \
>>> -	proc \
>>> -	sys \
>>> +	root \
>> 
>> I'm not sure what we'd want /root for?  Root's home directory is /.
>
> It is certainly /root on my systems.
>

On Spectrum it is not, because there's no need for an extraneous, empty,
read-only directory:

root:x:0:0:System administrator:/:/bin/sh

>>> diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh
>>> index d566a4ac7b30f55338fe9b8b6a94702686f6ddd1..5196394d405310971659b0dbc0c91cfcaaaf9118 100755
>>> --- a/scripts/make-erofs.sh
>>> +++ b/scripts/make-erofs.sh
>>> @@ -115,5 +115,39 @@ find "$root" \
>>>  find "$root/etc" "$root/var" ! -type l -execdir chmod u+w,go-w,ugo+rX -- '{}' +
>>>  chmod 0755 "$root"
>>>  
>>> +# Fix permissions on / so that the subsequent commands work
>>> +chmod 0755 "$root"
>>> +
>>> +# Create the basic mount points for pseudo-filesystems and tmpfs filesystems.
>>> +# These should always be mounted over, so use 0400 permissions for them.
>>> +# 0000 would be better, but it breaks mkfs.erofs as it tries to open the
>>> +# directories for reading.
>>> +mkdir -m 0400 "$root/dev" "$root/proc" "$root/run" "$root/sys" "$root/tmp"
>>> +
>>> +# Cause s6-linux-init to create /run/lock and /run/user
>>> +# with the correct mode (0755) and create /home,
>>> +# /var/cache, /var/log, and /var/spool directly.
>>> +mkdir -m 0755 \
>>> +	"$root/etc/s6-linux-init/run-image/lock" \
>>> +	"$root/etc/s6-linux-init/run-image/user" \
>>> +	"$root/home" \
>>> +	"$root/var/cache" \
>>> +	"$root/var/log" \
>>> +	"$root/var/spool"
>>> +
>>> +# Create symbolic links that are always expected to exist.
>>> +chmod 0755 "$root/usr"
>>> +ln -s ../proc/self/mounts "$root/etc/mtab"
>>> +ln -s ../run "$root/var/run"
>>> +ln -s ../run/lock "$root/var/lock"
>>> +ln -s ../tmp "$root/var/tmp"
>>> +ln -s bin "$root/usr/sbin"
>>> +ln -s lib "$root/usr/lib64"
>> 
>> This doesn't seem right as a generic thing.  Nix-built binaries won't
>> ever need this.  It's only in img/app for AppImage etc. compatibility.
>> Not relevant to other images.
>
> I decided it was better to add all of these now to avoid any sort of
> problems later on.  The size impact is tiny and the cost of debugging
> a problem later on would not be.  In particular, contributors not so
> used to NixOS might assume these exist.

I think they'll very quickly figure it out.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2025-09-19 17:53 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 21:26 [PATCH 00/20] Many image fixes and systemd integration Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 01/20] scripts/make-erofs.sh: Ensure that / is world-readable Demi Marie Obenour
2025-09-08  8:21   ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 02/20] scripts/make-erofs.sh: Do not read one byte at a time Demi Marie Obenour
2025-09-08  8:23   ` Alyssa Ross
2025-09-08 16:57     ` Demi Marie Obenour
2025-09-09 15:19       ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 03/20] scripts/make-erofs.sh: Avoid unneeded calls to awk and chmod Demi Marie Obenour
2025-09-08  8:28   ` Alyssa Ross
2025-09-08 17:14     ` Demi Marie Obenour
2025-09-10 18:45       ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 04/20] scripts/make-erofs.sh: Validate all paths Demi Marie Obenour
2025-09-08  8:36   ` Alyssa Ross
2025-09-08 18:21     ` Demi Marie Obenour
2025-09-10 18:54       ` Alyssa Ross
2025-09-21 12:09         ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 05/20] scripts/make-erofs.sh: Avoid unneeded calls to dirname Demi Marie Obenour
2025-09-10 20:04   ` Alyssa Ross
2025-09-10 20:06     ` Demi Marie Obenour
2025-09-19 16:47   ` Alyssa Ross
2025-09-19 19:04     ` Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 06/20] scripts/make-erofs.sh: Avoid unneeded calls to mkdir Demi Marie Obenour
2025-09-08  8:39   ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 07/20] scripts/make-erofs.sh: Standardize file modes in images Demi Marie Obenour
2025-09-08  8:46   ` Alyssa Ross
2025-09-08 17:16     ` Demi Marie Obenour
2025-09-19 17:50   ` Alyssa Ross
2025-09-19 19:18     ` Demi Marie Obenour
2025-09-21 12:23       ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 08/20] Standardize directories and symlinks " Demi Marie Obenour
2025-09-08  8:59   ` Alyssa Ross
2025-09-08 18:05     ` Demi Marie Obenour
2025-09-19 17:53       ` Alyssa Ross [this message]
2025-09-04 21:26 ` [PATCH 09/20] Add os-release file Demi Marie Obenour
2025-09-08  9:12   ` Alyssa Ross
2025-09-08 18:07     ` Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 10/20] host/rootfs: Set -eu in build Demi Marie Obenour
2025-09-08  9:13   ` Alyssa Ross
2025-09-08 18:08     ` Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 11/20] Add /dev/fd and /dev/std* Demi Marie Obenour
2025-09-08  9:18   ` Alyssa Ross
2025-09-08 18:12     ` Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 12/20] host/rootfs: Do not read from /dev/tty1 Demi Marie Obenour
2025-09-08  9:19   ` Alyssa Ross
2025-09-08 18:18     ` Demi Marie Obenour
2025-09-19 18:22       ` Alyssa Ross
2025-09-19 19:00         ` Demi Marie Obenour
2025-09-21  9:01           ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 13/20] host/rootfs: pass API socket as fd 3, not fd 0 Demi Marie Obenour
2025-09-08  9:44   ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 14/20] host/rootfs: Disable unneeded BusyBox tools Demi Marie Obenour
2025-09-08  9:24   ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 15/20] host/rootfs: Use real less, not BusyBox less Demi Marie Obenour
2025-09-08  9:25   ` Alyssa Ross
2025-09-08 18:16     ` Demi Marie Obenour
2025-09-19 18:45       ` Alyssa Ross
2025-09-19 19:01         ` Demi Marie Obenour
2025-09-21  9:02           ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 16/20] host/rootfs: explicitly set PATH in network add script Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 17/20] Use /etc/s6-rc/compiled for compiled s6-rc directory Demi Marie Obenour
2025-09-08  9:27   ` Alyssa Ross
2025-09-08 18:15     ` Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 18/20] host/rootfs: virtiofsd: Do not use FD 0 as the socket Demi Marie Obenour
2025-09-08  9:44   ` Alyssa Ross
2025-09-04 21:26 ` [PATCH 19/20] host/rootfs: Disable unneeded busybox stuff Demi Marie Obenour
2025-09-04 21:26 ` [PATCH 20/20] host/rootfs: Switch to systemd 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=87zfaqqqfq.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=demiobenour@gmail.com \
    --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).