[systemd-devel] Specifier support for Alias

Markus Rathgeb maggu2810 at gmail.com
Sat Mar 9 03:11:15 PST 2013


It is also not working with systemd-198.

The symlink is correctly set, if I using a "small" i (%i) with version 198.
Alias=mnt-NAS-%i.automount

# systemctl enable mnt-NAS at games.automount
ln -s '/etc/systemd/system/mnt-NAS at .automount'
'/etc/systemd/system/mnt-NAS-games.automount'

But that's all.
Mounting does not succeed.

I also tried to replace the "%i" in "Where" and "What" of the template,
with the correct options.

cat /etc/systemd/system/mnt-NAS-games.automount'
===
[Unit]
Description=Mount the NAS share %i

[Install]
Alias=mnt-NAS-%i.mount

[Mount]
What=//192.168.0.3/games
Where=/mnt/NAS/games
Type=cifs
Options=noexec,nosuid,user=maggu2810,password=DummyNotRealPwd,uid=maggu2810,gid=users,file_mode=0644,dir_mode=0755
TimeoutSec=10s
===

# systemctl start mnt-NAS-games.mount
Failed to issue method call: Unit mnt-NAS-games.mount failed to load:
Invalid argument. See system logs and 'systemctl status
mnt-NAS-games.mount' for details.

# systemctl status mnt-NAS-games.mount
mnt-NAS-games.mount
          Loaded: error (Reason: Invalid argument)
          Active: inactive (dead)

Feb 25 23:44:48 localhost systemd[1]: Unit mnt-NAS-games.mount entered
failed state
Mar 09 09:08:20 localhost systemd[1]: mnt-NAS-games.mount's Where setting
doesn't match unit name. Refusing.
Mar 09 09:08:21 localhost systemd[1]: mnt-NAS-games.mount's Where setting
doesn't match unit name. Refusing.
Mar 09 11:49:57 localhost systemd[1]: Unmounting /mnt/NAS/games...
Mar 09 11:49:57 localhost systemd[1]: Unmounted /mnt/NAS/games.
Mar 09 11:55:50 localhost systemd[1]: Mounting Mount the NAS share ...
Mar 09 11:55:50 localhost systemd[1]: Mounted Mount the NAS share .
Mar 09 11:56:12 localhost systemd[1]: Unmounting Mount the NAS share ...
Mar 09 11:56:12 localhost systemd[1]: Unmounted Mount the NAS share .

The command was executed no "11:58", so there is no status message
generated!

If I am using a copy and not a symlink (games are currently hardcoded as
stated above) -- all is working fine.

# systemctl disable mnt-NAS at games.mount
rm '/etc/systemd/system/mnt-NAS-games.mount'

# cp /etc/systemd/system/mnt-NAS at .mount
/etc/systemd/system/mnt-NAS-games.mount
# systemctl daemon-reload

# systemctl start mnt-NAS-games.mount

# systemctl status mnt-NAS-games.mount
mnt-NAS-games.mount - Mount the NAS share
          Loaded: loaded (/etc/systemd/system/mnt-NAS-games.mount; disabled)
          Active: active (mounted) since Sat 2013-03-09 12:04:54 CET; 6s ago
           Where: /mnt/NAS/games
            What: //192.168.0.3/games
         Process: 1624 ExecMount=/bin/mount
//192.168.0.3/games/mnt/NAS/games -t cifs -o
noexec,nosuid,user=maggu2810,password=DummyNotRealPwd,uid=maggu2810,gid=users,file_mode=0644,dir_mode=0755
(code=exited, status=0/SUCCESS)

Mar 09 12:04:54 localhost systemd[1]: Mounting Mount the NAS share ...
Mar 09 12:04:54 localhost systemd[1]: Mounted Mount the NAS share .


So, what to do?










2013/3/9 Oleksii Shevchuk <alxchk at gmail.com>

> > To achieve this:
> > "Mount units must be named after the mount point directories they
> control."
>
> > Our is there a better way?
>
> Hm. Really. Anyway, looks like it's fixed/works in latest release:
>
> systemctl enable iit-bs-cifs at D.mount
> ln -s '/etc/systemd/system/iit-bs-cifs at .mount'
> '/etc/systemd/system/mnt-iit-bs-cifs-D.mount'
>
> But hehe.. There is another bug, with escaping:
>
> > grep Alias iit-bs-cifs at .mount
> Alias=mnt-iit\x2dbs\x2dcifs\x2d%i.mount
>
> So alias created unescaped..
>
> And it doesn't work anyway. Looks like templated .mount units couldn't
> be supported with current restrictions. I.e. unit name with @ wont't be
> equal to Where=, and templates in Alias= couldn't be resolved, because
> of missing @..
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130309/9a02f349/attachment.html>


More information about the systemd-devel mailing list