File: collect-bug-info.sh

package info (click to toggle)
anbox 0.0~git20190124-1
  • links: PTS, VCS
  • area: contrib
  • in suites: buster
  • size: 22,000 kB
  • sloc: cpp: 76,190; ansic: 7,434; sh: 1,350; xml: 818; java: 780; python: 390; makefile: 35; lisp: 7
file content (57 lines) | stat: -rwxr-xr-x 1,974 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -e

TMPDIR=$(mktemp -d)

if [ $(id -u) -ne 0 ] ; then
	echo "WARNING: You're not running as root. This will prevent the script from"
	echo "         adding a few important file for bug diagnostics to the report."
	echo "         If you want to have a look at the script before giving it root"
	echo "         access, please have a look at $0."
	exit 0
fi

echo "This script will collect a few interesting things which developers will"
echo "need to have a better insight into the Anbox system when something goes"
echo "wrong."
echo
echo "PLEASE NOTE: The collected log files may collect information about your"
echo "system. Please have a look before you're sending them to anyone!"
echo
echo "Collecting anbox log files ... "

set -x
# Collect several things which are of interest for bug reports
cp /var/snap/anbox/common/data/system.log $TMPDIR || true
cp /var/snap/anbox/common/containers/lxc-monitord.log $TMPDIR || true
cp /var/snap/anbox/common/logs/container.log $TMPDIR || true
cp /var/snap/anbox/common/logs/console.log* $TMPDIR || true
$SNAP/command-anbox.wrapper system-info > $TMPDIR/system-info.log 2>&1 || true

if [ -e /etc/systemd/system/snap.anbox.container-manager.service ]; then
	sudo journalctl --no-pager -u snap.anbox.container-manager.service > $TMPDIR/container-manager.log 2>&1 || true
fi
set +x

echo
echo "DONE!"

echo
echo "Do you want to include the kernel log of your system? [y/N]"
read -r action
if [ "$action" = "y" ]; then
	set -x
	dmesg > $TMPDIR/kernel.log 2>&1
	set +x
fi

echo "Generating archive with all log files in $PWD ..."
CURDIR=$PWD
(cd $TMPDIR; zip -r $CURDIR/anbox-system-diagnostics-$(date --rfc-3339=date --utc).zip *)
rm -rf $TMPDIR
echo "DONE!"

echo
echo "Now please take the ZIP archive generated in your current directory"
echo "and attach it to your bug report. Please don't hesitate to have a"
echo "look into the archive before you do so to verify you don't leak any"
echo "information you don't want!"