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.
Hi guys, I’m facing the same problem, @Dnegreira , when you talk about downloading only the packages, would there be a package list missing? or just install de core, and then run the config?
Could show me a step-by?
If anyone more can help, I would be very grateful
I use the same yaml from lxc-ci, just add the mysql installation
log is very similar to his:
Setting up mysql-server-8.0 (8.0.37-0ubuntu0.22.04.3) ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
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 25483
Error: Unable to shut down server with process id 25483
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up libhttp-date-perl (6.05-1) ...
Setting up cloud-init (24.1.3-0ubuntu1~22.04.5) ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
No diversion 'diversion of /etc/init/ureadahead.conf to /etc/init/ureadahead.conf.disabled by cloud-init', none removed.
Created symlink /etc/systemd/system/cloud-init.target.wants/cloud-config.service → /lib/systemd/system/cloud-config.service.
Created symlink /etc/systemd/system/cloud-init.target.wants/cloud-final.service → /lib/systemd/system/cloud-final.service.
Created symlink /etc/systemd/system/cloud-init.target.wants/cloud-init-hotplugd.socket → /lib/systemd/system/cloud-init-hotplugd.socket.
Created symlink /etc/systemd/system/cloud-init.target.wants/cloud-init-local.service → /lib/systemd/system/cloud-init-local.service.
Created symlink /etc/systemd/system/cloud-init.target.wants/cloud-init.service → /lib/systemd/system/cloud-init.service.
Setting up libclone-perl (0.45-1build3) ...
Setting up libhtml-tagset-perl (3.20-4) ...
Setting up python3-launchpadlib (1.10.16-1) ...
Setting up liblwp-mediatypes-perl (6.04-1) ...
Setting up libencode-locale-perl (1.05-1.1) ...
Setting up python3-software-properties (0.99.22.9) ...
Setting up libhtml-parser-perl:amd64 (3.76-1build2) ...
Setting up packagekit (1.2.5-2ubuntu2) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of force-reload.
Failed to open connection to "system" message bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
Created symlink /etc/systemd/user/sockets.target.wants/pk-debconf-helper.socket → /usr/lib/systemd/user/pk-debconf-helper.socket.
Setting up libhttp-message-perl (6.36-1) ...
Setting up packagekit-tools (1.2.5-2ubuntu2) ...
Setting up libcgi-pm-perl (4.54-1) ...
Setting up libhtml-template-perl (2.97-1.1) ...
Setting up software-properties-common (0.99.22.9) ...
Setting up libcgi-fast-perl (1:2.15-1) ...
Processing triggers for rsyslog (8.2112.0-2ubuntu2.2) ...
invoke-rc.d: unknown initscript, /etc/init.d/rsyslog not found.
invoke-rc.d: could not determine current runlevel
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
Errors were encountered while processing:
mysql-server-8.0
E: Sub-process /usr/bin/dpkg returned an error code (1)
Error: Failed to manage packages: Failed to install packages: exit status 100
ERROR [2024-06-18T06:55:23-03:00] Failed running distrobuilder err="Failed to manage packages: Failed to install packages: exit status 100"
INFO [2024-06-18T06:55:23-03:00] Removing cache directory
@stgraber I would like to know if a more intrusive method exists for analyzing debug information. The error occurs but remains isolated, and I would like to interact with the environment set up by the builder for a more thorough investigation.
This looks like a potential bug with the mysql-server package.
Distrobuilder sets things up so no services can start. That’s what you can see with mentions to invoke-rc.d, but then mysql seems to still expect its service to be running and fails when it’s not.