[systemd-devel] How to debug this strange issue about "systemd"?

sean xrfu at suse.com
Wed Jul 15 08:03:02 PDT 2015


Hi All:
	I am trying to test the latest upstream kernel, But i encounter a strange issue about systemd.
When the "systemd" extracted from initrd image mounts the real root file system "hda.img" on "/sysroot" and changes root to the new directory,  it can not found "/sbin/init" and "/bin/sh".
In fact, These two files exist in the "hda.img".
How to debug this issue?
Why does not it enter emergency mode?
If enter emergency mode, maybe this issue become easy.

qemu command line:
qemu-kvm -D /tmp/qemu-kvm-machine.log -m 1024M -append "root=UUID=20059b62-2542-4a85-80cf-41da6e0c1137 rootflags=rw rootfstype=ext4 debug debug_objects console=ttyS0,115200n8 console=tty0
 rd.debug rd.shell=1 log_buf_len=1M systemd.unit=emergency.target systemd.log_level=debug systemd.log_target=console" -kernel ./qemu_platform/bzImage -hda ./qemu_platform/hda.img 
-initrd ./qemu_platform/initrd-4.1.0-rc2-7-desktop+ -device e1000,netdev=network0 -netdev user,id=network0 -serial file:/home/sean/work/source/upstream/kernel.org/ttys0.txt

Job initrd-switch-root.target/start finished, result=done
Accepted new private connection.
Got message type=signal sender=n/a destination=n/a object=/org/freedesktop/systemd1/agent interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cookie=0 error=n/a
Got disconnect on private connection.
Received SIGCHLD from PID 520 (plymouth).
Child 520 (plymouth) died (code=exited, status=0/SUCCESS)
Child 520 belongs to plymouth-switch-root.service
plymouth-switch-root.service: main process exited, code=exited, status=0/SUCCESS
plymouth-switch-root.service changed start -> dead
Job plymouth-switch-root.service/start finished, result=done
plymouth-switch-root.service: cgroup is empty
ConditionPathExists=/etc/initrd-release succeeded for initrd-switch-root.service.
About to execute: /usr/bin/systemctl --no-block --force switch-root /sysroot
Forked /usr/bin/systemctl as 527
initrd-switch-root.service changed dead -> start
Accepted new private connection.
Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 object=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=SwitchRoot cookie=1 reply_cookie=0 error=n/a
Sent message type=method_return sender=n/a destination=n/a object=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 error=n/a
Serializing state to /run/systemd
Switching root.
Closing left-over fd 21
Closing left-over fd 22
Closing left-over fd 23
Closing left-over fd 26
Closing left-over fd 27
No /sbin/init, trying fallback
Failed to execute /bin/sh, giving up: No such file or directory

sean at linux-dunz:~/work/source/upstream/kernel.org/qemu_platform> sudo mount -o loop ./hda.img ./hda
sean at linux-dunz:~/work/source/upstream/kernel.org/qemu_platform> ls -l ./hda/sbin/init
lrwxrwxrwx 1 sean users 26 Jul 14 22:49 ./hda/sbin/init -> ../usr/lib/systemd/systemd
sean at linux-dunz:~/work/source/upstream/kernel.org/qemu_platform> ls -l ./hda/bin/sh
lrwxrwxrwx 1 sean users 4 Oct 26  2014 ./hda/bin/sh -> bash

sean at linux-dunz:~/work/source/upstream/kernel.org/qemu_platform> lsinitrd ./initrd-4.1.0-rc2-7-desktop+ |grep "sbin\/init"
-rwxr-xr-x   1 root     root         1223 Nov 27  2014 sbin/initqueue
lrwxrwxrwx   1 root     root           26 Jul 14 21:00 sbin/init -> ../usr/lib/systemd/systemd
sean at linux-dunz:~/work/source/upstream/kernel.org/qemu_platform> lsinitrd ./initrd-4.1.0-rc2-7-desktop+ |grep "bin\/sh"
lrwxrwxrwx   1 root     root            4 Jul 14 21:00 bin/sh -> bash



-- 
Sean. XinRong Fu
Dedicate System Engineer
SUSE
xrfu at suse.com
(P)+86 18566229618


line

SUSE



-- 
Sean. XinRong Fu
Dedicate System Engineer
SUSE
xrfu at suse.com
(P)+86 18566229618


line

SUSE





More information about the systemd-devel mailing list