aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-08-28 17:22:56 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-08-28 18:35:59 +0200
commit88e1dd1c2ab49f232fed596927c15c3781fc6b28 (patch)
tree487c3c67b533396815cd96b9c5ec727f71249f3c /defaults
parentdefaults/linuxrc: Try to determine filesystem type (diff)
downloadgenkernel-88e1dd1c2ab49f232fed596927c15c3781fc6b28.tar.gz
genkernel-88e1dd1c2ab49f232fed596927c15c3781fc6b28.tar.bz2
genkernel-88e1dd1c2ab49f232fed596927c15c3781fc6b28.zip
defaults/linuxrc: Add gksosreport
To help debugging, 'gksosreport' was added (idea was borrowed from dracut): Whenever a user run into a problem and get to a rescue shell, running "gksosreport" will generate /run/initramfs/gksosreport.txt containing useful debug information suitable to attach to bug reports. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'defaults')
-rw-r--r--defaults/gksosreport.sh74
-rw-r--r--defaults/initrd.scripts20
-rw-r--r--defaults/linuxrc4
3 files changed, 91 insertions, 7 deletions
diff --git a/defaults/gksosreport.sh b/defaults/gksosreport.sh
new file mode 100644
index 0000000..03b44b6
--- /dev/null
+++ b/defaults/gksosreport.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+echo 'Generating "/run/initramfs/gksosreport.txt" ...'
+
+if [ ! -d /run/initramfs ]
+then
+ mkdir -p /run/initramfs
+ chmod 0750 /run/initramfs
+fi
+
+exec >/run/initramfs/gksosreport.txt 2>&1
+
+PWFILTER='s/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'
+
+echo "Genkernel SOS report from $(date +'%Y-%m-%d %H:%M:%S'):"
+
+set -x
+
+cat /lib/dracut/dracut-gk-version.info
+
+cat /lib/dracut/build-parameter.txt
+
+cat /proc/cmdline | sed -e "${PWFILTER}"
+
+[ -f /etc/cmdline ] && cat /etc/cmdline | sed -e "${PWFILTER}"
+
+lspci -k
+
+lsmod
+
+find /lib/modules/$(uname -r) -type f
+
+cat /proc/self/mountinfo
+cat /proc/mounts
+
+blkid
+blkid -o udev
+
+ls -l /dev/disk/by*
+
+if hash lvm >/dev/null 2>/dev/null
+then
+ lvm pvdisplay
+ lvm vgdisplay
+ lvm lvdisplay
+fi
+
+if hash dmsetup >/dev/null 2>/dev/null
+then
+ dmsetup ls --tree
+fi
+
+if [ -e /proc/mdstat ]
+then
+ cat /proc/mdstat
+fi
+
+if hash cryptsetup >/dev/null 2>/dev/null
+then
+ if [ -e /dev/mapper/root ]
+ then
+ cryptsetup status /dev/mapper/root
+ fi
+fi
+
+if hash ip >/dev/null 2>/dev/null
+then
+ ip link
+ ip addr
+fi
+
+dmesg | sed -e "${PWFILTER}"
+
+[ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log | sed -e "${PWFILTER}"
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 36f4791..7a84755 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -983,7 +983,7 @@ check_loop() {
bad_msg 'Please export LOOP with a valid location, or reboot and pass a proper loop=...'
bad_msg 'kernel command line!'
- run_shell
+ run_emergency_shell
fi
}
@@ -1001,6 +1001,14 @@ run() {
return ${retval}
}
+run_emergency_shell() {
+ echo
+ gksosreport
+ good_msg 'You might want to save "/run/initramfs/gksosreport.txt" to a USB stick or /boot'
+ good_msg 'after mounting them and attach it to a bug report.'
+ run_shell
+}
+
run_shell() {
if [ -f "${GK_USERINTERACTION_DISABLED_STATEFILE}" ]
then
@@ -1092,7 +1100,7 @@ test_success() {
error_string=${1}
error_string="${error_string:-Failed to run command}"
bad_msg "${error_string}; Failing back to the shell ..."
- run_shell
+ run_emergency_shell
fi
}
@@ -1347,7 +1355,7 @@ prompt_user() {
'shell')
eval ${1}'='${oldvalue}
warn_msg "To leave and try again just press <Ctrl>+D"
- run_shell
+ run_emergency_shell
;;
'')
eval ${1}'='${oldvalue}
@@ -1799,7 +1807,7 @@ openLUKS() {
# if crypt_silent=1 and some error occurs, enter shell quietly
elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 1 \) -o \( ${KEY_ERROR} -eq 1 \) \) -o \( ${KEYDEV_ERROR} -eq 1 \) \) ]
then
- run_shell
+ run_emergency_shell
elif [ ${DEV_ERROR} -eq 1 ]
then
prompt_user "LUKS_DEVICE" "${LUKS_NAME}"
@@ -2487,7 +2495,7 @@ cdupdate() {
if [ "$?" != '0' ]
then
bad_msg "Executing cdupdate.sh failed!"
- run_shell
+ run_emergency_shell
fi
else
good_msg 'No cdupdate.sh script found, skipping ...'
@@ -2511,6 +2519,8 @@ rundebugshell() {
if is_debug
then
good_msg 'Starting debug shell as requested by "debug" option.'
+ good_msg "Run '${BOLD}gksosreport${NORMAL}' to generate debug report"
+ good_msg "in case you want to file a bug report."
else
return 0
fi
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 061d3e0..e96b637 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -1071,7 +1071,7 @@ then
grep -Fq squashfs /proc/filesystems || \
bad_msg "HINT: Your kernel does not know filesystem \"squashfs\"."
fi
- run_shell
+ run_emergency_shell
}
fi
@@ -1188,7 +1188,7 @@ FSTAB
) ||
{
bad_msg "Copying failed, dropping into a shell."
- run_shell
+ run_emergency_shell
}
# Now we do the links.