patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH 1/4] host/rootfs: make fs root directories shared
@ 2025-12-13 16:16 Alyssa Ross
  2025-12-13 16:16 ` [PATCH 2/4] host/rootfs: give VMs a disk-backed directory Alyssa Ross
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alyssa Ross @ 2025-12-13 16:16 UTC (permalink / raw)
  To: devel

We want every mount under here to show up inside the virtiofsd
sandbox.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 host/rootfs/image/usr/bin/create-vm-dependencies | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/host/rootfs/image/usr/bin/create-vm-dependencies b/host/rootfs/image/usr/bin/create-vm-dependencies
index 9e123fcf..6bf12d03 100755
--- a/host/rootfs/image/usr/bin/create-vm-dependencies
+++ b/host/rootfs/image/usr/bin/create-vm-dependencies
@@ -30,8 +30,8 @@ if {
 
   # Needs to be shared so that additional mounts under config/ (e.g. from
   # mount-flatpak) will be propagated into the virtiofsd sandbox.
-  if { mount --make-shared --rbind -o nofail /proc/self/fd/3/fs /run/fs/${1}/config }
-  if { mount --rbind -o ro /run/fs/${1} /run/fs/${1} }
+  if { mount --make-shared --rbind -o ro /run/fs/${1} /run/fs/${1} }
+  if { mount --rbind -o nofail /proc/self/fd/3/fs /run/fs/${1}/config }
 
   # Needs to be shared so that when xdg-document-portal mounts its fuse
   # filesystem at /run/doc/${1}/doc, it will propagate to /run/fs/${1}/doc.

base-commit: ce1cfde4bf845cb1104e0eddc4128a2c3d517fb0
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] host/rootfs: give VMs a disk-backed directory
  2025-12-13 16:16 [PATCH 1/4] host/rootfs: make fs root directories shared Alyssa Ross
@ 2025-12-13 16:16 ` Alyssa Ross
  2025-12-13 16:16 ` [PATCH 3/4] host/rootfs: clean up obsolete tmp dirs on VM exit Alyssa Ross
  2025-12-13 16:16 ` [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount Alyssa Ross
  2 siblings, 0 replies; 6+ messages in thread
From: Alyssa Ross @ 2025-12-13 16:16 UTC (permalink / raw)
  To: devel

This is the first step towards persistent VM data.  For now, these
directories are never reused, and also don't get cleaned up.  Both are
things to work on in future.  Even without persistence, it's good to
not have to store everything a VM might write into its home directory
in RAM.

For AppImage and Flatpak VMs, disk-backed directories are stored on
the partition containing the AppImage or Flatpak, in the new Spectrum/
hierarchy.  This will enable locating them for later reuse.  System
VMs, on the other hand, don't have a natural partition to store data
on — there may not even be a writable partition at the time they're
launched.  Since we don't expect persistence from system VMs, we just
use a directory on a tmpfs for their "disk-backed" directories.  Doing
it this way avoids the need for multiple routes in img/app — it can
always assume it gets a "disk" directory from the host.  For manually
imported VMs, it's up to the user where these directories should be.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 .../using-spectrum/creating-custom-vms.adoc   | 10 ++++++---
 host/rootfs/image/etc/s6-rc/sys-vmms/up       |  4 +++-
 .../image/usr/bin/create-vm-dependencies      |  1 +
 host/rootfs/image/usr/bin/run-appimage        | 22 +++++++++++++++----
 host/rootfs/image/usr/bin/run-flatpak         | 15 ++++++++++++-
 host/rootfs/image/usr/bin/vm-import           | 12 +++++++++-
 img/app/Makefile                              |  2 +-
 img/app/image/etc/fstab                       |  1 -
 img/app/image/etc/s6-rc/app/run               |  7 +++---
 img/app/scripts/start-virtiofsd.elb           |  2 +-
 release/checks/integration/lib.c              |  3 ++-
 release/checks/integration/networking.c       |  2 +-
 release/checks/integration/portal.c           |  2 +-
 13 files changed, 64 insertions(+), 19 deletions(-)

diff --git a/Documentation/using-spectrum/creating-custom-vms.adoc b/Documentation/using-spectrum/creating-custom-vms.adoc
index 229c0140..68213c89 100644
--- a/Documentation/using-spectrum/creating-custom-vms.adoc
+++ b/Documentation/using-spectrum/creating-custom-vms.adoc
@@ -13,9 +13,13 @@ configurations are directories under a dedicated parent directory, and
 the name of each configuration directory determines the name of
 the VM.  After mounting the persistent storage partition, the
 configured VMs can be made available by running `vm-import user
-/media/4e43cdc2-82b2-4d94-8a90-b6c6189312d2/vms`, replacing
-/media/4e43cdc2-82b2-4d94-8a90-b6c6189312d2/vms with the directory
-containing the VM definitions.
+/media/4e43cdc2-82b2-4d94-8a90-b6c6189312d2/vms
+/media/4e43cdc2-82b2-4d94-8a90-b6c6189312d2/Spectrum/data/spectrum/storage`,
+replacing /media/4e43cdc2-82b2-4d94-8a90-b6c6189312d2/vms with the
+directory containing the VM definitions, and
+/media/4e43cdc2-82b2-4d94-8a90-b6c6189312d2/Spectrum/data/spectrum/storage
+with the directory where disk-backed directories for the VMs should be
+created.
 
 The directory can contain the following files:
 
diff --git a/host/rootfs/image/etc/s6-rc/sys-vmms/up b/host/rootfs/image/etc/s6-rc/sys-vmms/up
index e055de93..7d3ac5ef 100644
--- a/host/rootfs/image/etc/s6-rc/sys-vmms/up
+++ b/host/rootfs/image/etc/s6-rc/sys-vmms/up
@@ -1,4 +1,6 @@
 # SPDX-License-Identifier: EUPL-1.2+
 # SPDX-FileCopyrightText: 2024 Alyssa Ross <hi@alyssa.is>
 
-vm-import sys /usr/lib/spectrum/vm
+if { install -do fs -g fs /run/sys-vm-disk }
+
+vm-import sys /usr/lib/spectrum/vm /run/sys-vm-disk
diff --git a/host/rootfs/image/usr/bin/create-vm-dependencies b/host/rootfs/image/usr/bin/create-vm-dependencies
index 6bf12d03..b7545425 100755
--- a/host/rootfs/image/usr/bin/create-vm-dependencies
+++ b/host/rootfs/image/usr/bin/create-vm-dependencies
@@ -6,6 +6,7 @@ if {
   mkdir -p
     /run/doc/${1}/doc
     /run/fs/${1}/config
+    /run/fs/${1}/disk
     /run/fs/${1}/doc
     /run/vm/by-id/${1}/ns
 }
diff --git a/host/rootfs/image/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage
index b9464f8b..f62844f8 100755
--- a/host/rootfs/image/usr/bin/run-appimage
+++ b/host/rootfs/image/usr/bin/run-appimage
@@ -25,6 +25,18 @@ if {
   if { create-vm-dependencies $id }
 }
 
+backtick diskdir {
+  s6-setuidgid fs
+
+  backtick -E mountpoint {
+    importas -Siu 1
+    findmnt -no TARGET -T $1
+  }
+
+  if { mkdir -p -- ${mountpoint}/Spectrum/data/spectrum/storage }
+  mktemp -d -- ${mountpoint}/Spectrum/data/spectrum/storage/tmp.XXXXXX
+}
+
 if {
   s6-envuidgid fs
   s6-applyuidgid -Uzu 0
@@ -32,15 +44,17 @@ if {
   multisubstitute {
     importas -Siu id
     importas -Siu 1
+    importas -Siu diskdir
   }
 
   nsenter --preserve-credentials -S0
     --mount=/run/vm/by-id/${id}/ns/mnt
     --user=/run/vm/by-id/${id}/ns/user
-  cd /run/fs/${id}/config
-  if { redirfd -w 1 type echo appimage }
-  if { touch run }
-  mount --bind $1 run
+  cd /run/fs/${id}
+  if { redirfd -w 1 config/type echo appimage }
+  if { touch config/run }
+  if { mount --bind $1 config/run }
+  mount --bind -- $diskdir disk
 }
 
 importas -Siu id
diff --git a/host/rootfs/image/usr/bin/run-flatpak b/host/rootfs/image/usr/bin/run-flatpak
index 2d3e7ea0..9a7ffa33 100755
--- a/host/rootfs/image/usr/bin/run-flatpak
+++ b/host/rootfs/image/usr/bin/run-flatpak
@@ -25,21 +25,34 @@ if {
   if { create-vm-dependencies $id }
 }
 
+backtick diskdir {
+  s6-setuidgid fs
+
+  importas -Siu 1
+
+  if { mkdir -p -- ${1}/Spectrum/data/spectrum/storage }
+  mktemp -d -- ${1}/Spectrum/data/spectrum/storage/tmp.XXXXXX
+}
+
 if {
   s6-envuidgid fs
   s6-applyuidgid -Uzu 0
 
   multisubstitute {
     importas -Siu id
+    importas -Siu diskdir
     elgetpositionals
   }
 
   nsenter --preserve-credentials -S0
     --mount=/run/vm/by-id/${id}/ns/mnt
     --user=/run/vm/by-id/${id}/ns/user
+
   cd /run/fs/${id}/config
   if { redirfd -w 1 type echo flatpak }
-  mount-flatpak $@
+  if { mount-flatpak $@ }
+
+  mount --bind -- $diskdir /run/fs/${id}/disk
 }
 
 importas -Siu id
diff --git a/host/rootfs/image/usr/bin/vm-import b/host/rootfs/image/usr/bin/vm-import
index 014eab87..209be787 100755
--- a/host/rootfs/image/usr/bin/vm-import
+++ b/host/rootfs/image/usr/bin/vm-import
@@ -1,4 +1,4 @@
-#!/bin/execlineb -S2
+#!/bin/execlineb -S3
 # SPDX-License-Identifier: EUPL-1.2+
 # SPDX-FileCopyrightText: 2023-2024 Alyssa Ross <hi@alyssa.is>
 
@@ -20,4 +20,14 @@ if { ln -s -- /run/service/vmm/instance/${id} /run/vm/by-id/${id}/service }
 
 if { create-vm-dependencies $id }
 
+if {
+  s6-envuidgid fs
+  s6-applyuidgid -Uzu 0
+  nsenter --preserve-credentials -S0
+    --mount=/run/vm/by-id/${id}/ns/mnt
+    --user=/run/vm/by-id/${id}/ns/user
+  backtick -E diskdir { mktemp -d -- ${3}/tmp.XXXXXX }
+  mount --bind -- ${diskdir} /run/fs/${id}/disk
+}
+
 s6-instance-create -- /run/service/vmm $id
diff --git a/img/app/Makefile b/img/app/Makefile
index 7e3d05b2..2e720a91 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -30,7 +30,7 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
 	    build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
 	mv $@.tmp $@
 
-DIRS = dev home/user host run mnt proc sys tmp \
+DIRS = dev host run mnt proc sys tmp \
 	etc/s6-linux-init/run-image/pipewire \
 	etc/s6-linux-init/run-image/service \
 	etc/s6-linux-init/run-image/user \
diff --git a/img/app/image/etc/fstab b/img/app/image/etc/fstab
index 5f78ab87..f51eace0 100644
--- a/img/app/image/etc/fstab
+++ b/img/app/image/etc/fstab
@@ -5,4 +5,3 @@ devpts	/dev/pts	devpts	nosuid,noexec,gid=5,mode=620	0	0
 tmpfs	/dev/shm	tmpfs	nosuid,nodev				0	0
 sysfs	/sys		sysfs	nosuid,nodev,noexec			0	0
 tmpfs	/tmp		tmpfs	nosuid,nodev				0	0
-tmpfs	/home/user	tmpfs	nodev,mode=0700,uid=1000,gid=1000	0	0
diff --git a/img/app/image/etc/s6-rc/app/run b/img/app/image/etc/s6-rc/app/run
index f91877d4..f36d153c 100755
--- a/img/app/image/etc/s6-rc/app/run
+++ b/img/app/image/etc/s6-rc/app/run
@@ -4,11 +4,12 @@
 
 export TMPDIR /run
 
-export HOME /home/user
-cd /home/user
-
 if { /etc/mdev/wait virtiofs-host }
 
+if { install -do user -g user /host/disk/home }
+export HOME /host/disk/home
+cd /host/disk/home
+
 foreground {
   redirfd -r 0 /host/config/type
   withstdinas -E type
diff --git a/img/app/scripts/start-virtiofsd.elb b/img/app/scripts/start-virtiofsd.elb
index 9efb436b..d861a22b 100755
--- a/img/app/scripts/start-virtiofsd.elb
+++ b/img/app/scripts/start-virtiofsd.elb
@@ -7,7 +7,7 @@ background {
   if { mkdir -p build/fs }
   unshare -rUm
   if { mount -t tmpfs -o nosuid,nodev fs build/fs }
-  if { mkdir build/fs/config }
+  if { mkdir build/fs/config build/fs/disk }
   if { importas -Si CONFIG mount --rbind -- ${CONFIG}/fs build/fs/config }
   unshare --map-user 1000 --map-group 1000
   importas -SsD virtiofsd VIRTIOFSD
diff --git a/release/checks/integration/lib.c b/release/checks/integration/lib.c
index 51f6bae7..3dcce471 100644
--- a/release/checks/integration/lib.c
+++ b/release/checks/integration/lib.c
@@ -195,6 +195,7 @@ struct vm *start_qemu(struct config c)
 		"-drive", nullptr,
 		"-drive", nullptr,
 		"-smbios", nullptr,
+		"-snapshot",
 		"-m", "4G",
 		"-nodefaults",
 		"-machine", "virtualization=on",
@@ -242,7 +243,7 @@ struct vm *start_qemu(struct config c)
 
 		if (asprintf(efi_arg, "file=%s,format=raw,if=pflash,readonly=true", c.drives.efi) == -1 ||
 		    asprintf(img_arg, "file=%s,format=raw,if=virtio,readonly=true", c.drives.img) == -1 ||
-		    asprintf(user_data_arg, "file=%s,format=raw,if=virtio,readonly=true", c.drives.user_data) == -1 ||
+		    asprintf(user_data_arg, "file=%s,format=raw,if=virtio", c.drives.user_data) == -1 ||
 		    asprintf(console_arg, "type=11,value=io.systemd.stub.kernel-cmdline-extra=%s%s",
 		             c.serial.console ? "console=" : "",
 		             c.serial.console ? c.serial.console : "") == -1) {
diff --git a/release/checks/integration/networking.c b/release/checks/integration/networking.c
index 078e31fc..6450d2d2 100644
--- a/release/checks/integration/networking.c
+++ b/release/checks/integration/networking.c
@@ -151,7 +151,7 @@ void test(struct config c)
 	          "mkdir /run/mnt && "
 	          "mount \"$(findfs UUID=a7834806-2f82-4faf-8ac4-4f8fd8a474ca)\" /run/mnt && "
 	          "s6-rc -bu change vmm-env && "
-	          "vm-import user /run/mnt/vms && "
+	          "vm-import user /run/mnt/vms /run/sys-vm-disk && "
 	          "vm-start \"$(basename \"$(readlink /run/vm/by-name/user.nc)\")\" && "
 	          "tail -Fc +0 /run/log/current /run/*.log &\n",
 	          vm_console_writer(vm)) == EOF) {
diff --git a/release/checks/integration/portal.c b/release/checks/integration/portal.c
index 6ba5654a..97a06738 100644
--- a/release/checks/integration/portal.c
+++ b/release/checks/integration/portal.c
@@ -16,7 +16,7 @@ void test(struct config c)
 	          "mkdir /run/mnt && "
 	          "mount \"$(findfs UUID=a7834806-2f82-4faf-8ac4-4f8fd8a474ca)\" /run/mnt && "
 	          "s6-rc -bu change vmm-env && "
-	          "vm-import user /run/mnt/vms && "
+	          "vm-import user /run/mnt/vms /run/sys-vm-disk && "
 	          "(tail -Fc +0 /run/*.log &) && "
 	          "s6-svc -O /run/vm/by-name/user.portal/service && "
 	          "vm-start \"$(basename \"$(readlink /run/vm/by-name/user.portal)\")\" && "
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] host/rootfs: clean up obsolete tmp dirs on VM exit
  2025-12-13 16:16 [PATCH 1/4] host/rootfs: make fs root directories shared Alyssa Ross
  2025-12-13 16:16 ` [PATCH 2/4] host/rootfs: give VMs a disk-backed directory Alyssa Ross
@ 2025-12-13 16:16 ` Alyssa Ross
  2025-12-13 16:16 ` [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount Alyssa Ross
  2 siblings, 0 replies; 6+ messages in thread
From: Alyssa Ross @ 2025-12-13 16:16 UTC (permalink / raw)
  To: devel

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 host/rootfs/image/usr/bin/run-appimage | 7 +++++--
 host/rootfs/image/usr/bin/run-flatpak  | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/host/rootfs/image/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage
index f62844f8..de851c52 100755
--- a/host/rootfs/image/usr/bin/run-appimage
+++ b/host/rootfs/image/usr/bin/run-appimage
@@ -57,7 +57,10 @@ if {
   mount --bind -- $diskdir disk
 }
 
-importas -Siu id
+multisubstitute {
+  importas -Siu diskdir
+  importas -Siu id
+}
 
 piperw 4 3
 background {
@@ -76,4 +79,4 @@ fdclose 3
 if { s6-instance-delete /run/service/vm-services $id }
 
 if { umount -R /run/vm/by-id/${id}/ns }
-rm -r /run/vm/by-id/${id} /run/configs/${id}
+rm -r -- $diskdir /run/vm/by-id/${id} /run/configs/${id}
diff --git a/host/rootfs/image/usr/bin/run-flatpak b/host/rootfs/image/usr/bin/run-flatpak
index 9a7ffa33..b47204c9 100755
--- a/host/rootfs/image/usr/bin/run-flatpak
+++ b/host/rootfs/image/usr/bin/run-flatpak
@@ -55,7 +55,10 @@ if {
   mount --bind -- $diskdir /run/fs/${id}/disk
 }
 
-importas -Siu id
+multisubstitute {
+  importas -Siu diskdir
+  importas -Siu id
+}
 
 if {
   piperw 4 3
@@ -75,4 +78,4 @@ if {
 if { s6-instance-delete -- /run/service/vm-services $id }
 
 if { umount -R /run/vm/by-id/${id}/ns }
-rm -r /run/vm/by-id/${id} /run/configs/${id}
+rm -r -- $diskdir /run/vm/by-id/${id} /run/configs/${id}
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount
  2025-12-13 16:16 [PATCH 1/4] host/rootfs: make fs root directories shared Alyssa Ross
  2025-12-13 16:16 ` [PATCH 2/4] host/rootfs: give VMs a disk-backed directory Alyssa Ross
  2025-12-13 16:16 ` [PATCH 3/4] host/rootfs: clean up obsolete tmp dirs on VM exit Alyssa Ross
@ 2025-12-13 16:16 ` Alyssa Ross
  2025-12-13 20:37   ` Demi Marie Obenour
  2 siblings, 1 reply; 6+ messages in thread
From: Alyssa Ross @ 2025-12-13 16:16 UTC (permalink / raw)
  To: devel

In the ideal case, these will be cleaned up when the VM running them
exits, but there's always the possibility that there are some left
over, in which case mount time is the perfect time to clean up, when
we can be reasonably sure nothing else is still accessing them.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 host/rootfs/image/usr/bin/mount-userdata | 36 ++++++++++++++++--------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/host/rootfs/image/usr/bin/mount-userdata b/host/rootfs/image/usr/bin/mount-userdata
index 6e4ac47d..2e130b83 100755
--- a/host/rootfs/image/usr/bin/mount-userdata
+++ b/host/rootfs/image/usr/bin/mount-userdata
@@ -7,18 +7,32 @@ backtick -D "" uuid {
   blkid -o value -s UUID -- $1
 }
 
-multisubstitute {
-  importas -Siu 0
-  importas -Siu 1
-  importas -Siu uuid
-}
-
-case $uuid {
-  "" {
-    fdmove -c 1 2
-    printf "%s: '%s' does not have a UUID\n" $0 $1
+if {
+  multisubstitute {
+    importas -Siu 0
+    importas -Siu 1
+    importas -Siu uuid
   }
+
+  case $uuid {
+    "" {
+      fdmove -c 1 2
+      printf "%s: '%s' does not have a UUID\n" $0 $1
+    }
+  }
+
+  mount -m -t btrfs -o nosuid,nodev,noexec,nosymfollow -- $1 /media/${uuid}
+}
+
+importas -Siu uuid
+
+if {
+  if -t { test -d /media/${uuid}/Spectrum/data/spectrum/storage }
+  find /media/${uuid}/Spectrum/data/spectrum/storage
+    -mindepth 1
+    -maxdepth 1
+    -name tmp.*
+    -exec rm -rf -- {} ;
 }
 
-if { mount -m -t btrfs -o nosuid,nodev,noexec,nosymfollow -- $1 /media/${uuid} }
 printf "%s\n" /media/${uuid}
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount
  2025-12-13 16:16 ` [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount Alyssa Ross
@ 2025-12-13 20:37   ` Demi Marie Obenour
  2025-12-13 20:43     ` Alyssa Ross
  0 siblings, 1 reply; 6+ messages in thread
From: Demi Marie Obenour @ 2025-12-13 20:37 UTC (permalink / raw)
  To: Alyssa Ross, devel


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

On 12/13/25 11:16, Alyssa Ross wrote:
> In the ideal case, these will be cleaned up when the VM running them
> exits, but there's always the possibility that there are some left
> over, in which case mount time is the perfect time to clean up, when
> we can be reasonably sure nothing else is still accessing them.
> 
> Signed-off-by: Alyssa Ross <hi@alyssa.is>
> ---
>  host/rootfs/image/usr/bin/mount-userdata | 36 ++++++++++++++++--------
>  1 file changed, 25 insertions(+), 11 deletions(-)
> 
> diff --git a/host/rootfs/image/usr/bin/mount-userdata b/host/rootfs/image/usr/bin/mount-userdata
> index 6e4ac47d..2e130b83 100755
> --- a/host/rootfs/image/usr/bin/mount-userdata
> +++ b/host/rootfs/image/usr/bin/mount-userdata
> @@ -7,18 +7,32 @@ backtick -D "" uuid {
>    blkid -o value -s UUID -- $1
>  }
>  
> -multisubstitute {
> -  importas -Siu 0
> -  importas -Siu 1
> -  importas -Siu uuid
> -}
> -
> -case $uuid {
> -  "" {
> -    fdmove -c 1 2
> -    printf "%s: '%s' does not have a UUID\n" $0 $1
> +if {
> +  multisubstitute {
> +    importas -Siu 0
> +    importas -Siu 1
> +    importas -Siu uuid
>    }
> +
> +  case $uuid {
> +    "" {
> +      fdmove -c 1 2
> +      printf "%s: '%s' does not have a UUID\n" $0 $1

Is continuing after printing this error intentional?

> +    }
> +  }
> +
> +  mount -m -t btrfs -o nosuid,nodev,noexec,nosymfollow -- $1 /media/${uuid}
> +}
> +
> +importas -Siu uuid
> +
> +if {
> +  if -t { test -d /media/${uuid}/Spectrum/data/spectrum/storage }
> +  find /media/${uuid}/Spectrum/data/spectrum/storage
> +    -mindepth 1
> +    -maxdepth 1
> +    -name tmp.*
> +    -exec rm -rf -- {} ;
>  }
>  
> -if { mount -m -t btrfs -o nosuid,nodev,noexec,nosymfollow -- $1 /media/${uuid} }
>  printf "%s\n" /media/${uuid}

-- 
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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount
  2025-12-13 20:37   ` Demi Marie Obenour
@ 2025-12-13 20:43     ` Alyssa Ross
  0 siblings, 0 replies; 6+ messages in thread
From: Alyssa Ross @ 2025-12-13 20:43 UTC (permalink / raw)
  To: Demi Marie Obenour; +Cc: devel

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

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

> On 12/13/25 11:16, Alyssa Ross wrote:
>> In the ideal case, these will be cleaned up when the VM running them
>> exits, but there's always the possibility that there are some left
>> over, in which case mount time is the perfect time to clean up, when
>> we can be reasonably sure nothing else is still accessing them.
>> 
>> Signed-off-by: Alyssa Ross <hi@alyssa.is>
>> ---
>>  host/rootfs/image/usr/bin/mount-userdata | 36 ++++++++++++++++--------
>>  1 file changed, 25 insertions(+), 11 deletions(-)
>> 
>> diff --git a/host/rootfs/image/usr/bin/mount-userdata b/host/rootfs/image/usr/bin/mount-userdata
>> index 6e4ac47d..2e130b83 100755
>> --- a/host/rootfs/image/usr/bin/mount-userdata
>> +++ b/host/rootfs/image/usr/bin/mount-userdata
>> @@ -7,18 +7,32 @@ backtick -D "" uuid {
>>    blkid -o value -s UUID -- $1
>>  }
>>  
>> -multisubstitute {
>> -  importas -Siu 0
>> -  importas -Siu 1
>> -  importas -Siu uuid
>> -}
>> -
>> -case $uuid {
>> -  "" {
>> -    fdmove -c 1 2
>> -    printf "%s: '%s' does not have a UUID\n" $0 $1
>> +if {
>> +  multisubstitute {
>> +    importas -Siu 0
>> +    importas -Siu 1
>> +    importas -Siu uuid
>>    }
>> +
>> +  case $uuid {
>> +    "" {
>> +      fdmove -c 1 2
>> +      printf "%s: '%s' does not have a UUID\n" $0 $1
>
> Is continuing after printing this error intentional?

No.  I'd already noticed this and have fixed it.  Should have posted a
v2.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-12-13 20:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-13 16:16 [PATCH 1/4] host/rootfs: make fs root directories shared Alyssa Ross
2025-12-13 16:16 ` [PATCH 2/4] host/rootfs: give VMs a disk-backed directory Alyssa Ross
2025-12-13 16:16 ` [PATCH 3/4] host/rootfs: clean up obsolete tmp dirs on VM exit Alyssa Ross
2025-12-13 16:16 ` [PATCH 4/4] host/rootfs: clean up obsolete tmp dirs on mount Alyssa Ross
2025-12-13 20:37   ` Demi Marie Obenour
2025-12-13 20:43     ` Alyssa Ross

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).