You are not logged in.

#1 2015-01-17 05:52:58

iaw4
Member
Registered: 2014-11-28
Posts: 46

systemd journald logging before /sbin/init?

dear arch experts---I understand that I have an initrd stage that eventually invokes /sbin/init (which is systemd) on a switch_root.  the initrd stage can echo various log information, too.  so, now I am curious: how can the pre-systemd process log output be logged to journald?  can the pre-systemd initrd write to an area of RAM that survives the switch_root and will then be picked up by journald as soon as journald becomes available? 

sincerely,  /iaw

Offline

#2 2015-01-17 14:58:35

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: systemd journald logging before /sbin/init?

Probably this:

In this page we attempt to roughly describe the interfaces that exist between the initrd and systemd. These interfaces are currently used by dracut and the ?ArchLinux initrds.
- The initrd should mount /run as a tmpfs and pass it pre-mounted when jumping into the main system when executing systemd. The mount options should be mode=755,nodev

http://www.freedesktop.org/wiki/Softwar … Interface/

Would have to re-check the mkinitcpio sources (bash scripts) to see how it "passes over".

There's even more information logged, before systemd actually starts, e.g. from Kernel. (http://0pointer.de/blog/projects/journalctl.html)
You can see that in your log, there's alot of information before:

[...] systemd[1]: systemd 217 running in system mode. (+PAM -AUDIT -SELINUX -IMA -APPARMOR [...]

Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#3 2015-01-17 15:41:20

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: systemd journald logging before /sbin/init?

If you're using systemd in your initramfs, then you already get early userspace logging via journald. Otherwise, mkinitcpio(8) documents the rd.log parameter, which can log to kmsg (journald will pick this up later).

Offline

#4 2015-01-17 16:07:14

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: systemd journald logging before /sbin/init?

Thanks falconindy for this explanation.
Does the /run tmpfs remains "intact/usable" as well after the switch_root ?
I suppose/ask because rd.log=file writes to /run/initramfs/init.log and switch_root(8) only mentions /proc, /dev and /sys...

iaw4: Additionally, you can see the respective mkinitcpio source lines here: https://projects.archlinux.org/mkinitcp … tions#n380

Last edited by rebootl (2015-01-17 16:08:50)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#5 2015-01-17 16:53:57

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: systemd journald logging before /sbin/init?

switch_root's documentation is out of date. /run survives the pivot to the new root as well.

Offline

#6 2015-01-17 17:56:12

iaw4
Member
Registered: 2014-11-28
Posts: 46

Re: systemd journald logging before /sbin/init?

thanks to both of you.  should I drop a note to jones, katz, and kak about the docs here?

Offline

#7 2015-01-17 18:45:55

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: systemd journald logging before /sbin/init?

Why not. Though, a bug/issue report would seem appropriate to me.

Maybe here: https://github.com/karelzak/util-linux

Regards


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#8 2015-01-18 16:06:13

iaw4
Member
Registered: 2014-11-28
Posts: 46

Re: systemd journald logging before /sbin/init?

done.

I also mentioned that some docs about rescuing info across the pivot would be nice.

PS: I couldn't help myself but to mention that I would love some basic sanity checks before deleting the old root.  chances are that switch_root should not be used to pivot away from /dev/sda1 if it recursively deletes the old root directory.  then again, maybe it already does this, and the documentation that talks about deleting the old root here is outdated, too.

Offline

Board footer

Powered by FluxBB