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

Rainer Dorsch ml at bokomoko.de
Mon Jan 4 07:00:30 PST 2016


Hi Zbyszek,

thanks for your reply.

On Monday 04 January 2016 13:46:26 Zbigniew Jędrzejewski-Szmek wrote:
> On Mon, Jan 04, 2016 at 04:25:14PM +0300, Andrei Borzenkov wrote:
> > 04.01.2016 14:26, Rainer Dorsch пишет:
> > > 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
> > 
> > This creates dependency loop. systemd-tmpfiles-setup.service is ordered
> > After local-fs.target and mount units by default are ordered Before
> > local-fs.target.
> 
> No, that looks OK. It's *Before* s-tmpfiles-setup.service, so
> there should be no loop.
> 
> Conflicts=umount.target, Requires=storage.mount, After=storage.mount
> are added automatically, unless DefaultDependencies=false. So those
> settings are not necessary but they should be harmless.
> 
> I don't see anything wrong in your setup... Can you paste the full
> boot logs 

Is that the output of journalctl ?

http://sprunge.us/LdVV

> and
> 'systemctl show storage-.kodi-.local-storage-sdcard.mount'?

OpenELEC:~ # systemctl show storage-.kodi-.local-storage-sdcard.mount --no-
pager
Where=/storage/.kodi/.local/storage/sdcard
What=/dev/mmcblk0p1
Options=rw,relatime,data=ordered
Type=ext4
TimeoutUSec=1min 30s
ControlPID=0
DirectoryMode=0755
SloppyOptions=no
Result=success
ExecMount={ path=/bin/mount ; argv[]=/bin/mount /dev/mmcblk0p1 
/storage/.kodi/.local/storage/sdcard -n -t ext4 ; ignore_errors=no ; 
start_time=[Mon 2016-01-04 15:51:43 CET] ; stop_time=[Mon 2016-01-04 15:51:43 
CET] ; pid=2075 ; code=exited ; status=0 }
Slice=system.slice
ControlGroup=/system.slice/storage-.kodi-.local-storage-sdcard.mount
MemoryCurrent=18446744073709551615
Delegate=no
CPUAccounting=no
CPUShares=18446744073709551615
StartupCPUShares=18446744073709551615
CPUQuotaPerSecUSec=infinity
BlockIOAccounting=no
BlockIOWeight=18446744073709551615
StartupBlockIOWeight=18446744073709551615
MemoryAccounting=no
MemoryLimit=18446744073709551615
DevicePolicy=auto
UMask=0022
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=4096
LimitAS=18446744073709551615
LimitNPROC=6829
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=6829
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=journal
StandardError=inherit
TTYReset=no
TTYVHangup=no
TTYVTDisallocate=no
SyslogPriority=30
SyslogLevelPrefix=yes
SecureBits=0
CapabilityBoundingSet=18446744073709551615
MountFlags=0
PrivateTmp=no
PrivateNetwork=no
PrivateDevices=no
ProtectHome=no
ProtectSystem=no
SameProcessGroup=yes
IgnoreSIGPIPE=yes
NoNewPrivileges=no
SystemCallErrorNumber=0
RuntimeDirectoryMode=0755
KillMode=control-group
KillSignal=15
SendSIGKILL=yes
SendSIGHUP=no
Id=storage-.kodi-.local-storage-sdcard.mount
Names=storage-.kodi-.local-storage-sdcard.mount
Wants=system.slice
BindsTo=dev-mmcblk0p1.device
WantedBy=local-fs.target dev-mmcblk0p1.device
Conflicts=umount.target
Before=umount.target systemd-tmpfiles-setup.service
After=local-fs-pre.target storage.mount -.mount systemd-journald.socket 
system.slice dev-mmcblk0p1.device
RequiresMountsFor=/storage/.kodi/.local/storage /dev/mmcblk0p1
Description=sdcard mount script
LoadState=loaded
ActiveState=active
SubState=mounted
FragmentPath=/storage/.config/system.d/storage-.kodi-.local-storage-
sdcard.mount
UnitFileState=enabled
UnitFilePreset=enabled
InactiveExitTimestamp=Mon 2016-01-04 15:51:43 CET
InactiveExitTimestampMonotonic=105326827
ActiveEnterTimestamp=Mon 2016-01-04 15:51:43 CET
ActiveEnterTimestampMonotonic=105361076
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
CanStart=yes
CanStop=yes
CanReload=yes
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureJobMode=replace
IgnoreOnIsolate=yes
IgnoreOnSnapshot=no
NeedDaemonReload=no
JobTimeoutUSec=0
JobTimeoutAction=none
ConditionResult=yes
AssertResult=yes
ConditionTimestamp=Mon 2016-01-04 15:51:43 CET
ConditionTimestampMonotonic=105314668
AssertTimestamp=Mon 2016-01-04 15:51:43 CET
AssertTimestampMonotonic=105314708
Transient=no
OpenELEC:~ # 

Thanks
Rainer


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


More information about the systemd-devel mailing list