[debian-mysql] Bug#983563: Bug#983563: mariadb-server: trigger fails when systemd is not running (eg. chroot)

Arnaud R arnaudr at kali.org
Mon Mar 1 16:44:38 GMT 2021


On 3/1/21 6:49 PM, Faustin Lammler wrote:
> Hi Arnaud!
>
> Arnaud Rebillout <arnaudr at kali.org>,
> 26/02/2021 – 16:39:41 (+0700):
>
>> Hence I believe that the line:
>>
>>    if [ -x "$(command -v systemctl)" ]; then
>>
>> Should be replaced by:
>>
>>    if [ -d /run/systemd/system ]; then
> I am not sure that this is what we want here. Indeed, doing this would
> lead to the execution of `invoke-rc.d mariadb restart` in your
> particular case (but you are using systemd not sysv init). Or I am
> missing something?


Oh, indeed, you're completely right, I don't want to run the line 
`invoke-rc.d ...`. In my case, and since systemd is not running, I think 
that the maintscript should not try to restart mariadb at all.

I *think* the code should be something like that:

     if [ -d /run/systemd/system ]; then
       systemctl daemon-reload
     elif [ -x "/etc/init.d/mariadb" ]; then
       invoke-rc.d mariadb restart
     fi

(note that it's exactly what is done at the end of this file, after the 
`#DEBHELPER#` line).


> Could point me to the steps in your CI where this happen so I can try to
> reproduce it?


This particular CI is unfortunately not public, however I can give you a 
procedure to reproduce the issue with Debian. The trick is to get the 
right package versions so that an update of mysql-common triggers 
mariadb-server (that's what happened in the Kali CI).

And so, here it goes:

     ## debootstrap an old version of sid
     sudo debootstrap sid debdir \
         http://snapshot.debian.org/archive/debian/20201205T204928Z
     sudo systemd-nspawn -D debdir

     ## install mariadb
     apt-get -o Acquire::Check-Valid-Until=false update
     apt-get install mariadb-server-10.5

     [...]
     mariadb-server-10.5 amd64 1:10.5.8-3
     mysql-common all 5.8+1.0.6
     [...]

     ## upgrade to debian testing
     echo 'deb http://deb.debian.org/debian testing main' > 
/etc/apt/sources.list
     apt-get update
     apt-get dist-upgrade

     [...]
     mysql-common all 5.8+1.0.7
     [...]
     Processing triggers for mariadb-server-10.5 (1:10.5.8-3) ...
     System has not been booted with systemd as init system (PID 1). 
Can't operate.
     Failed to connect to bus: Host is down
     dpkg: error processing package mariadb-server-10.5 (--configure):
      installed mariadb-server-10.5 package post-installation script 
subprocess returned error exit status 1
     Errors were encountered while processing:
      mariadb-server-10.5
     E: Sub-process /usr/bin/dpkg returned an error code (1)

Cheers,

   Arnaud



More information about the pkg-mysql-maint mailing list