diff options
Diffstat (limited to 'debian/templates/image.bug')
-rw-r--r-- | debian/templates/image.bug/control | 2 | ||||
-rw-r--r-- | debian/templates/image.bug/include-0version | 9 | ||||
-rw-r--r-- | debian/templates/image.bug/include-1cmdline | 9 | ||||
-rw-r--r-- | debian/templates/image.bug/include-1tainted | 55 | ||||
-rw-r--r-- | debian/templates/image.bug/include-dmesg | 21 | ||||
-rw-r--r-- | debian/templates/image.bug/include-model | 60 | ||||
-rw-r--r-- | debian/templates/image.bug/include-modules | 13 | ||||
-rw-r--r-- | debian/templates/image.bug/include-network | 39 | ||||
-rw-r--r-- | debian/templates/image.bug/include-pci | 12 | ||||
-rw-r--r-- | debian/templates/image.bug/include-pstore | 77 | ||||
-rw-r--r-- | debian/templates/image.bug/include-usb | 11 | ||||
-rw-r--r-- | debian/templates/image.bug/presubj | 8 | ||||
-rw-r--r-- | debian/templates/image.bug/script | 46 |
13 files changed, 362 insertions, 0 deletions
diff --git a/debian/templates/image.bug/control b/debian/templates/image.bug/control new file mode 100644 index 000000000..b60912c4c --- /dev/null +++ b/debian/templates/image.bug/control @@ -0,0 +1,2 @@ +Submit-As: src:linux +Package-Status: firmware-amd-graphics firmware-atheros firmware-bnx2 firmware-bnx2x firmware-brcm80211 firmware-cavium firmware-intelwimax firmware-intel-sound firmware-ipw2x00 firmware-ivtv firmware-iwlwifi firmware-libertas firmware-linux-nonfree firmware-misc-nonfree firmware-myricom firmware-netxen firmware-qlogic firmware-realtek firmware-samsung firmware-siano firmware-ti-connectivity xen-hypervisor diff --git a/debian/templates/image.bug/include-0version b/debian/templates/image.bug/include-0version new file mode 100644 index 000000000..b5b32bfbd --- /dev/null +++ b/debian/templates/image.bug/include-0version @@ -0,0 +1,9 @@ +add_0version() { + echo '** Version:' >&3 + cat /proc/version >&3 + echo >&3 +} + +ask_0version() { + true +} diff --git a/debian/templates/image.bug/include-1cmdline b/debian/templates/image.bug/include-1cmdline new file mode 100644 index 000000000..3fcc94098 --- /dev/null +++ b/debian/templates/image.bug/include-1cmdline @@ -0,0 +1,9 @@ +add_1cmdline() { + echo '** Command line:' >&3 + cat /proc/cmdline >&3 + echo >&3 +} + +ask_1cmdline() { + true +} diff --git a/debian/templates/image.bug/include-1tainted b/debian/templates/image.bug/include-1tainted new file mode 100644 index 000000000..921922e3c --- /dev/null +++ b/debian/templates/image.bug/include-1tainted @@ -0,0 +1,55 @@ +TAINT_PROPRIETARY_MODULE=0 +TAINT_FORCED_MODULE=1 +TAINT_UNSAFE_SMP=2 +TAINT_FORCED_RMMOD=3 +TAINT_MACHINE_CHECK=4 +TAINT_BAD_PAGE=5 +TAINT_USER=6 +TAINT_DIE=7 +TAINT_OVERRIDDEN_ACPI_TABLE=8 +TAINT_WARN=9 +TAINT_CRAP=10 +TAINT_FIRMWARE_WORKAROUND=11 +TAINT_OOT_MODULE=12 +TAINT_UNSIGNED_MODULE=13 +TAINT_SOFTLOCKUP=14 +TAINT_LIVEPATCH=15 + +_check() { + if [ $(($tainted & 1<<$1)) -ne 0 ]; then + result_short="$result_short$2" + result_long="$result_long * $3\n" + fi +} + +add_1tainted() { + tainted=$(cat /proc/sys/kernel/tainted) + if [ "$tainted" -gt 0 ]; then + local result_short result_long + _check $TAINT_PROPRIETARY_MODULE 'P' 'Proprietary module has been loaded.' + _check $TAINT_FORCED_MODULE 'F' 'Module has been forcibly loaded.' + _check $TAINT_UNSAFE_SMP 'S' 'SMP with CPUs not designed for SMP.' + _check $TAINT_FORCED_RMMOD 'R' 'User forced a module unload.' + _check $TAINT_MACHINE_CHECK 'M' 'System experienced a machine check exception.' + _check $TAINT_BAD_PAGE 'B' 'System has hit bad_page.' + _check $TAINT_USER 'U' 'Userspace-defined naughtiness.' + _check $TAINT_DIE 'D' 'Kernel has oopsed before.' + _check $TAINT_OVERRIDDEN_ACPI_TABLE 'A' 'ACPI table overridden.' + _check $TAINT_WARN 'W' 'Taint on warning.' + _check $TAINT_CRAP 'C' 'Module from drivers/staging has been loaded.' + _check $TAINT_FIRMWARE_WORKAROUND 'I' 'Working around severe firmware bug.' + _check $TAINT_OOT_MODULE 'O' 'Out-of-tree module has been loaded.' + _check $TAINT_UNSIGNED_MODULE 'E' 'Unsigned module has been loaded.' + _check $TAINT_SOFTLOCKUP 'L' 'Kernel has detected soft lockup before.' + _check $TAINT_LIVEPATCH 'K' 'Live patch has been loaded.' + echo "** Tainted: $result_short ($tainted)" >&3 + printf "$result_long" >&3 + else + echo '** Not tainted' >&3 + fi + echo >&3 +} + +ask_1tainted() { + true +} diff --git a/debian/templates/image.bug/include-dmesg b/debian/templates/image.bug/include-dmesg new file mode 100644 index 000000000..634dc99ac --- /dev/null +++ b/debian/templates/image.bug/include-dmesg @@ -0,0 +1,21 @@ +add_dmesg() { + local got_log= + echo '** Kernel log:' >&3 + if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then + dmesg > >(tail -n 100 >&3) && got_log=y + elif command -v sudo >/dev/null; then + yesno "Use sudo to read the kernel log? " yep + if [ "$REPLY" = yep ]; then + sudo dmesg > >(tail -n 100 >&3) && got_log=y + fi + fi + test "$got_log" || echo 'Unable to read kernel log; any relevant messages should be attached' >&3 + echo >&3 +} + +ask_dmesg() { + # Remind the user to attach the kernel log. This should also trigger + # a reminder in some MUAs if the user tries to send without it. + echo '** Kernel log: boot messages should be attached' >&3 + echo >&3 +} diff --git a/debian/templates/image.bug/include-model b/debian/templates/image.bug/include-model new file mode 100644 index 000000000..ba77fb266 --- /dev/null +++ b/debian/templates/image.bug/include-model @@ -0,0 +1,60 @@ +grep_model() { + case "$(uname -m)" in + alpha) + egrep '^(system (type|variation|revision)|platform string)\b' /proc/cpuinfo + ;; + arm*) + egrep '^(Processor|Hardware|Revision)\b' /proc/cpuinfo + ;; + i386|ia64|x86_64) + local found= + for name in {sys,product,chassis,bios,board}_{vendor,name,version}; do + if [ -f /sys/class/dmi/id/$name ]; then + echo -n "$name: " + cat /sys/class/dmi/id/$name + found=y + fi + done + test -n "$found" + ;; + mips|mips64) + egrep '^(system type|cpu model)\b' /proc/cpuinfo + ;; + parisc|parisc64) + egrep '^(model|[hs]version)\b' /proc/cpuinfo + ;; + ppc|ppc64|ppc64le) + egrep -i '^(board|machine|model|motherboard|platform|revision|vendor)\b' /proc/cpuinfo + ;; + s390|s390x) + egrep '^processor\b' /proc/cpuinfo + ;; + sparc|sparc64) + egrep '^(cpu|fpu|pmu|prom|type)\b' /proc/cpuinfo + ;; + sh4|sh4a) + egrep '^(machine|cpu)\b' /proc/cpuinfo + ;; + *) + false + ;; + esac + + # Device Tree model + if [ -r /proc/device-tree/model ]; then + echo "Device Tree model:" $(cat /proc/device-tree/model) + fi +} + +add_model() { + local found= + echo '** Model information' >&3 + grep_model >&3 2>/dev/null || echo "not available" >&3 + echo >&3 +} + +ask_model() { + # This is still valid as long as the bug is being reported on the same + # system. + test $same_system = nop || add_model +} diff --git a/debian/templates/image.bug/include-modules b/debian/templates/image.bug/include-modules new file mode 100644 index 000000000..22271c905 --- /dev/null +++ b/debian/templates/image.bug/include-modules @@ -0,0 +1,13 @@ +add_modules() { + echo '** Loaded modules:' >&3 + # List modules along with any taint flags. + # We should be able to tell cut to use an empty output delimiter, but + # currently (coreutils 8.13-3) this results in null bytes in the output. + cut -d' ' -f1,7 /proc/modules | sed 's/ //' >&3 + echo >&3 +} + +ask_modules() { + true +} + diff --git a/debian/templates/image.bug/include-network b/debian/templates/image.bug/include-network new file mode 100644 index 000000000..bd12defe6 --- /dev/null +++ b/debian/templates/image.bug/include-network @@ -0,0 +1,39 @@ +_add_etc_network_interfaces() { + echo '** Network interface configuration:' >&3 + # Hide passwords/keys + awk '$1 ~ /key|pass|^wpa-(anonymous|identity|phase|pin|private|psk)/ { gsub(".", "*", $2); } + $1 == "ethtool-wol" { gsub(".", "*", $3); } + !/^[[:space:]]*\#/ { print; } + ' </etc/network/interfaces >&3 + echo >&3 +} + +add_network() { + yesno "Include network configuration and status from this computer? " nop + test $REPLY = yep || return 0 + + _add_etc_network_interfaces + echo '** Network status:' >&3 + if command -v ip >/dev/null; then + echo '*** IP interfaces and addresses:' >&3 + ip address show >&3 + echo >&3 + fi + echo '*** Device statistics:' >&3 + cat /proc/net/dev >&3 + echo >&3 + if command -v netstat >/dev/null; then + echo '*** Protocol statistics:' >&3 + netstat -s >&3 || true + echo >&3 + fi + echo >&3 +} + +ask_network() { + test $same_system = yep || return 0 + yesno "Include network configuration from this computer? " nop + test $REPLY = yep || return 0 + + _add_etc_network_interfaces +} diff --git a/debian/templates/image.bug/include-pci b/debian/templates/image.bug/include-pci new file mode 100644 index 000000000..8e6528e5a --- /dev/null +++ b/debian/templates/image.bug/include-pci @@ -0,0 +1,12 @@ +add_pci() { + echo '** PCI devices:' >&3 + lspci -nnvv >&3 2>/dev/null || echo 'not available' >&3 + echo >&3 +} + +ask_pci() { + # This information shouldn't vary much between kernel versions, so + # include it anyway. + test $same_system = nop || add_pci +} + diff --git a/debian/templates/image.bug/include-pstore b/debian/templates/image.bug/include-pstore new file mode 100644 index 000000000..43285bd6a --- /dev/null +++ b/debian/templates/image.bug/include-pstore @@ -0,0 +1,77 @@ +_add_pstore_log() { + if [ $# -le 3 ]; then + return + fi + + local backend="$1" + local event="$2" + local date="$3" + + yesno "Include log of $event at $(date -d @$date +%c) stored by $backend?" yep + if [ $REPLY != yep ]; then + return + fi + + echo >&3 + echo "*** Log of $event at $(date -d @$date -Iseconds) from $backend" >&3 + + shift 3 + for file in "$@"; do + tail -n +2 "$file" | sed 's/^<.>//' >&3 + done +} + +add_pstore() { + local backend + local i + local j + local file + local date + local head + local event + local log_files + + if ! mountpoint -q /sys/fs/pstore; then + return 0 + fi + + set -- /sys/fs/pstore/dmesg-*-1 + backend=${1#*/dmesg-} + backend=${backend%-1} + if [ "$backend" = '*' ]; then + return 0 + fi + + i=1 + while [ -f /sys/fs/pstore/dmesg-$backend-$i ]; do + file=/sys/fs/pstore/dmesg-$backend-$i + head="$(head -1 "$file")" + + # Is this the first part of a log? + if [ "x${head% Part1}" != "x$head" ]; then + # Flush previous log, if any + _add_pstore_log "$backend" "$event" "$date" $log_files + + event="${head% Part1}" + date=$(stat -c %Y $file) + log_files= + j=1 + fi + + if [ "x$head" = "x$event Part$j" ]; then + # Each part is prepended to the list, because they're numbered + # backward in log history + log_files="$file $log_files" + j=$((j + 1)) + fi + + i=$((i + 1)) + done + + # Flush last log, if any + _add_pstore_log "$backend" "$event" "$date" $log_files +} + +ask_pstore() { + add_pstore +} diff --git a/debian/templates/image.bug/include-usb b/debian/templates/image.bug/include-usb new file mode 100644 index 000000000..e8eb67e42 --- /dev/null +++ b/debian/templates/image.bug/include-usb @@ -0,0 +1,11 @@ +add_usb() { + echo '** USB devices:' >&3 + lsusb >&3 2>/dev/null || echo 'not available' >&3 + echo >&3 +} + +ask_usb() { + # This information shouldn't vary much between kernel versions, so + # include it anyway. + test $same_system = nop || add_usb +} diff --git a/debian/templates/image.bug/presubj b/debian/templates/image.bug/presubj new file mode 100644 index 000000000..59b891acb --- /dev/null +++ b/debian/templates/image.bug/presubj @@ -0,0 +1,8 @@ +Please ensure that you are currently running the kernel version that you +are reporting on. This will allow your bug report to include useful +diagnostic information about the running kernel. + +If you are reporting that the kernel fails to boot, please use a digital +camera, serial console or netconsole to record the boot messages and +attach these to your report. You can use the kernel parameter +'boot_delay=1000' to slow down the boot messages. diff --git a/debian/templates/image.bug/script b/debian/templates/image.bug/script new file mode 100644 index 000000000..8e0b5d557 --- /dev/null +++ b/debian/templates/image.bug/script @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +dir="$(dirname $0)" + +. "$dir"/info + +for file in "$dir"/include-*; do + name="$(echo $file | sed -e 's,^.*/include-,,')" + hooks+=($name) + . "$file" +done + +if [ "$RELEASE" == "$(uname -r)" ]; then + running_ver="$(uname -v)" + running_ver="${running_ver#* $DISTRIBUTOR }" + running_ver="${running_ver%% *}" + if [ "$running_ver" != "$SOURCEVERSION" ]; then + cat <<EOF +You have installed version $PACKAGE_VERSION of +$PACKAGE_NAME, but version $running_ver is currently +running. + +You should reboot to complete the upgrade. Until you do this, some +modules may fail to load. This is NOT a bug. + +If you have already rebooted, check your boot loader configuration. + +EOF + yesno "Do you still want to report a bug? " nop + if [ "$REPLY" = nop ]; then + exit 1 + fi + fi + for hook in ${hooks[@]}; do + add_$hook + done +else + yesno "Does the bug you are reporting affect this computer? " yep + same_system=$REPLY + for hook in ${hooks[@]}; do + ask_$hook + done +fi |