[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Adding a user in postinstall

On Wed, Jun 17, 2020 at 11:55:18AM +0200, Markus wrote:
> Dear Mentors,
> While packaging a package for a Virtual Observatory server, I'm
> encountering a postinst glitch in the CI that I don't quite
> understand.
> This is about  git@salsa.debian.org:debian-astro-team/gavodachs.git,
> the gavo branch.
> The idea is that the package creates a user that has all the
> necessary permissions to configure the server, run debug copies, and
> the like.  It is called dachsroot, and the postinst creates if if
> necessary:
>  	# create user "dachsroot" if (s)he is not already there
>   if ! getent passwd dachsroot ; then

   if ! getent passwd dachsroot ; then

>     adduser --disabled-password --gecos "" --ingroup gavo dachsroot
>   fi
> This has never resulted in headache over all the years that we have
> been distributing the resulting package outside of Debian.  But the
> CI on salsa gives:
>   Adding user `dachsroot' ...
>   Adding new user `dachsroot' (1011) with group `gavo' ...
>   Creating home directory `/home/dachsroot' ...
>   Stopped: Couldn't create home directory `/home/dachsroot': File exists.
>   Removing directory `/home/dachsroot' ...
>   Removing user `dachsroot' ...
> after which the installation duly fails.
> Now... I really cannot see where that home directory might come from
> (the full log is on
> https://salsa.debian.org/debian-astro-team/gavodachs/-/jobs/798533/raw),
> which made me doubt whether a package is allowed to create users with
> homes in the first place and what I'm seeing here really is some
> adduser extra on the CI.
> However, at least in 9.2 in the Policy I've not seen anything to that
> effect.  Have I missed it there or anywhere else?
> And if it's legal to create users like this: Why would the adduser in
> the postinst fail?

Sorry for not answering the questions


   if [ ! getent passwd dachsroot &&  ! -d /home/dachsroot ] ; then
     adduser --disabled-password --gecos "" --ingroup gavo dachsroot
     echo "I: Assumed that user dachsroot exists ..." 

Geert Stappers
When you assume, you make an ass of u and me

Reply to: