Skip to content

factory: mount users imported from hybrid system during recovery mode #263

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
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions factory/usr/lib/core/extra-paths
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,17 @@ if [ ! -d /run/mnt/data/system-data/var/lib/snapd/kernel/"$kernelName"/"$rev" ];
/run/mnt/kernel/modules /usr/lib/modules none bind,x-initrd.mount 0 0
EOF
fi

# in recovery mode on hybrid systems, snap-bootstrap generates passwd, shadow,
# group, and gshadow files in /run/snapd/hybrid-users. these files contain users
# imported from the host system mixed with the default users from the base snap
# that is used for recovery mode.
mode="$(/usr/libexec/core/get-mode mode)" || mode="$(/usr/libexec/core/get-arg snapd_recovery_mode)" || mode="unknown"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really like to see a comment describing why we need to do this before this section

if [ -f /run/snapd/hybrid-users/passwd ] && [ "${mode}" = "recover" ]; then
cat <<'EOF' >>/sysroot/etc/fstab
/run/snapd/hybrid-users/passwd /etc/passwd none bind 0 0
/run/snapd/hybrid-users/shadow /etc/shadow none bind 0 0
/run/snapd/hybrid-users/group /etc/group none bind 0 0
/run/snapd/hybrid-users/gshadow /etc/gshadow none bind 0 0
EOF
fi