blob: 7ecd2ccc847fd4d78f1179c6453264c898a746dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
#!/bin/bash
#
# mdadm bug submission control script
#
# allows Debian's bug tools to include relevant information in bug reports.
#
# Copyright © martin f. krafft <madduck@debian.org>
# distributed under the terms of the Artistic Licence 2.0
#
# we need /bin/bash for readline and -n capabalities in the prompt(s)
#
# maximise information output even in the case of errors
set +eu
if ! command -v yesno >/dev/null; then
if [ -r /usr/share/reportbug/handle_bugscript ]; then
exec /usr/share/reportbug/handle_bugscript ". $0" /dev/stdout
fi
yesno() {
read -n1 -p"$1" REPLY
case "$REPLY" in
[yY]) REPLY=yep;;
[nN]) REPLY=nop;;
('') REPLY="$2";;
esac
}
exec 3>&1
fi
if [ $(id -u) != 0 ]; then
if [ -x "$(command -v sudo)" ]; then
yesno "Gather system information as root using sudo? (Y/n) " yep
if [ "$REPLY" = yep ]; then
echo running sudo "$0" "$@"...
sudo "$0" "$@" && exit 0
echo "sudo invocation failed, trying /bin/su..."
fi
fi
yesno "Gather system information as root using su? (Y/n) " yep
if [ "$REPLY" = yep ]; then
ARGS=
for i in "$@"; do ARGS="${ARGS:+$ARGS }'$1'"; shift; done
echo "running su root -s '/bin/sh -c $0 $ARGS'..."
su root -s /bin/sh -c "$0 $ARGS" && exit 0
unset ARGS
echo "su invocation failed."
fi
# arrive here only if neither sudo nor su worked:
yesno "Will you provide system information in the bug report yourself? (N/y) " nop
if [ "$REPLY" = yep ]; then
cat <<_eof >&3
IMPORTANT:
please do not forget to include all relevant system information with this
bug report. You could run
/usr/share/bug/mdadm/script 3>&1
as root and attach or include the output.
_eof
exit 0
fi
# try our best
cat <<_eof >&3
WARNING:
the following output was not generated by the root user. If you can, please
replace the following up until "-- System Information:" with the output of
/usr/share/bug/mdadm/script 3>&1
run as root. Thanks!
_eof
fi
if [ ! -r /proc/mdstat ]; then
echo "The local system does not have MD (RAID) support: no drivers loaded."
echo "Without MD support, I cannot collect as much information as I'd like."
#yesno "Are you sure you want to report a bug at this time? " yep
yesno "Hit any key to continue..." yep
#[ "$REPLY" = yep ] || exit 1
fi
echo "--- mount output" >&3
mount >&3
echo >&3
echo "--- mdadm.conf" >&3
if [ -r /etc/mdadm/mdadm.conf ]; then
cat /etc/mdadm/mdadm.conf >&3
else
echo no mdadm.conf file. >&3
fi
echo >&3
echo "--- /proc/mdstat:" >&3
cat /proc/mdstat >&3 2>&3 || :
echo >&3
echo "--- /proc/partitions:" >&3
cat /proc/partitions >&3 2>&3 || :
echo >&3
echo "--- initrd.img-$(uname -r):" >&3
if [ -r /boot/initrd.img-$(uname -r) ]; then
zcat /boot/initrd.img-$(uname -r) 2>&3 | cpio -t 2>&3 | egrep '/md[a/]' >&3
fi
echo >&3
if [ -r /proc/modules ]; then
echo "--- /proc/modules:" >&3
egrep '(dm_|raid|linear|multipath|faulty)' < /proc/modules >&3 || :
echo >&3
fi
if [ -r /var/log/syslog ]; then
echo "--- /var/log/syslog:" >&3
egrep "^\w{3} [ :[:digit:]]{11} ($(hostname)|localhost) (kernel: md|mdadm): " /var/log/syslog >&3 || :
echo >&3
fi
echo "--- volume detail:" >&3
for dev in /dev/[hs]d[a-z]*; do mdadm -E $dev 2>/dev/null && echo -- || :; done >&3
echo >&3
if [ -r /proc/cmdline ]; then
echo "--- /proc/cmdline" >&3
cat /proc/cmdline >&3
echo >&3
fi
if [ -f /boot/grub/menu.lst ]; then
echo "--- grub:" >&3
if [ -r /boot/grub/menu.lst ]; then
grep '^[^#].*root=' /boot/grub/menu.lst >&3 || :
else
echo menu.lst file not readable. >&3
fi
echo >&3
fi
if [ -f /etc/lilo.conf ]; then
echo "--- lilo:" >&3
if [ -r /etc/lilo.conf ]; then
egrep '^([^#].*)?root=' /etc/lilo.conf >&3 || :
else
echo lilo.conf file not readable. >&3
fi
echo >&3
fi
|