Comment 0 for bug 1732703

Revision history for this message
Victor Tapia (vtapia) wrote :

Trusty uses upstart by default, and installing snapd (e.g. for livepatch purposes), pulls systemd too. In this setup, upstart is _not_ replaced by systemd, but MAAS "detects" systemd as init because of the existence of /run/systemd/system:

@src/provisioningserver/utils/__init__.py:505

SYSTEMD_RUN_PATH = '/run/systemd/system'

def get_init_system():
    """Returns 'upstart' or 'systemd'."""
    if os.path.exists(SYSTEMD_RUN_PATH):
        return 'systemd'
    else:
        return 'upstart'

One possible solution would be to check if /sbin/init is a symlink pointing to /lib/systemd/systemd:

def get_init_system():
    """Returns 'upstart' or 'systemd'."""
    initpath = os.readlink("/sbin/init")
    if (initpath == "/lib/systemd/systemd"):
        return 'systemd'
    else:
    return 'upstart'

Other affected parts of the code are the postinst files for maas-proxy and maas-dhcp (debian/maas-proxy.postinst debian/maas-dhcp.postinst), throwing an error if maas is installed after systemd in Trusty