[systemd-devel] initrd-fs.target

Harald Hoyer harald.hoyer at gmail.com
Tue Mar 5 03:17:05 PST 2013


Am 05.03.2013 10:07, schrieb Harald Hoyer:
> Am 05.03.2013 09:56, schrieb Harald Hoyer:
>> Am 05.03.2013 09:17, schrieb Harald Hoyer:
>>> Am 05.03.2013 08:33, schrieb Harald Hoyer:
>>>> For me the sysroot-usr.mount is not mounted in my testsuite unless I patch it
>>>> like mentioned above.
>>>
>>> switch_root:/# ls /sysroot/usr/
>>> switch_root:/# systemctl status sysroot-usr.mount
>>> sysroot-usr.mount - /sysroot/usr
>>> 	  Loaded: loaded (/sysroot/etc/fstab)
>>> 	  Active: inactive (dead)
>>> 	   Where: /sysroot/usr
>>> 	    What: /dev/sdb2
>>>
>>> switch_root:/# systemctl status local-fs.target
>>> local-fs.target - Local File Systems
>>> 	  Loaded: loaded (/usr/lib/systemd/system/local-fs.target; static)
>>> 	  Active: active since Tue 2013-03-05 08:12:17 UTC; 58s ago
>>> 	    Docs: man:systemd.special(7)
>>>
>>> Mar 05 08:12:17 localhost systemd[1]: Starting Local File Systems.
>>> Mar 05 08:12:17 localhost systemd[1]: Job local-fs.target/start finished, r...ne
>>> Mar 05 08:12:17 localhost systemd[1]: Reached target Local File Systems.
>>> switch_root:/# systemctl start local-fs.target
>>> switch_root:/# systemctl status sysroot-usr.mount
>>> sysroot-usr.mount - /sysroot/usr
>>> 	  Loaded: loaded (/sysroot/etc/fstab)
>>> 	  Active: active (mounted) since Tue 2013-03-05 08:13:41 UTC; 2s ago
>>> 	   Where: /sysroot/usr
>>> 	    What: /dev/sdb2
>>> 	 Process: 232 ExecMount=/bin/mount /dev/sdb2 /sysroot/usr -t btrfs -o
>>> subvol=usr,ro (code=exited, status=0/SUCCESS)
>>>
>>> Mar 05 08:13:41 localhost systemd[1]: Mounting /sysroot/usr...
>>> Mar 05 08:13:41 localhost systemd[1]: About to execute /bin/mount /dev/sdb2...ro
>>> Mar 05 08:13:41 localhost systemd[1]: Forked /bin/mount as 232
>>> Mar 05 08:13:41 localhost systemd[1]: sysroot-usr.mount changed dead -> mounting
>>> Mar 05 08:13:41 localhost systemd[1]: sysroot-usr.mount changed mounting ->...ne
>>> Mar 05 08:13:41 localhost systemd[1]: Job sysroot-usr.mount/start finished,...ne
>>> Mar 05 08:13:41 localhost systemd[1]: Mounted /sysroot/usr.
>>> Mar 05 08:13:41 localhost systemd[1]: Child 232 belongs to sysroot-usr.mount
>>> Mar 05 08:13:41 localhost systemd[1]: sysroot-usr.mount mount process exite...=0
>>> Mar 05 08:13:41 localhost systemd[1]: sysroot-usr.mount changed mounting-do...ed
>>>

Resetting all targets to TARGET_DEAD after deserialization helps here without
the manual "restart".

diff --git a/src/core/target.c b/src/core/target.c
index 9814241..960c2a8 100644
--- a/src/core/target.c
+++ b/src/core/target.c
@@ -114,7 +114,7 @@ static int target_coldplug(Unit *u) {
         assert(t->state == TARGET_DEAD);

         if (t->deserialized_state != t->state)
-                target_set_state(t, t->deserialized_state);
+                target_set_state(t, t->state);

         return 0;
 }



More information about the systemd-devel mailing list