From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/, /
Date: Fri, 28 Aug 2020 20:18:46 +0000 (UTC) [thread overview]
Message-ID: <1598632559.88e1dd1c2ab49f232fed596927c15c3781fc6b28.whissi@gentoo> (raw)
commit: 88e1dd1c2ab49f232fed596927c15c3781fc6b28
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 28 15:22:56 2020 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 16:35:59 2020 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=88e1dd1c
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 <AT> gentoo.org>
defaults/gksosreport.sh | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
defaults/initrd.scripts | 20 +++++++++----
defaults/linuxrc | 4 +--
gen_initramfs.sh | 8 +++++-
4 files changed, 98 insertions(+), 8 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.
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 27e98fc..315bb22 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -348,6 +348,12 @@ append_base_layout() {
echo "Genkernel $GK_V" > "${TDIR}"/etc/build_id \
|| gen_die "Failed to create '${TDIR}/etc/build_id'!"
+ cp -a "${GK_SHARE}"/defaults/gksosreport.sh "${TDIR}"/usr/sbin/gksosreport \
+ || gen_die "Failed to copy '${GK_SHARE}/defaults/gksosreport.sh' to '${TDIR}/usr/sbin/gksosreport'"
+
+ chmod 0755 "${TDIR}"/usr/sbin/gksosreport \
+ || gen_die "Failed to chmod of '${TDIR}/usr/sbin/gksosreport'!"
+
# Allow lsinitrd from dracut to process our initramfs
echo "$(cat "${TDIR}/etc/build_id") ($(cat "${TDIR}/etc/build_date"))" > "${TDIR}"/lib/dracut/dracut-gk-version.info \
|| gen_die "Failed to create '${TDIR}/lib/dracut/dracut-gk-version.info'!"
@@ -474,7 +480,7 @@ append_busybox() {
done
# Set up a few default symlinks
- local required_applets='[ ash sh mkdir mknod mount uname echo cut cat touch'
+ local required_applets='[ ash sh mkdir mknod mount uname echo chmod cut cat touch'
local required_applet=
for required_applet in ${required_applets}
do
next reply other threads:[~2020-08-28 20:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 20:18 Thomas Deutschmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-08-28 20:18 [gentoo-commits] proj/genkernel:master commit in: defaults/, / Thomas Deutschmann
2020-08-01 21:41 Thomas Deutschmann
2020-07-23 23:57 Thomas Deutschmann
2020-07-16 15:03 Thomas Deutschmann
2020-01-12 14:59 Thomas Deutschmann
2019-11-24 20:00 Thomas Deutschmann
2017-01-02 20:14 Matt Thode
2016-01-05 18:51 Richard Farina
2015-04-12 21:04 Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1598632559.88e1dd1c2ab49f232fed596927c15c3781fc6b28.whissi@gentoo \
--to=whissi@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox