3

How can I disable a unit generated by systemd-fstab-generator or systemd.generator?

Here's my attempt:

$ systemctl is-enabled media-backup.automount
generated
$ echo $?
0
$ sudo systemctl disable media-backup.automount
$ echo $?
0
$ systemctl is-enabled media-backup.automount
generated
$ echo $?
0

As you can see from the exit status 0 the .automount unit is still enabled.

3

From this answer:

Generated unit files are not automatically activated by systemd. There's nothing special about them as far as systemd is concerned. Each individual generator has to explicitly create symbolic links that connect a generated unit to a target, so that activating the target activates the generated unit via a dependency in the normal way.

Removing the symlink under /run/systemd/generator/local-fs.target.wants will disable the .automount until the next boot.

To stop the boot-time generation of the unit, add noauto to the /etc/fstab entry as sebasth said.

Be aware that there is some magic required tostop an.automount` unit without unmounting the filesystem.

1

You can use noauto option in fstab to disable systemd from automatically mounting the fstab entry.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.