summaryrefslogtreecommitdiff
path: root/bin/debvm-create
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-08-09 14:48:43 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-08-09 14:53:14 +0200
commite4ecc7f745c54a765eff8eff59fc2e9a03371f2e (patch)
tree65fc0db4ba5909b11e44b13e3660c254eee2f652 /bin/debvm-create
parent90fc08dcfc714b19c28721109fb26f682ee7a834 (diff)
downloaddebvm-e4ecc7f745c54a765eff8eff59fc2e9a03371f2e.tar.gz
debvm-create: avoid using passwd --delete
passwd will chroot() into the target tree and then load shared libraries. This tends to work badly for old releases and for foreign architectures or combinations thereof. As a result, it sometimes fails with Cannot determine your user name. In practice, it removes a single asterisk from the first line of /etc/shadow (at least for jessie to trixie). This is something, we can also do via sed. Reported-by: Sylvain Beucler <beuc@debian.org> Fixes: d2d8b9965d39 ("debvm-create: avoid failing when we install no passwd")
Diffstat (limited to 'bin/debvm-create')
-rwxr-xr-xbin/debvm-create4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index 0fffd70..eecc803 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -356,7 +356,9 @@ set -- \
"$@"
# allow password-less root login
-set -- '--customize-hook=passwd --root "$1" --delete root' "$@"
+# We would like to use passwd --root "$1" --delete here, but uses chroot() and
+# then attempts to load shared libraries, which is doomed in the foreign case.
+set -- '--customize-hook=sed -i -e "1s/^root:\\*:/root::/" "$1/etc/shadow"' "$@"
if test "$INITSYSTEM" = systemd && ! check_skip systemdnetwork; then
# dhcp on all network interfaces, and add a dns resolver