Project

General

Profile

Actions

Bug #64488

open

upgrading packages from debian distro to ceph-io packages on bookworm fails because of missing home dir and fails on first clean install too

Added by Jan Horacek 2 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

upgrading cephadm package fails when going from distro package (16.x) to 18.2.1 provided by ceph.io repository

after debugging, there are multiple issues

  • postinst script expects homedir of cephadm user in /home/cephadm and does not try to detect it (this is not compatible with debians `/var/lib/cephadm`)
    (* postinst uses `mkdir /home/cephadm/.ssh` but this should not be fixed with `mkdir -p`)
  • `adduser --quiet --system...` this does not create homedir for the user on debian bookworm

hotfix for installing cephadm package on debian bookworm is now to `useradd cephadm --system -m -d /home/cephadm` before installing cephadm package

jhrtestvm4[root](14:30:41)-(~)
-> adduser --system --shell /bin/bash testadduser
Adding system user `testadduser' (UID 112) ...
Adding new user `testadduser' (UID 112) with group `nogroup' ...
Not creating `/nonexistent'.

jhrtestvm4[root](14:31:30)-(~)
-> getent passwd | grep testadduser
testadduser:x:112:65534::/nonexistent:/bin/bash
Setting up cephadm (18.2.1-1~bpo12+1) ...
usermod: unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password.
mkdir: cannot create directory '/home/cephadm/.ssh': No such file or directory
dpkg: error processing package cephadm (--configure):
 installed cephadm package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 cephadm
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Sub-process /usr/bin/dpkg returned an error code (1) (corrective)

/var/lib/dpkg/info/cephadm.postinst

case "$1" in
    configure)
       # create cephadm user
       # 1. create user if not existing
       if ! getent passwd | grep -q "^cephadm:"; then
         echo -n "Adding system user cephadm.." 
         adduser --quiet --system --disabled-password --gecos 'cephadm user for mgr/cephadm' --shell /bin/bash cephadm 2>/dev/null || true
         echo "..done" 
       fi

       # 2. make sure user is unlocked
       if [ -f /etc/shadow ]; then
           usermod -U -e '' cephadm
       else
           usermod -U cephadm
       fi

       # set up (initially empty) .ssh/authorized_keys file
       if ! test -d /home/cephadm/.ssh; then
           mkdir /home/cephadm/.ssh
           chown --reference /home/cephadm /home/cephadm/.ssh
           chmod 0700 /home/cephadm/.ssh
       fi
       if ! test -e /home/cephadm/.ssh/authorized_keys; then
           touch /home/cephadm/.ssh/authorized_keys
           chown --reference /home/cephadm /home/cephadm/.ssh/authorized_keys
           chmod 0600 /home/cephadm/.ssh/authorized_keys
       fi

    ;;
    abort-upgrade|abort-remove|abort-deconfigure)
        :
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac
Actions #1

Updated by Jan Horacek 2 months ago

please is it possible to reformat the issue ? i'm too used to write everything in markdown ;(

Actions #2

Updated by Kefu Chai 2 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF