Linux kernel boot message

Display Recent and Old Kernel Messages

During the Linux boot process, the standard system logging facilities are not available, so kernel messages can only be written to the console [1] and stored in memory (thekernel ring buffer) [2] for subsequent writing to disk.
Once the standard system logging facilities [3] start, they take over management of kernel messages and write the messages the kernel created during boot-up to /var/log/dmesg . From this point on, you can read the kernel messages from the standard system logfile /var/log/messages by looking for the keyword kernel .

The dmesg command

[root @localhost/root]# dmesg |tail -10

Even with the standard system logging facilities running, the kernel still uses its ring buffer to log system messages. If you want to view recent kernel messages without going to the standard logfiles, use the dmesg command.

Displaying kernel Messages

View the table below to see the various methods to show recent and old kernel messages, the logfiles the command reads from (if any), and a description.
View the table below to see the last 10 messages created by a typical Linux kernel.

Kernel Messages

Kernel Debugging Techniques

Debugging the kernel can be achieved using very simple and straight forward techniques and some time, patience and perseverance. This page describes techniques to help debug the kernel.

Using printk

The simplest, and probably most effective way to debug the kernel is via printk().
This enables one to print messages to the console, and it very similar to printf(). Note that printk() can slow down the execution of code which can alter the way code runs, for example, changing the way race conditions occur.

Changing the ring buffer size

The internal kernel console message buffer can sometimes be too small to capture all of the printk messages, especially when debug code generates a lot of printk messages. If the buffer fills up, it wraps around and one can lose valueable debug messages. To increase the internal buffer, use the kernel boot parameter:

Changing debug levels

One can specify the type of printk() log level by pre-pending the 1st printk() argument with one of the following:

KERN_EMERG /* system is unusable */ KERN_ALERT /* action must be taken immediately */ KERN_CRIT /* critical conditions */ KERN_ERR /* error conditions */ KERN_WARNING /* warning conditions */ KERN_NOTICE /* normal but significant condition */ KERN_INFO /* informational */ KERN_DEBUG /* debug-level messages */ for example, printk(KERN_DEBUG "example debug message\n");

Serial Console

Serial console enables one to dump out console messages over a serial cable. Most modern PCs do not have legacy serial ports, so instead, one can use a USB serial dongle instead. A «null serial cable» or «universal file transfer cable» is needed to connect the target computer with the host. Most commonly this will be a DB9 female to DB9 female null serial cable. In addition, one needs to enable USB serial support as a kernel build configuration:

CONFIG_USB_SERIAL_CONSOLE=y CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_PL2303=y

one may need to adjust the baud rate appropriately. Note: Generally, there is NO hardware or software flow control on serial console drivers, which means one may get dropped characters when running very high speed tty baud rates, such as 115200 baud.

Читайте также:  Asus vivobook linux ubuntu

The next lesson explains how to examine a system log.

[2]Kernel ring buffer: The kernel ring buffer is an area of kernel memory with fixed size that holds the kernel’s log message. As the kernel logs messages, older logs are overwritten.

[3]Facility: Facilities are simply programs that can be configured to send notices to the system log. Common facilities include user, kern, mail, daemon, auth, lpr, news, uucp, and cron.

Источник

How to show kernel boot messages by modifying grub config files

/etc/default/grub on OpenSUSE Leap 42.2 is like below. How can I change this file in order to be able to see boot-time kernel messages:

# If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg' afterwards to update # /boot/grub2/grub.cfg. # Uncomment to set your own custom distributor. If you leave it unset or empty, the default # policy is to determine the value from /etc/os-release GRUB_DISTRIBUTOR= GRUB_DEFAULT=saved GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=8 GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda4 splash=silent quiet showopts" GRUB_CMDLINE_LINUX="" # Uncomment to automatically save last booted menu entry in GRUB2 environment # variable `saved_entry' # GRUB_SAVEDEFAULT="true" #Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD . ) # GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" #Uncomment to disable graphical terminal (grub-pc only) GRUB_TERMINAL="gfxterm" # The resolution used on graphical terminal #note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo' GRUB_GFXMODE="auto" # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux # GRUB_DISABLE_LINUX_UUID=true #Uncomment to disable generation of recovery mode menu entries # GRUB_DISABLE_LINUX_RECOVERY="true" #Uncomment to get a beep at grub start # GRUB_INIT_TUNE="480 440 1" GRUB_BACKGROUND=/boot/grub2/themes/openSUSE/background.png GRUB_THEME=/boot/grub2/themes/openSUSE/theme.txt SUSE_BTRFS_SNAPSHOT_BOOTING="true" GRUB_USE_LINUXEFI="true" GRUB_DISABLE_OS_PROBER="false" GRUB_ENABLE_CRYPTODISK="n" 

