I am trying to build an Ubuntu based image with distrobuilder and mysqld/php/apache2 on the image.
I grabbed the current Ubuntu image.yaml from the lxc-ci and stripped down for my needs, and built it with distrobuilder build-lxd mysqld.yaml .
The error message I get when running with distrobuilder is that dpkg cannot shut down the running MySQL process and fails the package installation.
Setting up mysql-server-8.0 (8.0.22-0ubuntu0.20.04.3) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Error: Unable to shut down server with process id 1723
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
A little bit of googling brought me to this workaround for lxc, but as I am building for LXD this doesn’t work.
Is there anyway to enable the same when using distrobuilder to build the images?
Any other workaround necessary for this to happen?
I don’t think the link you’re referring to applies here.
distrobuilder doesn’t operate in a container so isn’t restricted by apparmor.
It seems like this could be a packaging bug. We can clearly see distrobuilder’s policy-rc.d change at work which prevents any service from being started or stopped, yet mysql somehow still thinks it’s running and should be stopped?
Setting up mysql-server-8.0 (8.0.22-0ubuntu0.20.04.3) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 1377
Error: Unable to shut down server with process id 1377
could not find anything running with PID 1377 on the host though.
I don’t know how the image itself s built by distrobuilder, is it within a chroot? Maybe I need to mount /proc “inside” the chroot?
In the end, the only option is to either download only the packages, or install mysql-server-core-8.0 and run the configuration steps at a later stage, since the configuration steps of the packages fail. For me, it is fine since one has to secure the MySQL installation anyway post image deployment.