Cannot disable systemd serial-getty service
archlinux, gpio, raspberry-pi, systemd, tty
Solution
The correct way to stop a service ever being enabled again is to use:
systemctl mask serial-getty@ttyAMA0.service
(using ttyAMA0 as the example in this case). This will add a link to null to the entry for that service.
Problem
On Raspberry Pi with Arch Linux there is a service active called `serial-getty@AMA0`. The unit file is: /usr/lib/systemd/system/serial-getty@.service As root I can invoke ``` systemctl stop serial-getty@ttyAMA0 systemctl disable serial-getty@ttyAMA0 ``` But after reboot the service is enabled and running again. Why is the service enabled after disabling it? How can I disable it permanent? UPDATE systemd uses generators at /usr/lib/systemd/system-generators/ is a binary called systemd-getty-generator. This binary runs at system start and adds the symlink serial-getty@ttyAMA0.service to `/run/systemd/generator/getty.target.wants`. I eventually found a dirty solution. I commented out all actions in /usr/lib/systemd/system/serial-getty@.service. The service did appear to start anyway, but without blocking ttyAMA0.