From: aaron_wri...@selinc.com > 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. > > [Unit] > Description=Test Unit > Requires=initrd-fs.target > After=initrd-fs.target > > [Service] > Type=oneshot > ExecStart=/bin/sh -c "echo hello" > > [Install] > RequiredBy=initrd-switch-root.target > > 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). > > Without this simple oneshot service in initrd, everything works > fine, fsck checks varfs and /var is mounted. Thoughts? > > Is there a better way to position a service to just before switch root?
I followed dracut's example a bit more, and this works a lot better. Not really sure why, but it works now, so yeah! [Unit] Description=Test Unit After=initrd.target Before=initrd-cleanup.service [Service] Type=oneshot ExecStart=/bin/sh -c "echo hello" [Install] RequiredBy=initrd.target
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel