Comment 3 for bug 2071333

Revision history for this message
Danilo Egea Gondolfo (danilogondolfo) wrote :

Hello,

this is not caused by Netplan itself (but one of the things the update does will lead to the error). Below is a Dockerfile you can use to reproduce the problem. As you can see, netplan.io is not involved in it.

----

FROM ubuntu:22.04

RUN apt-get update && apt-get install --yes --no-install-recommends \
    systemd \
    openssh-server ; mkdir /run/systemd/system

RUN systemctl enable ssh

----

Here is why it fails:

The call to "systemctl enable ssh" gets redirected to "/lib/systemd/systemd-sysv-install enable ssh" which works, because the file "/etc/init.d/ssh" exists.

"systemd-sysv-install" is a script that will call another script called "/usr/sbin/update-rc.d". This second script will check if /run/systemd/system exists and assume systemd is available if it does.

Why it started to happen after the security update? One of the issues we fixed was a bad file permission we were using. To ensure that the permissions are set to the correct ones, the update calls the netplan generator to recreate the files. One of the things the generator does is create that directory.

To workaround this you can just remove that directory before calling systemctl:

----

FROM ubuntu:22.04

RUN apt-get update && apt-get install --yes --no-install-recommends \
    systemd \
    openssh-server \
    netplan.io ; rm -rf /run/systemd/system

RUN systemctl enable ssh

----