Browse Source

Add sosreport script and generate /run/initramfs/sosreport.txt

master
Harald Hoyer 12 years ago
parent
commit
64d144aece
  1. 7
      dracut.8.asc
  2. 1
      dracut.asc
  3. 13
      dracut.cmdline.7.asc
  4. 3
      modules.d/98systemd/dracut-emergency.service
  5. 17
      modules.d/99base/dracut-lib.sh
  6. 1
      modules.d/99base/module-setup.sh
  7. 49
      modules.d/99base/sosreport.sh

7
dracut.8.asc

@ -30,6 +30,13 @@ early userspace. @@ -30,6 +30,13 @@ early userspace.

For a complete list of kernel command line options see *dracut.cmdline*(7).

If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/sosreport.txt_ is created, which can be safed to a
(to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.

EXAMPLE
-------


1
dracut.asc

@ -466,6 +466,7 @@ dracut shell commands are printed as they are executed @@ -466,6 +466,7 @@ dracut shell commands are printed as they are executed
----
# journalctl -ab
----
. With dracut >= 025 the file /run/initramfs/sosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.

If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
Then you can store the output for later inspection.

13
dracut.cmdline.7.asc

@ -124,6 +124,12 @@ Misc @@ -124,6 +124,12 @@ Misc
[[dracutkerneldebug]]
Debug
~~~~~
If you are dropped to an emergency shell, the file _/run/initramfs/sosreport.txt_ is created,
which can be safed to a (to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.

**rd.info**::
print informational output though "quiet" is set

@ -131,8 +137,11 @@ Debug @@ -131,8 +137,11 @@ Debug
allow dropping to a shell, if root mounting fails

**rd.debug**::
set -x for the dracut shell and logs to dmesg, console and
_/run/initramfs/init.log_
set -x for the dracut shell.
If systemd is active in the initramfs, all output is logged to the systemd journal,
which you can inspect with "journalctl -ab".
If systemd is not active, the logs are written to dmesg and _/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console.

**rd.break**::
drop to a shell at the end

3
modules.d/98systemd/dracut-emergency.service

@ -15,7 +15,8 @@ DefaultDependencies=no @@ -15,7 +15,8 @@ DefaultDependencies=no
Environment=HOME=/
WorkingDirectory=/
ExecStartPre=-/bin/plymouth quit
ExecStartPre=-/bin/echo -e '\n\nEntering emergency mode. Exit the shell to continue.\nType "journalctl" to view system logs.\n'
ExecStartPre=-/sbin/sosreport
ExecStartPre=-/bin/echo -e '\n\nEntering emergency mode. Exit the shell to continue.\nType "journalctl" to view system logs.\nYou might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot\nafter mounting them and attach it to a bug report.\n\n'
ExecStart=-/bin/sh -i -l
ExecStopPost=-/bin/rm -f /.console_lock
Type=oneshot

17
modules.d/99base/dracut-lib.sh

@ -879,12 +879,23 @@ _emergency_shell() @@ -879,12 +879,23 @@ _emergency_shell()
systemctl start dracut-emergency.service
rm -f /.console_lock
else
echo "Dropping to debug shell."
debug_off
echo
/sbin/sosreport
echo 'You might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot'
echo 'after mounting them and attach it to a bug report.'
if ! RD_DEBUG= getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
echo
echo 'To get more debug information in the report,'
echo 'reboot with "rd.debug" added to the kernel command line.'
fi
echo
echo 'Dropping to debug shell.'
echo
export PS1="$_name:\${PWD}# "
[ -e /.profile ] || >/.profile

_ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
_ctty="$(RD_DEBUG= getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
if [ -z "$_ctty" ]; then
_ctty=console
while [ -f /sys/class/tty/$_ctty/active ]; do
@ -920,7 +931,7 @@ emergency_shell() @@ -920,7 +931,7 @@ emergency_shell()
if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
_emergency_shell $_rdshell_name
else
warn "$action has failed. To debug this issue add \"rd.shell\" to the kernel command line."
warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
# cause a kernel panic
exit 1
fi

1
modules.d/99base/module-setup.sh

@ -32,6 +32,7 @@ install() { @@ -32,6 +32,7 @@ install() {
inst_script "$moddir/init.sh" "/init"
inst_script "$moddir/initqueue.sh" "/sbin/initqueue"
inst_script "$moddir/loginit.sh" "/sbin/loginit"
inst_script "$moddir/sosreport.sh" "/sbin/sosreport"

[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
mkdir -m 0755 -p ${initdir}/lib/dracut

49
modules.d/99base/sosreport.sh

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
#!/bin/sh

echo 'Generating "/run/initramfs/sosreport.txt"'

exec >/run/initramfs/sosreport.txt 2>&1

set -x

cat /proc/self/mountinfo
cat /proc/mounts

blkid
blkid -o udev

ls -l /dev/disk/by*

cat /proc/cmdline

[ -f /etc/cmdline ] && cat /etc/cmdline

for _i in /etc/cmdline.d/*.conf; do
[ -f "$_i" ] || break
echo $_i
cat $_i
done

for _i in /etc/conf.d/*.conf; do
[ -f "$_i" ] || break
echo $_i
cat $_i
done

if command -v lvm >/dev/null 2>/dev/null; then
lvm pvdisplay
lvm vgdisplay
lvm lvdisplay
fi

command -v dmsetup >/dev/null 2>/dev/null && dmsetup ls --tree

cat /proc/mdstat

if command -v journalctl >/dev/null 2>/dev/null; then
journalctl -ab --no-pager
else
dmesg
[ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log
fi

Loading…
Cancel
Save