Skip to content

Commit 56e3ecf

Browse files
mf-fxMarcus Funch
authored and
Marcus Funch
committed
Make some local debugging scripts global
1 parent 2758c53 commit 56e3ecf

File tree

4 files changed

+110
-0
lines changed

4 files changed

+110
-0
lines changed

common/fejlfinding/debug_scanners.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /usr/bin/env sh
2+
3+
set -x
4+
5+
text() {
6+
MSG=$1
7+
printf "\n%s\n" "### $MSG ###"
8+
}
9+
10+
text "Information about usb-devices"
11+
lsusb
12+
13+
text "Information about /dev/bus/usb"
14+
ls -l /dev/bus/usb/*/*
15+
16+
text "Information about scan-related bin-files"
17+
# shellcheck disable=SC2010 # it's just a debugging script and that dir won't have non-alphanumeric names
18+
ls -l /usr/bin | grep scan
19+
20+
text "Information about group membership"
21+
cat /etc/group
22+
23+
text "Check if there are any firmware files in /usr/share/sane and, if so, if their permissions are correct"
24+
ls -lR /usr/share/sane
25+
26+
text "Check if scanimage -L and sane-find-scanner get permission errors when run as the regular user, as otherwise it may prevent the user from scanning"
27+
timeout 13 su --login user --command "scanimage -L"
28+
timeout 13 su --login user --command "sane-find-scanner"
29+
30+
text "Run sane-find-scanner as root, just to get the information, in case the above fails"
31+
sane-find-scanner
32+
33+
text "Check if any udev rules are likely to match the scanner. If not we may need to create a custom udev rule for the vendor and product, to ensure everyone has read access"
34+
# https://wiki.archlinux.org/title/SANE#Permission_problem
35+
cat /usr/lib/udev/rules.d/60-libsane.rules
36+
cat /usr/lib/udev/rules.d/99-libsane.rules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env sh
2+
3+
# Consider merging this with "debug_security_events". The advantage of this script is that it can handle larger logs,
4+
# and logs that may contain special characters.
5+
# It could potentially be adjusted slightly to also allow it to optionally send .1 files, and the already gzipped .n files
6+
7+
# The admin site currently only accepts up to 2 MiB per request,
8+
# and these logs are often larger than that, hence the compression.
9+
# Base64 encoding is used as xmlrpc might not handle all the special characters correctly, or the adminsite may not
10+
# display them correctly
11+
12+
AUTHLOG=/var/log/auth.log
13+
SYSLOG=/var/log/syslog
14+
KERNLOG=/var/log/kern.log
15+
16+
print_log() {
17+
LOG=$1
18+
echo "Size of the log file:"
19+
du -h "$LOG"
20+
echo "Log itself, base64 encoded to reduce the transfer size and remove special characters:"
21+
echo "" && gzip -c "$LOG" | base64 && echo ""
22+
}
23+
24+
CHOSEN_LOG="$1"
25+
26+
if [ "$CHOSEN_LOG" = "auth" ]; then
27+
LOG=$AUTHLOG
28+
elif [ "$CHOSEN_LOG" = "sys" ]; then
29+
LOG=$SYSLOG
30+
else
31+
LOG=$KERNLOG
32+
fi
33+
34+
if [ "$CHOSEN_LOG" = "all" ]; then
35+
print_log $AUTHLOG
36+
print_log $SYSLOG
37+
print_log $KERNLOG
38+
else
39+
print_log $LOG
40+
fi

tools/duplicate_screens_now.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env sh
2+
3+
set -x
4+
5+
# Set some required variables to be able to run xrandr from root
6+
USER=chrome
7+
export DISPLAY=:0
8+
export XAUTHORITY=/home/$USER/.Xauthority
9+
10+
if ! get_os2borgerpc_config os2_product | grep --quiet kiosk; then
11+
echo "Dette script er ikke designet til at blive anvendt på en regulær OS2borgerPC-maskine."
12+
exit 1
13+
fi
14+
15+
echo "DEBUG: Print some info from xrandr before attempting to turn on monitors:"
16+
xrandr
17+
18+
ALL_MONITORS=$(xrandr | grep ' connected' | cut --delimiter ' ' --fields 1)
19+
FIRST_MONITOR=$(echo "$ALL_MONITORS" | head -n 1)
20+
OTHER_MONITORS=$(echo "$ALL_MONITORS" | tail -n +2)
21+
echo "$OTHER_MONITORS" | xargs -I {} xrandr --output {} --same-as "$FIRST_MONITOR"
22+
23+
echo "DEBUG: Print some info from xrandr after attempting to turn on monitors:"
24+
xrandr

tools/print_intel_driver_info.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! /usr/bin/env sh
2+
3+
echo "Print info about the i915 (intel video driver) module:"
4+
modinfo i915
5+
6+
echo "Find all instances of modules called i915* under /lib/modules (in case there's more than one):"
7+
find /lib/modules -iname "i915*"
8+
9+
echo "List devices and their drivers"
10+
ubuntu-drivers devices

0 commit comments

Comments
 (0)