Skip to content

Commit 7db905a

Browse files
author
Marcus Funch
committed
Merge branch 'add_debugging_scripts' into 'master'
Add debugging scripts See merge request os2borgerpc/os2borgerpc-scripts!128
2 parents fdfbd3c + 8e1e8e9 commit 7db905a

12 files changed

+275
-43
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#! /usr/bin/env sh
2+
3+
DOMAIN=$1
4+
5+
echo "Print a list of processes by name running on the computer"
6+
ps -eo comm
7+
8+
echo "Verify connection to the domain:"
9+
ping -c 3 "$DOMAIN"
10+
11+
echo "Verify HTTPS connection working to the domain"
12+
curl -I "https://$DOMAIN"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#! /usr/bin/env sh
2+
3+
# General information script for OS2borgerPC Kiosk, useful for debugging
4+
# Please add more commands to this script as needed and commit the changes
5+
6+
USER=chrome
7+
8+
header() {
9+
MSG=$1
10+
printf "\n\n\n%s\n\n\n" "### $MSG ###"
11+
}
12+
13+
text() {
14+
MSG=$1
15+
printf "\n%s\n" "### $MSG ###"
16+
}
17+
18+
19+
header "General information from only a basic setup"
20+
21+
ls -la /usr/share/os2borgerpc/bin/
22+
23+
text "OS2borgerPC configuration file:"
24+
cat /etc/os2borgerpc/os2borgerpc.conf
25+
26+
text "OS2borgerPC client version:"
27+
pip3 list installed | grep os2borgerpc-client
28+
29+
30+
header "Chromium / Xorg info"
31+
32+
text "Is Chromium running?:"
33+
pgrep --list-full chrome # yes, the binary is called 'chrome'
34+
35+
text "The version of Chromium:"
36+
chromium-browser --version
37+
38+
text "Contents of chrome's home directory:"
39+
ls -la /home/$USER/
40+
41+
text ".xinitrc contents:"
42+
cat /home/$USER/.xinitrc
43+
44+
45+
header "Information about monitors"
46+
47+
text "rotate_screen.sh's permissions:"
48+
# This file really ought to be in /usr/share/os2borgerpc/bin...:
49+
ls -l /usr/local/bin/rotate_screen.sh
50+
51+
text "rotate_screen.sh's contents:"
52+
cat /usr/local/bin/rotate_screen.sh
53+
54+
text "Run xrandr to get info about monitors:"
55+
export DISPLAY=:0
56+
export XAUTHORITY=/home/$USER/.Xauthority
57+
xrandr
58+
59+
60+
header "Information for those running the onboard keyboard, possibly including the button to hide it"
61+
62+
text "bspwmrc contents"
63+
cat /home/$USER/.config/bspwm/bspwmrc
64+
65+
text "start_chromium.sh contents"
66+
cat /usr/share/os2borgerpc/bin/start_chromium.sh
67+
68+
ls -la /usr/share/os2borgerpc/bin/keyboard-button/
69+
70+
text "bspwm_add_button.sh contents:"
71+
cat /usr/share/os2borgerpc/bin/keyboard-button/bspwn_add_button.sh
72+
73+
74+
header "List assorted device info"
75+
76+
text "List PCI devices:"
77+
lspci
78+
79+
text "List USB devices:"
80+
lsusb
81+
82+
83+
header "Print Xorg.log excerpt (fx. if Xorg fails to start)"
84+
tail --lines=250 /home/$USER/.local/share/xorg/Xorg.0.log
85+
86+
# Always exit successfully as some of these files may not exist simply because the related
87+
# scripts haven't been run, so it's not an error
88+
exit 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#! /usr/bin/env sh
2+
3+
printf "\n\n%s\n\n" "===== LIST INSTALLED PROGRAMS: $0 ====="
4+
#apt list --installed
5+
dpkg -l
6+
7+
printf "\n\n%s\n\n" "===== LIST ALL SERVICES: $0 ====="
8+
systemctl list-units
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#! /usr/bin/env sh
2+
3+
# General information script for OS2borgerPC, useful for debugging
4+
# Feel very free to add steps that gather additional, relevant information and commit the changes!
5+
6+
set -x
7+
8+
header() {
9+
MSG=$1
10+
printf "\n\n\n%s\n\n\n" "### $MSG ###"
11+
}
12+
13+
text() {
14+
MSG=$1
15+
printf "\n%s\n" "### $MSG ###"
16+
}
17+
18+
header "General info:"
19+
20+
text "Print the OS2borgerPC configuration file:"
21+
cat /etc/os2borgerpc/os2borgerpc.conf
22+
23+
text "Print the OS2borgerPC client version:"
24+
pip3 list installed | grep os2borgerpc-client
25+
26+
text "Info on lightdm, the display manager:"
27+
cat /etc/lightdm/lightdm.conf
28+
29+
text "Print info on automatic updates:"
30+
cat /etc/apt/apt.conf.d/90os2borgerpc-automatic-upgrades
31+
32+
text "Print user cleanup file:"
33+
cat /usr/share/os2borgerpc/bin/user-cleanup.bash
34+
35+
text "Check permissions on files in /usr/share/os2borgerpc/bin/"
36+
ls -l /usr/share/os2borgerpc/bin/
37+
38+
text "Print a list of programs/files on the desktop:"
39+
ls -l /home/user/Skrivebord/
40+
41+
text "Verify this matches what's in the user template (after logout):"
42+
ls -l /home/.skjult/Skrivebord/
43+
44+
text "Check the contents of /home/.skjult/"
45+
ls -la /home/.skjult/
46+
47+
text "Check the contents of /home/.skjult/.config/"
48+
ls -la /home/.skjult/.config/
49+
50+
text "Check the contents of /home/.skjult/.local/"
51+
ls -la /home/.skjult/.local/
52+
53+
text "Print the list of programs in the launcher:"
54+
cat /etc/dconf/db/os2borgerpc.d/02-launcher-favorites
55+
56+
text "Print info about the current background image:"
57+
cat /etc/dconf/db/os2borgerpc.d/00-background
58+
59+
text "Check the crontab"
60+
crontab -l
61+
crontab -u user -l
62+
63+
text "Check the inactive logout file"
64+
cat /usr/share/os2borgerpc/bin/inactive_logout.sh
65+
66+
### CHROME / CHROMIUM RELATED INFO ###
67+
68+
header "Print Chrome/Chromium related info"
69+
70+
# Gathers information about Google Chrome on a machine:
71+
# Contents of .desktop files, which versions of Chrome are in path (e.g. snap or not),
72+
# ...and which desktop file the launcher is using.
73+
74+
which google-chrome-stable
75+
which google-chrome
76+
google-chrome --version
77+
78+
text "Check chrome policies"
79+
cat /etc/opt/chrome/policies/managed/os2borgerpc-defaults.json
80+
81+
USER=".skjult"
82+
DESKTOP_FILE_1=/usr/share/applications/google-chrome.desktop
83+
# In case they've also added Chrome to their desktop
84+
DESKTOP_FILE_2=/home/$USER/Skrivebord/google-chrome.desktop
85+
# In case they've run chrome_autostart.sh.
86+
# The name is no mistake, that one is not called google-chrome.desktop
87+
DESKTOP_FILE_3=/home/$USER/.config/autostart/chrome.desktop
88+
DESKTOP_FILE_4=/home/$USER/.local/share/applications/google-chrome.desktop
89+
90+
text "File at $DESKTOP_FILE_1:"
91+
cat "$DESKTOP_FILE_1"
92+
text "File at $DESKTOP_FILE_2:"
93+
cat "$DESKTOP_FILE_2"
94+
text "File at $DESKTOP_FILE_3:"
95+
cat "$DESKTOP_FILE_3"
96+
text "File at $DESKTOP_FILE_4:"
97+
cat "$DESKTOP_FILE_4"
98+
99+
# Launch from TTY
100+
# su --login user --command "export DISPLAY=:0 google-chrome-stable"
101+
102+
# Always exit successfully as some of these files may not exist simply because the related
103+
# scripts haven't been run, so it's not an error
104+
exit 0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /usr/bin/env sh
2+
3+
set -x
4+
5+
BASE_URL="https://os2borgerpc-media.magenta.dk/parameter_uploads/"
6+
EXAMPLE_PARAMETER="86538woqsoed1tky1yndnkdxlz7srb7a/1415012771076_wps_1_A_giant_AT_AT_Walker_towe.jpg"
7+
URL=${BASE_URL}${EXAMPLE_PARAMETER}
8+
9+
echo "Try to download a random file from the server our parameters are served from:"
10+
wget $URL --output-document /tmp/random1.jpg
11+
echo "Try without verifying certificates"
12+
wget $URL --no-check-certificate --output-document /tmp/random2.jpg
13+
14+
echo "Check that the files are now on disk"
15+
file /tmp/random1.jpg /tmp/random2.jpg
16+
# cat /tmp/random2.jpg
17+
18+
echo "Cleanup afterwards"
19+
rm --force /tmp/random1.jpg /tmp/random2.jpg
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /usr/bin/env sh
2+
3+
ip addr

common/system/print_time.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /usr/bin/env sh
2+
3+
timedatectl
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
3+
HOSTS=/etc/hosts
4+
5+
sed --in-place /127.0.1.1/d $HOSTS
6+
sed --in-place "2i 127.0.1.1 $(hostname)" $HOSTS

tools/debug_chrome_launch.sh

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)