1 Answer 1

Removing quiet and splash generally does the job. Change this:

GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda4 splash=silent quiet showopts" 
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda4 showopts" 

I actually use initcall_debug and no_console_suspend too to get as much detail as possible for debugging, but if everything is working smoothly, those extra parameters won’t make any difference.

Читайте также:  Самые быстрые линуксы 2019

Don’t forget to run grub2-mkconfig -o /boot/grub2/grub.cfg after changing the file.

Источник

Kernel boot messages

When a UNIX kernel is booting, it will display messages on the main console about what it is doing. Under Linux, these messages are also sent to the file /var/log/dmesg. The following is a copy of the boot messages on my machine.

Examine the messages that your kernel displays during boot up and compare them with mine. You will see in the messages below the output of some of the process explained above.

Linux version 2.4.18-14 ( [email protected] ) (gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)) #1 Wed S ep 4 11:57:57 EDT 2002 BIOS-provided physical RAM map:

00000000000a0000 0000000000100000 0000000008000000 0000000100000000

(usable) (reserved) (usable) (reserved)

BIOS-e820: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 BIOS-e820: 0 0 0 0 0 0 0 0 0 0 0f0000 BIOS-e820: 0000000000100000 BIOS-e820: 0 0 0 0 0 0 0 0ffff0000 128MB LOWMEM available. On node 0 totalpages: 32768 zone(0): 4096 pages. zone(1): 28672 pages. zone(2): 0 pages.

Kernel command line: ro root=LABEL=/ Initializing CPU#0 Detected 200.458 MHz processor.

Speakup v-1.00 CVS: Tue Jun 11 14:22:53 EDT 2002 Console: colour VGA+ 80×25 Calibrating delay loop. 399.76 BogoMIPS

Memory: 125164k/13107 2k available (1193k kernel code, 4500k reserved, 984k data, 200k init, 0k highmem)

Dentry cache hash table entries: 16384 (order: 5, 131072 bytes) Inode cache hash table entries: 8192 (order: 4, 65536 bytes) Mount cache hash table entries: 2048 (order: 2, 16384 bytes) ramfs: mounted with options:

ramfs: max_pages=157 7 3 max_file_pages=0 max_inodes=0 max_dentries=15773 Buffer cache hash table entries: 8192 (order: 3, 32768 bytes) Page-cache hash table entries: 32768 (order: 5, 131072 bytes) CPU: Before vendor init, caps: 008001bf 00000000 00000000, vendor = 0 Intel Pentium with F0 0F bug — workaround enabled. CPU: After vendor init, caps: 008001bf 00000000 00000000 00000000 CPU: After generic, caps: 008001bf 00000000 00000000 00000000 CPU: Common caps: 008001bf 00000000 00000000 00000000

CPU: Intel Pentium MMX stepping 03 Checking ‘hlt’ instruction. OK. POSIX conformance testing by UNIFIX mtrr: v1.40 (20010327) Richard Gooch mtrr: detected mtrr type: none PCI PCI PCI PCI

PCI BIOS revision 2.10 entry at Using configuration type 1 Probing PCI hardware Using IRQ router VIA [1106/0586] Activating ISA DMA hang workarounds. isapnp: Scanning for PnP cards.

isapnp: Card ‘ESS ES1868 Plug and Play AudioDrive’ isapnp: 1 Plug & Play card detected total speakup: initialized device: /dev/synth, node (MAJOR 10, MINOR 25) Linux NET4.0 for Linux 2.4

Based upon Swansea University Computer Society NET3.039 Initializing RT netlink socket apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16) Starting kswapd

VFS: Diskquotas version dquot_6.5.0 initialized

