When troubleshooting Debian systems, having access to complete boot messages is crucial. The traditional dmesg
output only captures kernel ring buffer messages, missing critical components like udev events, syslog entries, and early userspace initialization.
To capture all boot messages systematically, we need to combine several techniques:
# Method 1: Persistent journalctl (systemd systems)
journalctl --boot --no-pager > /var/log/full_boot.log
# Method 2: Serial console redirection (for early boot)
console=ttyS0,115200n8 earlyprintk=serial,ttyS0,115200
Modify /etc/rsyslog.conf
to ensure all facilities are logged during boot:
# Enable imklog for kernel messages
module(load="imklog")
# Log everything to a dedicated boot file
if $syslogtag contains 'kernel' then {
action(type="omfile" file="/var/log/kernel-boot.log")
}
For systems without systemd, create a custom boot logger:
#!/bin/bash
# /etc/init.d/bootlogger
exec > /var/log/full-boot.log 2>&1
while read line; do
echo "[$(date '+%b %d %H:%M:%S')] $line"
done
To specifically capture udev messages that often appear in syslog but not dmesg:
# Create udev rule to log all events
echo 'ACTION=="*", RUN+="/bin/logger -t udev \"%k %p %b\""' > \
/etc/udev/rules.d/99-log-events.rules
Add these kernel parameters in GRUB for verbose logging:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash loglevel=7 debug earlyprintk=vga"
Combine all logs into a single timeline:
#!/bin/bash
{
cat /var/log/boot.log
journalctl -b --no-pager
dmesg
grep -h 'udev' /var/log/syslog*
} | sort -k 1,2 > /var/log/full_boot_analysis.txt
When troubleshooting Debian systems, many developers find themselves needing to review all boot messages, not just partial logs. The default logging mechanisms often split messages across multiple files (/var/log/syslog
, /var/log/daemon.log
, /var/log/kern.log
), making comprehensive analysis difficult.
For modern Debian systems using systemd, the most comprehensive method is:
journalctl -b
To filter specific boot:
journalctl -b -1 # Previous boot
journalctl -b 0 # Current boot
For kernel-specific messages:
journalctl -k --boot=0
For older sysvinit systems, configure bootlogd
:
sudo apt install bootlogd
echo "BOOTLOGD_ENABLE=yes" | sudo tee -a /etc/default/bootlogd
This will create /var/log/boot
containing early boot messages.
To capture the complete kernel ring buffer before it's overwritten:
dmesg -T > /var/log/dmesg-full.log
For persistent storage across reboots, add to /etc/rc.local
:
dmesg -T > /var/log/dmesg-$(date +%Y%m%d-%H%M%S).log
Create a consolidated boot log script (/usr/local/bin/fullbootlog
):
#!/bin/bash
{
echo "=== DMESG OUTPUT ==="
dmesg -T
echo "=== SYSTEMD JOURNAL ==="
journalctl -b 0 --no-pager
echo "=== SYSLOG FILES ==="
cat /var/log/syslog /var/log/daemon.log /var/log/kern.log | grep -a "$(date -d @$(stat -c %X /var/log/syslog) +'%b %d %H:%M')"
} | less
Make executable:
chmod +x /usr/local/bin/fullbootlog
For udev warnings like SYSFS{}= will be removed
, add udev rules debugging:
udevadm control --log-priority=debug
journalctl -u systemd-udevd --no-pager