[systemd-devel] Mounting a partition at the *right* time

Rainer Dorsch ml at bokomoko.de
Mon Jan 4 03:26:25 PST 2016


Hi,

I am facing an issue with a .mount unit file. The task is simple: mount a partition at the 
*right* time. 

The system is OpenElec 6.0, which is based on CoreOS. /etc/fstab is on a squashfs, i.e. 
it cannot be easily modified and is empty:

OpenELEC:~/.config/system.d # cat /etc/fstab
OpenELEC:~/.config/system.d # 

I would like to mount /storage/.kodi/.local/storage/sdcard after /storage is mounted 
and before systemd-tmpfiles-setup.service starts executing:

I created this .mount unit file:

OpenELEC:~/.config/system.d # cat storage-.kodi-.local-storage-sdcard.mount 
[Unit]
Description=sdcard mount script

#Requires=storage.mount
#After=storage.mount
ConditionPathExists=/storage/.kodi/.local/storage/sdcard

Conflicts=umount.target
Before=umount.target systemd-tmpfiles-setup.service

[Mount]
What=/dev/mmcblk0p1
Where=/storage/.kodi/.local/storage/sdcard
Options=
Type=ext4


[Install]
WantedBy=local-fs.target


OpenELEC:~/.config/system.d # 


When booting, I get

A start job is running for dev-mmcblk0p1.device (xys / 1min 30s)

The device is mounted:

OpenELEC:~ # mount|grep mmcblk0p1
/dev/mmcblk0p1 on /var/media/mmcblk0p1-mmc-USD_0xc840a5b2-p type ext4 
(rw,nosuid,nodev,noexec,noatime,data=ordered)
/dev/mmcblk0p1 on /storage/.kodi/.local/storage/sdcard type ext4 
(rw,relatime,data=ordered)
OpenELEC:~ # 


But there is a failed unit:

OpenELEC:~ # systemctl --failed --no-pager
  UNIT                           LOAD   ACTIVE SUB    DESCRIPTION
● systemd-tmpfiles-setup.service loaded failed failed Create Volatile Files and 
Directories

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
OpenELEC:~ # 


OpenELEC:~ # systemctl status systemd-tmpfiles-setup.service
● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
   Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup.service; static; 
vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2016-01-04 12:16:44 CET; 1min 50s ago
     Docs: man:tmpfiles.d(5)
           man:systemd-tmpfiles(8)
  Process: 1731 ExecStart=/usr/bin/systemd-tmpfiles --create --remove --boot --
exclude-prefix=/dev (code=exited, status=1/FAILURE)
 Main PID: 1731 (code=exited, status=1/FAILURE)

Jan 04 12:16:44 OpenELEC systemd-tmpfiles[1731]: ACLs are not supported. Ignoring
Jan 04 12:16:44 OpenELEC systemd-tmpfiles[1731]: ACLs are not supported. Ignoring
Jan 04 12:16:44 OpenELEC systemd-tmpfiles[1731]: ACLs are not supported. Ignoring
Jan 04 12:16:44 OpenELEC systemd-tmpfiles[1731]: 
[/usr/lib/tmpfiles.d/z_03_connman.conf:19] Duplicate line for path "/var/cache", 
ignoring.
Jan 04 12:16:44 OpenELEC systemd-tmpfiles[1731]: stat(/storage/pictures) failed: No 
such file or directory
Jan 04 12:16:44 OpenELEC systemd-tmpfiles[1731]: stat(/storage/videos) failed: No 
such file or directory
Jan 04 12:16:44 OpenELEC systemd[1]: systemd-tmpfiles-setup.service: main process 
exited, code=exited, status=1/FAILURE
Jan 04 12:16:44 OpenELEC systemd[1]: Failed to start Create Volatile Files and 
Directories.
Jan 04 12:16:44 OpenELEC systemd[1]: Unit systemd-tmpfiles-setup.service entered 
failed state.
Jan 04 12:16:44 OpenELEC systemd[1]: systemd-tmpfiles-setup.service failed.
OpenELEC:~ # 

/storage/pictures and /storage/videos are symlinks to the partition I my unit file is 
supposed to mount:

OpenELEC:~ # ls -l /storage/pictures
lrwxrwxrwx    1 root     root            36 Dec 28 18:34 /storage/pictures -> 
.kodi/.local/storage/sdcard/pictures
OpenELEC:~ # ls -l /storage/videos
lrwxrwxrwx    1 root     root            34 Dec 28 18:36 /storage/videos -> 
.kodi/.local/storage/sdcard/videos
OpenELEC:~ # 

The dependencies look ok for me (at least I do not see anything circular):

OpenELEC:~ # systemctl list-dependencies --no-pager
default.target
● ├─kodi.service
● ├─service.multimedia.vdr-addon.service
● ├─graphical.target
● │ ├─unbind-console.service
● │ └─multi-user.target
● │   ├─avahi-daemon.service
● │   ├─connman.service
● │   ├─cron.service
● │   ├─dbus.service
● │   ├─eventlircd.service
● │   ├─lcdd.service
● │   ├─nmbd.service
● │   ├─rpcbind.service
● │   ├─smbd.service
● │   ├─sshd.service
● │   ├─systemd-ask-password-wall.path
● │   ├─systemd-logind.service
● │   ├─systemd-user-sessions.service
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20160104/eba7e529/attachment-0001.html>


More information about the systemd-devel mailing list