Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot disable systemd serial-getty service

On Raspberry Pi with Arch Linux there is a service active called serial-getty@AMA0.

The unit file is: /usr/lib/systemd/system/[email protected]

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 [email protected] to /run/systemd/generator/getty.target.wants.

I eventually found a dirty solution. I commented out all actions in /usr/lib/systemd/system/[email protected]. The service did appear to start anyway, but without blocking ttyAMA0.

like image 856
lojoe Avatar asked Feb 06 '14 07:02

lojoe


1 Answers

The correct way to stop a service ever being enabled again is to use:

systemctl mask [email protected]

(using ttyAMA0 as the example in this case). This will add a link to null to the entry for that service.

like image 122
Rob Meades Avatar answered Oct 11 '22 12:10

Rob Meades