On Wed, Feb 3, 2016 at 2:18 AM, Roger Shimizu <[email protected]> wrote: > Dear Ben, > > On Wed, Feb 3, 2016 at 2:00 AM, Ben Hutchings <[email protected]> wrote: >> On Wed, 2016-02-03 at 01:50 +0900, Roger Shimizu wrote: >>> Dear initramfs-tools maintainer, >>> >>> By command "exec >/dev/kmsg 2>&1" in init, which was introduced by >>> commit 3acddc [0], kernel messages can all redirected to netconsole >>> with no problem. >>> >>> I want some bit more, that to redirect service start/stop messages >>> from sysvinit/systemd to netconsole as well. >>> >>> I already tried to replace ">${rootmnt}/dev/console" with >>> ">${rootmnt}/dev/kmsg" in the final block of "init" script, but with >>> no luck. >>> I'm now wondering whether it's possible under initramfs-tools. >>> Maybe the right way is to hack systemd/sysvinit? >>> >>> [0]: >>> https://anonscm.debian.org/cgit/kernel/initramfs-tools.git/commit/?id=3acddcce9763192ffd169b32a511542adf1282f2 >> >> run-init resets the standard error streams. You could try adding >> "-c /dev/kmsg" to the run-init command line. > > Thanks for your feedback! > > However, I add "-c /dev/kmsg", and the command looks like: > exec run-init -c /dev/kmsg ${drop_caps} ${rootmnt} ${init} "$@" > <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1 > > The result is kernel panic: > > [ 8.064410] Kernel panic - not syncing: Attempted to kill init! > exitcode=0x00000100 > [ 8.064410] > [ 8.073562] CPU: 0 PID: 1 Comm: run-init Not tainted > 3.16.0-4-kirkwood #1 Debian 3.16.7-ckt20-1+deb8u3 > [ 8.082889] [<c00100c4>] (unwind_backtrace) from [<c000c45c>] > (show_stack+0x18/0x1c) > [ 8.090642] [<c000c45c>] (show_stack) from [<c03abda0>] (panic+0x80/0x1f8) > [ 8.097536] [<c03abda0>] (panic) from [<c001bcac>] (do_exit+0x470/0x884) > [ 8.104253] [<c001bcac>] (do_exit) from [<c001c0fc>] > (do_group_exit+0x0/0xb4) > [ 8.111396] [<c001c0fc>] (do_group_exit) from [<c0009400>] > (ret_fast_syscall+0x0/0x34)
I guess it's because /dev/kmsg is simply not a console device. What I need is a console device of netconsole, so I find one patch [1], which unfortunately is finally rejected, however it mentioned "ttyprintk" at last. After tracing a bit, and find ttyprintk has been made as module [2][3], but debian kernel doesn't enable it yet. Do I need submit a ticket to include this feature? Or mailing list discussion/request is fine? [1]: https://patchwork.ozlabs.org/patch/336410/ [2]: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7d1c28 [3]: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b24313 Cheers, -- Roger Shimizu, GMT +9 Tokyo PGP/GPG: 17B3ACB1

