<font size=1 face="Lucida Console">I'm rolling my own initrd, and I'm
trying to run a oneshot service in initrd just before the switch root happens.
I added this unit to the initrd and enabled it.</font>
<br>
<br><font size=1 face="Lucida Console">[Unit]</font>
<br><font size=1 face="Lucida Console">Description=Test Unit</font>
<br><font size=1 face="Lucida Console">Requires=initrd-fs.target</font>
<br><font size=1 face="Lucida Console">After=initrd-fs.target</font>
<br>
<br><font size=1 face="Lucida Console">[Service]</font>
<br><font size=1 face="Lucida Console">Type=oneshot</font>
<br><font size=1 face="Lucida Console">ExecStart=/bin/sh -c "echo
hello"</font>
<br>
<br><font size=1 face="Lucida Console">[Install]</font>
<br><font size=1 face="Lucida Console">RequiredBy=initrd-switch-root.target</font>
<br>
<br><font size=1 face="Lucida Console">The service does run, and I get
"hello" in the journal, but then my /var mount doesn't mount.
I'm having a hard time correlating the two seeming different things. The
var.mount unit complains about a failed dependency. It's dependency is
dev-disk-by\x2dpartlabel-varfs.device, which has no logs, is loaded, but
inactive (dead). There is also a fsck dependency that is loaded, but inactive
(dead).</font>
<br>
<br><font size=1 face="Lucida Console">Without this simple oneshot service
in initrd, everything works fine, fsck checks varfs and /var is mounted.
Thoughts?</font>
<br>
<br><font size=1 face="Lucida Console">Is there a better way to position
a service to just before switch root?</font>