[systemd-devel] Mounting a partition at the *right* time
Rainer Dorsch
ml at bokomoko.de
Mon Jan 4 08:15:04 PST 2016
Hi Lennart,
On Monday 04 January 2016 16:52:52 you wrote:
> On Mon, 04.01.16 12:26, Rainer Dorsch (ml at bokomoko.de) wrote:
> > 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:
> Note that on systemd mounts automatically gain requirement and
> ordering dependencies on all mounts that are prefixes of it. Thus, the
> "after" dep you ask for above is automatically added anyway.
That is good information. I will remove this one.
> > 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
>
> This appears unnecessary? Why would you condition on that?
I did not know that systemd orders the mounts automatically.
> > Conflicts=umount.target
> > Before=umount.target systemd-tmpfiles-setup.service
>
> These two lines are entirely unnecessary. Unless you set
> "DefaultDependencies=no" all mount units will gain automatic deps on
> umount.target anyway, and are ordered before local-fs.target. As
> systemd-tmpfiles-setup.service is ordered after local-fs.target it
> will thus run anyway after your mount.
The umount.target I copied from other .mount files. w/o the systemd-tmpfiles-
setup.service I saw that the mount was not complete when systemd-tmpfiles-
setup was running (i.e. the links were dangling, since the target was not yet
mounted.)
> > A start job is running for dev-mmcblk0p1.device (xys / 1min 30s)
>
> This indicates that this block device is not actually noticed by
> systemd. Make sure that the "systemd" tag is set on the block
> device. Check it with "udevadm info" on it.
OpenELEC:~ # udevadm info /dev/mmcblk0p1
P: /devices/platform/aml_sdio.0/mmc_host/sd/sd:59b4/block/mmcblk0/mmcblk0p1
N: mmcblk0p1
S: disk/by-id/mmc-USD_0xc840a5b2-part1
S: disk/by-path/platform-aml_sdio.0-part1
S: disk/by-uuid/74fc9b84-b391-4331-ac28-963c28312a9a
E: DEVLINKS=/dev/disk/by-id/mmc-USD_0xc840a5b2-part1 /dev/disk/by-
path/platform-aml_sdio.0-part1 /dev/disk/by-uuid/74fc9b84-b391-4331-
ac28-963c28312a9a
E: DEVNAME=/dev/mmcblk0p1
E:
DEVPATH=/devices/platform/aml_sdio.0/mmc_host/sd/sd:59b4/block/mmcblk0/mmcblk0p1
E: DEVTYPE=partition
E: ID_FS_TYPE=ext4
E: ID_FS_USAGE=filesystem
E: ID_FS_UUID=74fc9b84-b391-4331-ac28-963c28312a9a
E: ID_FS_UUID_ENC=74fc9b84-b391-4331-ac28-963c28312a9a
E: ID_FS_VERSION=1.0
E: ID_NAME=USD
E: ID_PART_ENTRY_DISK=179:0
E: ID_PART_ENTRY_NUMBER=1
E: ID_PART_ENTRY_OFFSET=2048
E: ID_PART_ENTRY_SCHEME=dos
E: ID_PART_ENTRY_SIZE=61829120
E: ID_PART_ENTRY_TYPE=0x83
E: ID_PART_ENTRY_UUID=9d212006-01
E: ID_PART_TABLE_TYPE=dos
E: ID_PART_TABLE_UUID=9d212006
E: ID_PATH=platform-aml_sdio.0
E: ID_PATH_TAG=platform-aml_sdio_0
E: ID_SERIAL=0xc840a5b2
E: MAJOR=179
E: MINOR=1
E: PARTN=1
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=1237893
OpenELEC:~ # udevadm info /dev/mmcblk0
P: /devices/platform/aml_sdio.0/mmc_host/sd/sd:59b4/block/mmcblk0
N: mmcblk0
S: disk/by-id/mmc-USD_0xc840a5b2
S: disk/by-path/platform-aml_sdio.0
E: DEVLINKS=/dev/disk/by-id/mmc-USD_0xc840a5b2 /dev/disk/by-path/platform-
aml_sdio.0
E: DEVNAME=/dev/mmcblk0
E: DEVPATH=/devices/platform/aml_sdio.0/mmc_host/sd/sd:59b4/block/mmcblk0
E: DEVTYPE=disk
E: ID_NAME=USD
E: ID_PART_TABLE_TYPE=dos
E: ID_PART_TABLE_UUID=9d212006
E: ID_PATH=platform-aml_sdio.0
E: ID_PATH_TAG=platform-aml_sdio_0
E: ID_SERIAL=0xc840a5b2
E: MAJOR=179
E: MINOR=0
E: NPARTS=1
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=1237797
OpenELEC:~ #
Without the dependencies you marked as unnecessary
OpenELEC:~/.config/system.d # cat storage-.kodi-.local-storage-sdcard.mount
[Unit]
Description=sdcard mount script
[Mount]
What=/dev/mmcblk0p1
Where=/storage/.kodi/.local/storage/sdcard
Options=
Type=ext4
[Install]
WantedBy=local-fs.target
OpenELEC:~/.config/system.d #
the
A start job is running for dev-mmcblk0p1.device (xys / 1min 30s)
goes away, but systemd-tmpfiles-setup.service still fails:
OpenELEC:~/.config/system.d # 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:~/.config/system.d # systemctl status systemd-tmpfiles-setup.service
--no-pager
● 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 17:09:58 CET; 2min
49s ago
Docs: man:tmpfiles.d(5)
man:systemd-tmpfiles(8)
Process: 1943 ExecStart=/usr/bin/systemd-tmpfiles --create --remove --boot
--exclude-prefix=/dev (code=exited, status=1/FAILURE)
Main PID: 1943 (code=exited, status=1/FAILURE)
Jan 04 17:09:58 OpenELEC systemd-tmpfiles[1943]: ACLs are not supported.
Ignoring
Jan 04 17:09:58 OpenELEC systemd-tmpfiles[1943]: ACLs are not supported.
Ignoring
Jan 04 17:09:58 OpenELEC systemd-tmpfiles[1943]: ACLs are not supported.
Ignoring
Jan 04 17:09:58 OpenELEC systemd-tmpfiles[1943]:
[/usr/lib/tmpfiles.d/z_03_connman.conf:19] Duplicate line for path
"/var/cache", ignoring.
Jan 04 17:09:58 OpenELEC systemd-tmpfiles[1943]: stat(/storage/pictures)
failed: No such file or directory
Jan 04 17:09:58 OpenELEC systemd-tmpfiles[1943]: stat(/storage/videos) failed:
No such file or directory
Jan 04 17:09:58 OpenELEC systemd[1]: systemd-tmpfiles-setup.service: main
process exited, code=exited, status=1/FAILURE
Jan 04 17:09:58 OpenELEC systemd[1]: Failed to start Create Volatile Files and
Directories.
Jan 04 17:09:58 OpenELEC systemd[1]: Unit systemd-tmpfiles-setup.service
entered failed state.
Jan 04 17:09:58 OpenELEC systemd[1]: systemd-tmpfiles-setup.service failed.
OpenELEC:~/.config/system.d #
Full journalctl output is here:
http://sprunge.us/iAdO
Thanks
Rainer
--
Rainer Dorsch
http://bokomoko.de/
More information about the systemd-devel
mailing list