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

Rainer Dorsch ml at bokomoko.de
Mon Jan 4 04:58:13 PST 2016


[please ignore my previous two posts, the have been truncated. In case this 
happens again, the full post is at http://netcup.bokomoko.de/~rd/systemd-failure.txt]

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 after boot though: 
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:~ #  


There is one 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
● │   └─basic.target
● │     ├─amlogic-remotecfg.service
● │     ├─hwdb.service
● │     ├─show-version.service
● │     ├─paths.target
● │     ├─slices.target
● │     │ ├─-.slice
● │     │ └─system.slice
● │     ├─sockets.target
● │     │ ├─dbus.socket
● │     │ ├─systemd-initctl.socket
● │     │ ├─systemd-journald-audit.socket
● │     │ ├─systemd-journald-dev-log.socket
● │     │ ├─systemd-journald.socket
● │     │ ├─systemd-shutdownd.socket
● │     │ ├─systemd-udevd-control.socket
● │     │ └─systemd-udevd-kernel.socket
● │     ├─sysinit.target
● │     │ ├─debug-shell.service
● │     │ ├─debugconfig.service
● │     │ ├─dev-hugepages.mount
● │     │ ├─dev-mqueue.mount
● │     │ ├─kmod-static-nodes.service
● │     │ ├─machine-id.service
● │     │ ├─sys-fs-fuse-connections.mount
● │     │ ├─sys-kernel-config.mount
● │     │ ├─sys-kernel-debug.mount
● │     │ ├─systemd-ask-password-console.path
● │     │ ├─systemd-hwdb-update.service
● │     │ ├─systemd-journal-catalog-update.service
● │     │ ├─systemd-journal-flush.service
● │     │ ├─systemd-journald.service
● │     │ ├─systemd-modules-load.service
● │     │ ├─systemd-sysctl.service
● │     │ ├─systemd-tmpfiles-setup-dev.service
● │     │ ├─systemd-tmpfiles-setup.service
● │     │ ├─systemd-udev-trigger.service
● │     │ ├─systemd-udevd.service
● │     │ ├─tz-data.service
● │     │ ├─userconfig.service
● │     │ ├─var-log-debug.service
● │     │ ├─local-fs.target
● │     │ │ ├─storage-.kodi-.local-storage-sdcard.mount
● │     │ │ ├─systemd-remount-fs.service
● │     │ │ ├─tmp.mount
● │     │ │ └─var.mount
● │     │ └─swap.target
● │     └─timers.target
● │       └─systemd-tmpfiles-clean.timer
● └─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
●   └─basic.target
●     ├─amlogic-remotecfg.service
●     ├─hwdb.service
●     ├─show-version.service
●     ├─paths.target
●     ├─slices.target
●     │ ├─-.slice
●     │ └─system.slice
●     ├─sockets.target
●     │ ├─dbus.socket
●     │ ├─systemd-initctl.socket
●     │ ├─systemd-journald-audit.socket
●     │ ├─systemd-journald-dev-log.socket
●     │ ├─systemd-journald.socket
●     │ ├─systemd-shutdownd.socket
●     │ ├─systemd-udevd-control.socket
●     │ └─systemd-udevd-kernel.socket
●     ├─sysinit.target
●     │ ├─debug-shell.service
●     │ ├─debugconfig.service
●     │ ├─dev-hugepages.mount
●     │ ├─dev-mqueue.mount
●     │ ├─kmod-static-nodes.service
●     │ ├─machine-id.service
●     │ ├─sys-fs-fuse-connections.mount
●     │ ├─sys-kernel-config.mount
●     │ ├─sys-kernel-debug.mount
●     │ ├─systemd-ask-password-console.path
●     │ ├─systemd-hwdb-update.service
●     │ ├─systemd-journal-catalog-update.service
●     │ ├─systemd-journal-flush.service
●     │ ├─systemd-journald.service
●     │ ├─systemd-modules-load.service
●     │ ├─systemd-sysctl.service
●     │ ├─systemd-tmpfiles-setup-dev.service
●     │ ├─systemd-tmpfiles-setup.service
●     │ ├─systemd-udev-trigger.service
●     │ ├─systemd-udevd.service
●     │ ├─tz-data.service
●     │ ├─userconfig.service
●     │ ├─var-log-debug.service
●     │ ├─local-fs.target
●     │ │ ├─storage-.kodi-.local-storage-sdcard.mount
●     │ │ ├─systemd-remount-fs.service
●     │ │ ├─tmp.mount
●     │ │ └─var.mount
●     │ └─swap.target
●     └─timers.target
●       └─systemd-tmpfiles-clean.timer
OpenELEC:~ #

Can anybody tell, why dev-mmcblk0p1.device does not get mounted and times out? 
Why is my unit file not executed before systemd-tmpfiles-setup.service, which 
results in failures in systemd-tmpfiles-setup.service?

I am an experienced Linux user, but new to systemd. Seems there is quite some 
stuff to learn even for things which seem to be simple like mounting a 
partition....

If you want more information, please let me know.

Many thanks for reading until here :-)
Rainer



-- 
Rainer Dorsch
http://bokomoko.de/


More information about the systemd-devel mailing list