[root@localhost ~]# ls /lib/systemd/system/not-a-swap.swap ls: cannot access /lib/systemd/system/not-a-swap.swap: No such file or directory [root@localhost ~]# grep not-a-swap /etc/fstab [root@localhost ~]# systemctl start not-a-swap.swap Job failed, see system logs for details. [root@localhost ~]# tail -1 /var/log/messages Oct 15 14:35:38 localhost init[1]: Unit not-a-swap.swap entered failed state. [root@localhost ~]# systemctl status not-a-swap.swap not-a-swap.swap - /not/a/swap Loaded: loaded Active: failed What: /not/a/swap [root@localhost ~]# systemctl -a -t swap | grep not not-a-swap.swap loaded failed failed /not/a/swap Contrast to: [root@localhost ~]# systemctl start not-a-mount.mount Failed to issue method call: Unit not-a-mount.mount failed to load: No such file or directory. You might find more information in the system logs. [root@localhost ~]# tail -1 /var/log/messages Oct 15 14:35:38 localhost init[1]: Unit not-a-swap.swap entered failed state. [root@localhost ~]# systemctl status not-a-mount.mount not-a-mount.mount - /not/a/mount Loaded: error Active: inactive (dead) Where: /not/a/mount CGroup: name=systemd:/systemd-1/not-a-mount.mount [root@localhost ~]# systemctl -a -t mount | grep not not-a-mount.mount error inactive dead /not/a/mount Version-Release number of selected component (if applicable): systemd-11-1.fc15.x86_64 How reproducible: 100% Steps to Reproduce: 1. Typo a swap unit name Actual results: Get 'failed' Expected results: Get 'no such unit/device'
Hmm, so reason for the different behaviour here is that for activating a swap file all you need to know is the swap device and off you go. However, for creating a mount you need to know from somewhere (fstab, or a .mount file) what to mount to a which dir. Now, from the name of a .swap we can deduce the swap device it is referring to and hence we can activate it without manual configuration. However, for a mount point we can only figure out the directory, but for the source device we need some kind of configuration, and we don't have that we cannot do anything at all. hence the two different error messages: for the swap stuff we actually try to enable the swap and that fails, but for the mount point we don't get that far: we don't even try because we wouldn't know what to mount. I think the current behaviour makes some sense, even though it might be surprising. Not really sure what we could improve here.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.