summaryrefslogtreecommitdiffstats
path: root/debian/templates/image.bug
diff options
context:
space:
mode:
Diffstat (limited to 'debian/templates/image.bug')
-rw-r--r--debian/templates/image.bug/control2
-rw-r--r--debian/templates/image.bug/include-0version9
-rw-r--r--debian/templates/image.bug/include-1cmdline9
-rw-r--r--debian/templates/image.bug/include-1tainted41
-rw-r--r--debian/templates/image.bug/include-dmesg21
-rw-r--r--debian/templates/image.bug/include-model60
-rw-r--r--debian/templates/image.bug/include-modules13
-rw-r--r--debian/templates/image.bug/include-network69
-rw-r--r--debian/templates/image.bug/include-pci12
-rw-r--r--debian/templates/image.bug/include-pstore77
-rw-r--r--debian/templates/image.bug/include-usb11
-rw-r--r--debian/templates/image.bug/presubj8
-rw-r--r--debian/templates/image.bug/script46
13 files changed, 378 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..7eedf260b
--- /dev/null
+++ b/debian/templates/image.bug/include-1tainted
@@ -0,0 +1,41 @@
+_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
+ # Use debian/bin/update-bug-taint-list to update this
+ _check 0 P 'proprietary module was loaded'
+ _check 1 F 'module was force loaded'
+ _check 2 S 'SMP kernel oops on an officially SMP incapable processor'
+ _check 3 R 'module was force unloaded'
+ _check 4 M 'processor reported a Machine Check Exception (MCE)'
+ _check 5 B 'bad page referenced or some unexpected page flags'
+ _check 6 U 'taint requested by userspace application'
+ _check 7 D 'kernel died recently, i.e. there was an OOPS or BUG'
+ _check 8 A 'ACPI table overridden by user'
+ _check 9 W 'kernel issued warning'
+ _check 10 C 'staging driver was loaded'
+ _check 11 I 'workaround for bug in platform firmware applied'
+ _check 12 O 'externally-built ("out-of-tree") module was loaded'
+ _check 13 E 'unsigned module was loaded'
+ _check 14 L 'soft lockup occurred'
+ _check 15 K 'kernel has been live patched'
+ _check 16 X 'auxiliary taint, defined for and used by distros'
+ _check 17 T 'kernel was built with the struct randomization plugin'
+ 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..91d3cc33c
--- /dev/null
+++ b/debian/templates/image.bug/include-model
@@ -0,0 +1,60 @@
+grep_model() {
+ case "$(uname -m)" in
+ alpha)
+ grep -E '^(system (type|variation|revision)|platform string)\b' /proc/cpuinfo
+ ;;
+ arm*)
+ grep -E '^(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)
+ grep -E '^(system type|cpu model)\b' /proc/cpuinfo
+ ;;
+ parisc|parisc64)
+ grep -E '^(model|[hs]version)\b' /proc/cpuinfo
+ ;;
+ ppc|ppc64|ppc64le)
+ grep -E -i '^(board|machine|model|motherboard|platform|revision|vendor)\b' /proc/cpuinfo
+ ;;
+ s390|s390x)
+ grep -E '^processor\b' /proc/cpuinfo
+ ;;
+ sparc|sparc64)
+ grep -E '^(cpu|fpu|pmu|prom|type)\b' /proc/cpuinfo
+ ;;
+ sh4|sh4a)
+ grep -E '^(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..89d9cb9de
--- /dev/null
+++ b/debian/templates/image.bug/include-network
@@ -0,0 +1,69 @@
+_list_etc_network_interfaces() {
+ local file
+
+ for file in /etc/network/interfaces /etc/network/interfaces.d/*; do
+ if ! [ -f "$file" ]; then
+ continue
+ fi
+ case "${file##*/}" in
+ *[^-a-zA-Z0-9_]*)
+ continue
+ ;;
+ esac
+ echo "$file"
+ done
+}
+
+_add_etc_network_interfaces() {
+ local file
+ test -f /etc/network/interfaces || return 0
+
+ echo '** Network interface configuration:' >&3
+
+ while read file; do
+ if ! [ -r "$file" ]; then
+ echo "*** $file: unreadable" >&3
+ echo >&3
+ continue
+ fi
+ echo "*** $file:" >&3
+ # Hide passwords/keys
+ awk '$1 ~ /key|pass|^wpa-(anonymous|identity|phase|pin|private|psk)/ { gsub(".", "*", $2); }
+ $1 == "ethtool-wol" { gsub(".", "*", $3); }
+ !/^[[:space:]]*\#/ { print; }
+ ' <"$file" >&3
+ echo >&3
+ done < <(_list_etc_network_interfaces)
+}
+
+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
+ test -f /etc/network/interfaces || 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