Skip to content

New custom-persist feature #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1d16aea
custom-persist: ignore /rw/config bind-dirs if custom-persist enabled
Guiiix Jan 19, 2025
6e7bed0
custom-persist: systemd mount units for /home and /usr/local and serv…
Guiiix Jan 23, 2025
2ac91d7
custom-persist: mount binds configured in qubes-db
Guiiix Jan 26, 2025
91d312a
custom-persist: disable /home and /usr/local mounts
Guiiix Jan 26, 2025
ec86885
custom-persist: disable user firewall rules when custom persist is en…
Guiiix Jan 26, 2025
8042e29
custom-persist: do not read user rc.local scripts when the feature is…
Guiiix Jan 26, 2025
e5209c8
custom-persist: user suspend modules blacklist
Guiiix Jan 26, 2025
e47e285
custom-persist: init.d compatibility
Guiiix Jan 28, 2025
bfe56a8
fix under_systemd function on debian
Guiiix Jan 28, 2025
e0003fc
fix: bind-dirs should create files parent directories if they don't e…
Guiiix Feb 19, 2025
c778254
custom-persist: files and directory auto-creation
Guiiix Feb 19, 2025
4d12979
custom-persist: prefer objets pre-creation in /rw
Guiiix Feb 23, 2025
ff6742c
custom-persist: handle mounts from /rw/home and /rw/usrlocal
Guiiix Feb 23, 2025
385f3fe
bind-dirs: fix /rw/home and /rw/usrlocal initialization from template…
Guiiix Feb 23, 2025
55d297b
custom-persist: pre-create parents with correct ownership
Guiiix Feb 27, 2025
0a8274b
custom-persist: prevent mount units from starting instead of bind mou…
Guiiix Feb 27, 2025
f18831c
bind-dirs: add x-gvfs-hide mount option to bind dirs
Guiiix Feb 27, 2025
cc84ec6
bind-dirs: fix permissions on $fso_ro
Guiiix Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
custom-persist: disable /home and /usr/local mounts
If not explicitly configured, /rw/home and /rw/usrlocal must not be bind mounted to /home and /usr/local.
Instead, the original /home and /usr/local is mounted.
SystemD drop-ins are used to override the resource to mount (What= option in unit)
  • Loading branch information
Guiiix committed Feb 16, 2025
commit 91d312aef52c90dd6718294966a0d2708a49f2f6
12 changes: 12 additions & 0 deletions init/functions
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,15 @@ initialize_home() {
for waitpid in $waitpids ; do wait "$waitpid" ; done ; waitpids=
done
}

disable_persistent_home() {
echo "Disabling persistent /home"
mkdir /run/systemd/system/home.mount.d
echo -e '[Mount]\nWhat=/home' > /run/systemd/system/home.mount.d/30_qubes.conf
}

disable_persistent_usrlocal() {
echo "Disabling persistent /usr/local"
mkdir /run/systemd/system/usr-local.mount.d
echo -e '[Mount]\nWhat=/usr/local' > /run/systemd/system/usr-local.mount.d/30_qubes.conf
}
29 changes: 27 additions & 2 deletions vm-systemd/mount-dirs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Source Qubes library.
# shellcheck source=init/functions
Expand All @@ -10,4 +10,29 @@ set -e
if [ -e /dev/xvdb ] ; then mount /rw ; fi
/usr/lib/qubes/init/setup-rw.sh

initialize_home "/rw/home" ifneeded
if is_custom_persist_enabled; then
mount_home=false
mount_usr_local=false

while read -r qubes_persist_entry; do
[[ "$qubes_persist_entry" =~ \=\ /home$ ]] && mount_home=true
[[ "$qubes_persist_entry" =~ \=\ /usr/local$ ]] && mount_usr_local=true
done <<< "$(qubesdb-multiread /persist/)"
else
mount_home=true
mount_usr_local=true
fi

if $mount_home; then
initialize_home "/rw/home" ifneeded
else
disable_persistent_home
initialize_home "/home" unconditionally
fi

if ! $mount_usr_local; then
disable_persistent_usrlocal
fi

systemctl daemon-reload