pty: 512 Unix98 ptys configured

Serial driver version 5.05c (2001-07-08) with MANY_PORTS MULTIPORT SHARE_IRQ SERIAL_PCI ISAPNP enabled ttyS0 at 0x03f8 (irq = 4) is a 16550A ttyS1 at 0x02f8 (irq = 3) is a 16550A Real Time Clock Driver v1.10e block: 240 slots per queue, batch=60 Uniform Multi-Platform E-IDE driver Revision: 6.31 ide: Assuming 33MHz system bus speed for PIO modes;

Читайте также:  Ubuntu команды для терминала linux

VP_IDE: IDE controller on PCI bus 00 dev 39 VP_IDE: chipset revision 6

VP_IDE: not 100% native mode: will probe irqs later ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx VP_IDE: VIA vt82c58 6a (rev 25) IDE UDMA33 controller on pci00:07.1 ide0: BM-DMA at 0x6000-0x6007, BIOS settings: hda:pio, hdb:pio idel: BM-DMA at 0x6008-0x600f, BIOS settings: hdc:pio, hdd:pio ide: ESS ES1868 Plug and Play AudioDrive activate failed hda: ST340016A, ATA DISK drive hdc: CD-ROM 4 0X/AKU, ATAPI CD/DVD-ROM drive ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 idel at 0x170-0x177,0x376 on irq 15

setmax LBA 78165360, native

66055248 sectors (33820 MB) w/2048KiB Cache, ide-floppy driver 0.99.newide Partition check:

hda: hda1 hda2 hda3 hda4 < hda5 hda6 hda7 >Floppy drive(s): fd0 is 1.44M

FDC 0 is a post-1991 82077 NET4: Frame Diverter 0.4 6

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize ide-floppy driver 0.99.newide md: md driver 0.90.0 MAX_MD_DEVS=25 6, MD_SB_DISKS=27

md: Autodetecting RAID arrays.

IP Protocols: ICMP, UDP, TCP, IGMP

IP: routing cache hash table of 1024 buckets, 8Kbytes

TCP: Hash tables configured (established 8192 bind 16384)

Linux IP multicast router 0.06 plus PIM-SM

NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.

RAMDISK: Compressed image found at block 0

Freeing initrd memory: 125k freed

VFS: Mounted root (ext2 filesystem).

Journalled Block Device driver loaded kjournald starting. Commit interval 5 seconds

EXT3-fs: mounted filesystem with ordered data mode.

Freeing unused kernel memory: 200k freed usb.c: registered new driver usbdevfs usb.c: registered new driver hub usb-uhci.c: $Revision: 1.275 $ time 12:17:47 Sep 4 2002 usb-uhci.c: High bandwidth mode enabled usb-uhci.c: USB UHCI at I/O 0x6400, IRQ 11 usb-uhci.c: Detected 2 ports usb.c: new USB bus registered, assigned bus number 1 hub.c: USB hub found hub.c: 2 ports detected usb-uhci.c: v1.275:USB Universal Host Controller Interface driver usb.c: registered new driver hiddev usb.c: registered new driver hid hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik <[email protected] >

hid-core.c: USB HID support drivers mice: PS/2 mouse device common for all mice

EXT3 FS 2.4-0.9.18, 14 May 2002 on ide0(3,5), internal journal Adding Swap: 257000k swap-space (priority -1) kjournald starting. Commit interval 5 seconds

EXT3 FS 2.4-0.9.18, 14 May 2002 on ide0(3,1), internal journal EXT3-fs: mounted filesystem with ordered data mode. kjournald starting. Commit interval 5 seconds

EXT3 FS 2.4-0.9.18, 14 May 2002 on ide0(3,3), internal journal EXT3-fs: mounted filesystem with ordered data mode. kjournald starting. Commit interval 5 seconds

EXT3 FS 2.4-0.9.18, 14 May 2002 on ide0(3,2), internal journal EXT3-fs: mounted filesystem with ordered data mode. kjournald starting. Commit interval 5 seconds

EXT3 FS 2.4-0.9.18, 14 May 2002 on ide0(3,6), internal journal EXT3-fs: mounted filesystem with ordered data mode.

Источник

Оцените статью
Adblock
detector