]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
deb/cephadm: Don't assume a home directory is configured 66394/head
authorElliot Courant <me@elliotcourant.dev>
Mon, 24 Nov 2025 17:50:56 +0000 (11:50 -0600)
committerElliot Courant <me@elliotcourant.dev>
Wed, 10 Dec 2025 20:35:29 +0000 (14:35 -0600)
cephadm.postinst can fail if cephadm was originally installed using a
version that didn't configure a home directory for the user at all.
Newer versions do configure a home directory (as either `/home/cephadm`
or `/var/lib/cephadm`) so if that is configured then nothing needs to be
done. But if the user was created with no home directory then one needs
to be added for the configure step to succeed.

Fixes: https://tracker.ceph.com/issues/72083
commit 90bc0369243077c2aaf67f0de2bab5810b217f4e added home directories
for new cephadm users created, but didn't add home directories to
cephadm users that already existed.

Signed-off-by: Elliot Courant <me@elliotcourant.dev>
debian/cephadm.postinst

index b586ee7183d775d979848c4281b166e1e3b84aa4..f01e7430cc9109ab3a289fd666ab2383f1548e74 100644 (file)
@@ -41,6 +41,12 @@ case "$1" in
            usermod -U cephadm
        fi
 
+       # Older versions may not have configured a home directory.
+       # If they don't have one configured then add it.
+       if ! test ~cephadm = "/nonexistent"; then
+           usermod --home /var/lib/cephadm -m cephadm
+       fi
+
        # set up (initially empty) .ssh/authorized_keys file
        if ! test -d ~cephadm/.ssh; then
            mkdir ~cephadm/.ssh