0

I have an in-house config deb that I'm installing on a system. Among other things, I'd like to the package to enable a serial console, as described in http://0pointer.de/blog/projects/serial-console.html.

Appreciating that I could just run systemd enable [email protected] in my package's postinst, it feels like it would be better to leverage debhelper in order to ensure proper upgrade/uninstall behaviour. However, I'm finding that:

  • I can't just call dh_systemd_enable from my rules file with the name of an instance unit; it expects to be pointed at an actual file (same thing if I do an end run and try to call deb-systemd-helper directly).
  • I can install a target unit with debhelper, but I don't see to be able to make it do the right thing.

Here's what my target unit looks like:

[Unit]
Description=Serial Console

[Install]
WantedBy=getty.target
[email protected]

I can enable and/or start this, and it shows as running under systemctl status, however it doesn't start the instance service which it is supposed to require.

So I guess my question is in two parts: first, why isn't my target unit working as expected, and second, is there a best way to achieve this under Debian packaging?

1

1 Answer 1

1
  1. The Requires directive should appear in the [Unit] section, not in [Install].
  2. But instead ship a /lib/systemd/system/getty.target.wants/[email protected] -> /lib/systemd/system/[email protected] symlink in your package. First I assumed that [email protected] is automatically pulled in by getty.target if it exists, but such a dependency is only added by systemd-getty-generator for the main kernel console if it's a serial device, which is not the case here. See http://0pointer.de/blog/projects/serial-console.html and man systemd-getty-generator for further details.
1
  • Can confirm that it works as expected when I install the symlink to the getty.target.wants directory.
    – mikepurvis
    Sep 24, 2018 at 16:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .