open_log: print logs to /dev/ttyprintk

- A complete boot log (both early userspace and kernel) is preserved
  and can be obtained via `dmesg`
- Messages are ordered and timestamped, so the log is more clear

Example:

[    5.616453] [U] * /sbin/mount.cifs //10.42.0.4/dist/slinux-9.1-x86_64.iso /image -oguest,vers=1.0
[    5.616932] CIFS: Attempting to mount //10.42.0.4/dist/slinux-9.1-x86_64.iso
[    5.616940] CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers
[    5.621647] CIFS: VFS: Could not allocate crypto cmac(aes)
[    5.623263] CIFS: VFS: Could not allocate crypto cmac(aes)
[    5.626645] [U] mount error(20): Not a directory
[    5.626649] [U] Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
[    5.626747] [U] * assuming ISO image, Samba path://10.42.0.4/dist
[    5.626749] [U] * mounting //10.42.0.4/dist on /image as type cifs
[    5.626753] [U] * cifsmount: attempting to mount //10.42.0.4/dist with default protocol version
[    5.626758] [U] * /sbin/mount.cifs //10.42.0.4/dist /image -oguest
[    5.627299] CIFS: Attempting to mount //10.42.0.4/dist
[    5.629106] CIFS: VFS: Could not allocate crypto cmac(aes)
[    5.631290] CIFS: VFS: Could not allocate crypto cmac(aes)
[    5.638261] CIFS: VFS: \\10.42.0.4 generate_key: crypto alloc failed
[    5.638264] CIFS: VFS: \\10.42.0.4 Send error in SessSetup = -2
[    5.638275] CIFS: VFS: cifs_mount failed w/return code = -2
[    5.638294] [U] mount error(2): No such file or directory
[    5.638296] [U] Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
[    5.638376] [U] * cifsmount: failed, retrying with vers=1.0
[    5.638383] [U] * /sbin/mount.cifs //10.42.0.4/dist /image -oguest,vers=1.0
[    5.639582] CIFS: Attempting to mount //10.42.0.4/dist
[    5.639590] CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers
[    5.649559] [U] * assuming ISO image, path:/image/slinux-9.1-x86_64.iso

Related: #40554
This commit is contained in:
Alexey Sheplyakov 2021-08-24 14:11:21 +04:00
parent a8fa5f19bf
commit 08639c8faf
2 changed files with 3 additions and 3 deletions

4
log.c
View File

@ -71,8 +71,8 @@ void log_perror(char *msg)
void open_log(void)
{
if (!IS_TESTING) {
mknod("/dev/tty3", S_IFCHR, MKDEV(4, 3));
logfile = fopen("/dev/tty3", "w");
mknod("/dev/ttyprintk", S_IFCHR, MKDEV(5, 3));
logfile = fopen("/dev/ttyprintk", "w");
if (!logfile)
logfile = fopen("/tmp/install.log", "a");
}

View File

@ -45,7 +45,7 @@ void init_frontend(char * welcome_msg)
newtDrawRootText(0, 0, welcome_msg);
newtPushHelpLine(" <Alt-F1> for here, <Alt-F3> to see the logs, <Alt-F4> for kernel msg");
newtPushHelpLine(" <Alt-F1> for here, <Alt-F4> to see the logs");
newtRefresh();
}