From 0682fb6563ea842c4a12732041532eac4706e6e8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 7 Apr 2020 11:52:05 -0500 Subject: [PATCH 01/14] helper script to delete symlink in local_content --- roles/usb_lib/tasks/install.yml | 1 + roles/usb_lib/templates/iiab-clean-usb.sh | 14 ++++++++++++++ roles/usb_lib/templates/usbmount@.service.j2 | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 roles/usb_lib/templates/iiab-clean-usb.sh diff --git a/roles/usb_lib/tasks/install.yml b/roles/usb_lib/tasks/install.yml index a1f92bb8c..03eb685c6 100644 --- a/roles/usb_lib/tasks/install.yml +++ b/roles/usb_lib/tasks/install.yml @@ -16,6 +16,7 @@ - { src: 'usbmount.rules.j2', dest: '/etc/udev/rules.d/usbmount.rules', mode: '0644' } - { src: 'iiab-usb_lib-show-all-on', dest: '/usr/bin/', mode: '0755' } - { src: 'iiab-usb_lib-show-all-off', dest: '/usr/bin/', mode: '0755' } + - { src: 'iiab-clean-usb.sh', dest: '/usr/sbin/', mode: '0755' } - name: Enable exFAT and NTFS in /etc/usbmount/usbmount.conf lineinfile: diff --git a/roles/usb_lib/templates/iiab-clean-usb.sh b/roles/usb_lib/templates/iiab-clean-usb.sh new file mode 100644 index 000000000..a1876551c --- /dev/null +++ b/roles/usb_lib/templates/iiab-clean-usb.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Remove symlink in /library/content to automounted usb drive +# +DEVICE=`echo $@ | sed -s 's|-|/|'` +MNT_POINT=`findmnt -n /$DEVICE | awk '{print $1}'` +CONTENT_LINK_USB=`basename $MNT_POINT | awk '{print toupper($0)}'` +CONTENT_LINK="/library/www/html/local_content/$CONTENT_LINK_USB" +logger -p user.notice -t "usbmount" -- "Attempting to remove link $CONTENT_LINK." + +if [ -L $CONTENT_LINK ]; then + /bin/rm $CONTENT_LINK + logger -p user.notice -t "usbmount" -- "$CONTENT_LINK removed." +fi + diff --git a/roles/usb_lib/templates/usbmount@.service.j2 b/roles/usb_lib/templates/usbmount@.service.j2 index b8aa22387..34d75d9f3 100644 --- a/roles/usb_lib/templates/usbmount@.service.j2 +++ b/roles/usb_lib/templates/usbmount@.service.j2 @@ -4,10 +4,11 @@ After=%i.device After=rc-local.service [Service] -Type=oneshot +#Type=oneshot TimeoutStartSec=0 Environment=DEVNAME=%I ExecStart=/usr/share/usbmount/usbmount add -ExecStop=/bin/umount /%I +ExecStop=/usr/sbin/iiab-clean-usb.sh %I +ExecStopPost=/bin/umount /%I RemainAfterExit=yes From 626783252556957c2a96a66f3b77882aacc1f75f Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 8 Apr 2020 15:23:19 -0400 Subject: [PATCH 02/14] Ensure nginx_high_php_limits when nginx_enabled --- roles/www_options/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/www_options/tasks/main.yml b/roles/www_options/tasks/main.yml index 7b6adc087..675ace98f 100644 --- a/roles/www_options/tasks/main.yml +++ b/roles/www_options/tasks/main.yml @@ -25,7 +25,7 @@ when: nginx_install | bool - debug: - msg: 'THE 3 ANSIBLE STANZAS BELOW ONLY RUN... when: (moodle_install or nextcloud_install or pbx_install or wordpress_install) and nginx_enabled' + msg: 'THE 3 ANSIBLE STANZAS BELOW ONLY RUN... when: (nginx_high_php_limits or moodle_install or nextcloud_install or pbx_install or wordpress_install) and nginx_enabled' - block: # 3-STANZA BLOCK BEGINS @@ -71,7 +71,7 @@ name: "php{{ php_version }}-fpm" state: restarted - when: (moodle_install or nextcloud_install or pbx_install or wordpress_install) and nginx_enabled # 3-STANZA BLOCK ENDS + when: (nginx_high_php_limits or moodle_install or nextcloud_install or pbx_install or wordpress_install) and nginx_enabled # 3-STANZA BLOCK ENDS # 'Is a "Rapid Power Off" button possible for low-electricity environments?' From c95dd022270ec07405e0b2d51cbf8e5c8a2043b8 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 8 Apr 2020 17:26:56 -0400 Subject: [PATCH 03/14] Update iiab-diagnostics --- scripts/iiab-diagnostics | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index fdaddee97..486dbfda7 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -184,6 +184,7 @@ cat_cmd 'systemctl status dnsmasq' 'Is dnsmasq Ok?' cat_cmd 'sudo journalctl -u dnsmasq' 'dnsmasq log' cat_cmd 'env' 'Environment variables' #cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above? +cat_cmd 'dmesg' 'Linux diagnostic messages' echo -e "\n 5. Firewall Rules:\n" echo -e "\n\n\n\n5. FIREWALL RULES\n" >> $outfile @@ -196,6 +197,8 @@ cat_tail /opt/iiab/iiab/iiab-install.log 100 cat_tail /opt/iiab/iiab/iiab-network.log 100 cat_tail /opt/iiab/iiab/iiab-debug.log 100 cat_tail /opt/iiab/iiab-admin-console/admin-install.log 100 +cat_tail /var/log/messages 100 +cat_tail /var/log/syslog 100 linecount=$(wc -l $outfile | sed 's/\s.*$//') sizecount=$(du -h $outfile | sed 's/\s.*$//') From a0c6de35b61771eccc67bfaaaa0ae419ee9c4151 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 8 Apr 2020 17:32:58 -0400 Subject: [PATCH 04/14] /etc/rpi-issue seems to indicate Raspbian (not RPi HW) --- scripts/iiab-diagnostics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index 486dbfda7..69c2c7f42 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -119,7 +119,7 @@ if [ -f /etc/rpi-issue ]; then echo >> $outfile echo "SEE https://github.com/RPi-Distro/pi-gen#stage-anatomy" >> $outfile else - echo "(This is NOT a Raspberry Pi!)" >> $outfile + echo "(This is NOT Raspbian!)" >> $outfile fi echo >> $outfile cat_file /etc/issue.net From 7db7998b748cca02236c3d15a6ae8895e8813652 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 10:27:34 -0400 Subject: [PATCH 05/14] iiab-diagnostics: test & warn re: non-existent commands --- scripts/iiab-diagnostics | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index 69c2c7f42..a775e5a62 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -87,7 +87,11 @@ function cat_cmd() { # $1 = command + params, $2 = explan pth=$(which $cmd | sed 's/[^/]*$//') # Keep only path on left; Drop command on right echo "COMMAND: $pth$1 # $2" >> $outfile echo >> $outfile - $(echo $1) >> $outfile + if [ -z "$pth" ]; then + echo "COMMAND NOT FOUND: $1" >> $outfile + else + $(echo $1) >> $outfile + fi echo >> $outfile } @@ -151,6 +155,7 @@ cat_file /etc/iiab/iiab_state.yml cat_file /etc/iiab/config_vars.yml cat_file /etc/resolv.conf cat_file /etc/network/interfaces +cat_file /etc/hostapd/hostapd.conf # Record all Ansible variables: SLOW! OUTPUT TOO LARGE? #pushd /opt/iiab/iiab > /dev/null @@ -178,13 +183,20 @@ cat_cmd 'blkid' 'Mount point details' cat_cmd 'ip addr' 'Network interfaces' cat_cmd 'ifconfig' 'Network interfaces (old view)' cat_cmd 'brctl show' 'Bridge for LAN side' +cat_cmd 'ip route' 'Routing table' cat_cmd 'netstat -rn' 'Routing table' cat_cmd 'sudo netstat -natp' 'Ports/Services in use' cat_cmd 'systemctl status dnsmasq' 'Is dnsmasq Ok?' -cat_cmd 'sudo journalctl -u dnsmasq' 'dnsmasq log' +cat_cmd 'sudo journalctl -b 0 -u dnsmasq' 'dnsmasq log' cat_cmd 'env' 'Environment variables' #cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above? cat_cmd 'dmesg' 'Linux diagnostic messages' +cat_cmd 'networkctl' 'systemd-networkd status' +cat_cmd 'nmcli d' 'NetworkManager status' +cat_cmd 'sudo journalctl -b 0 -u networkd-dispatcher' 'networkd-dispatcher log' +cat_cmd 'iw dev' 'list of wireless interfaces' +cat_cmd 'systemctl status hostapd' 'Is hostapd Ok?' +cat_cmd 'ps -AH' 'staging of wpa_supplicant service' echo -e "\n 5. Firewall Rules:\n" echo -e "\n\n\n\n5. FIREWALL RULES\n" >> $outfile From 4580952e463ccd904b884993746e648c31a7000a Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 10:36:00 -0400 Subject: [PATCH 06/14] Future: auto-redact wpa_supplicant.conf ? --- scripts/iiab-diagnostics | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index a775e5a62..5e63b5421 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -155,7 +155,8 @@ cat_file /etc/iiab/iiab_state.yml cat_file /etc/iiab/config_vars.yml cat_file /etc/resolv.conf cat_file /etc/network/interfaces -cat_file /etc/hostapd/hostapd.conf +cat_file /etc/hostapd/hostapd.conf # Auto-redact password? +#cat_file /etc/wpa_supplicant/wpa_supplicant.conf # Auto-redact password? # Record all Ansible variables: SLOW! OUTPUT TOO LARGE? #pushd /opt/iiab/iiab > /dev/null From 0dfc64bc6d5bccdb571eddc8c76a9226a1c1621f Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 10:49:19 -0400 Subject: [PATCH 07/14] Re-order iiab-diagnostics --- scripts/iiab-diagnostics | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index 5e63b5421..546239f54 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -189,15 +189,15 @@ cat_cmd 'netstat -rn' 'Routing table' cat_cmd 'sudo netstat -natp' 'Ports/Services in use' cat_cmd 'systemctl status dnsmasq' 'Is dnsmasq Ok?' cat_cmd 'sudo journalctl -b 0 -u dnsmasq' 'dnsmasq log' -cat_cmd 'env' 'Environment variables' -#cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above? -cat_cmd 'dmesg' 'Linux diagnostic messages' cat_cmd 'networkctl' 'systemd-networkd status' cat_cmd 'nmcli d' 'NetworkManager status' cat_cmd 'sudo journalctl -b 0 -u networkd-dispatcher' 'networkd-dispatcher log' cat_cmd 'iw dev' 'list of wireless interfaces' cat_cmd 'systemctl status hostapd' 'Is hostapd Ok?' -cat_cmd 'ps -AH' 'staging of wpa_supplicant service' +cat_cmd 'ps -AH' 'process hierarchy: staging of hostapd & wpa_supplicant?' +cat_cmd 'env' 'Environment variables' +cat_cmd 'dmesg' 'Linux diagnostic messages' +#cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above? echo -e "\n 5. Firewall Rules:\n" echo -e "\n\n\n\n5. FIREWALL RULES\n" >> $outfile From e3e6c9ebc0c47a2fd7469b6ba8db8c9a7480d939 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 10:56:48 -0400 Subject: [PATCH 08/14] Update iiab-diagnostics --- scripts/iiab-diagnostics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index 546239f54..e9b5ea9a8 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -183,9 +183,9 @@ cat_cmd 'lsblk' 'Partition mount points' cat_cmd 'blkid' 'Mount point details' cat_cmd 'ip addr' 'Network interfaces' cat_cmd 'ifconfig' 'Network interfaces (old view)' -cat_cmd 'brctl show' 'Bridge for LAN side' cat_cmd 'ip route' 'Routing table' cat_cmd 'netstat -rn' 'Routing table' +cat_cmd 'brctl show' 'Bridge for LAN side' cat_cmd 'sudo netstat -natp' 'Ports/Services in use' cat_cmd 'systemctl status dnsmasq' 'Is dnsmasq Ok?' cat_cmd 'sudo journalctl -b 0 -u dnsmasq' 'dnsmasq log' From 537ebe43030b4e93931a8ec7705973bdcfb311e5 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 11:06:30 -0400 Subject: [PATCH 09/14] diagnostic messages: RPi WiFi firmware --- scripts/iiab-diagnostics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index e9b5ea9a8..7f81af58d 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -195,8 +195,8 @@ cat_cmd 'sudo journalctl -b 0 -u networkd-dispatcher' 'networkd-dispatcher log' cat_cmd 'iw dev' 'list of wireless interfaces' cat_cmd 'systemctl status hostapd' 'Is hostapd Ok?' cat_cmd 'ps -AH' 'process hierarchy: staging of hostapd & wpa_supplicant?' +cat_cmd 'dmesg | grep brcm' 'diagnostic messages: RPi WiFi firmware' cat_cmd 'env' 'Environment variables' -cat_cmd 'dmesg' 'Linux diagnostic messages' #cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above? echo -e "\n 5. Firewall Rules:\n" From 9d6f6f2966b09c5e0aab8766777bed4745f48f86 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 12:16:27 -0400 Subject: [PATCH 10/14] eval is nec within backticks, so 'dmesg | grep brcm' works --- scripts/iiab-diagnostics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index 7f81af58d..cf64b3f6f 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -90,7 +90,7 @@ function cat_cmd() { # $1 = command + params, $2 = explan if [ -z "$pth" ]; then echo "COMMAND NOT FOUND: $1" >> $outfile else - $(echo $1) >> $outfile + $(echo "eval $1") >> $outfile # eval is nec within backticks, so | (pipes) work: https://stackoverflow.com/a/7184782 fi echo >> $outfile } From f7d0e0f07ee7e83902f341b371db02931ab0069c Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 12:20:10 -0400 Subject: [PATCH 11/14] English clarifs...of what commands do --- scripts/iiab-diagnostics | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index cf64b3f6f..f5ab6b9c9 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -184,7 +184,7 @@ cat_cmd 'blkid' 'Mount point details' cat_cmd 'ip addr' 'Network interfaces' cat_cmd 'ifconfig' 'Network interfaces (old view)' cat_cmd 'ip route' 'Routing table' -cat_cmd 'netstat -rn' 'Routing table' +cat_cmd 'netstat -rn' 'Routing table (old view)' cat_cmd 'brctl show' 'Bridge for LAN side' cat_cmd 'sudo netstat -natp' 'Ports/Services in use' cat_cmd 'systemctl status dnsmasq' 'Is dnsmasq Ok?' @@ -192,10 +192,10 @@ cat_cmd 'sudo journalctl -b 0 -u dnsmasq' 'dnsmasq log' cat_cmd 'networkctl' 'systemd-networkd status' cat_cmd 'nmcli d' 'NetworkManager status' cat_cmd 'sudo journalctl -b 0 -u networkd-dispatcher' 'networkd-dispatcher log' -cat_cmd 'iw dev' 'list of wireless interfaces' +cat_cmd 'iw dev' 'List wireless interfaces' cat_cmd 'systemctl status hostapd' 'Is hostapd Ok?' -cat_cmd 'ps -AH' 'process hierarchy: staging of hostapd & wpa_supplicant?' -cat_cmd 'dmesg | grep brcm' 'diagnostic messages: RPi WiFi firmware' +cat_cmd 'ps -AH' 'Process hierarchy: staging of hostapd & wpa_supplicant?' +cat_cmd 'dmesg | grep brcm' 'Diagnostic messages: RPi WiFi firmware' cat_cmd 'env' 'Environment variables' #cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above? From 82653310a071a89e6688c2deb387f15e7e553458 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 9 Apr 2020 12:21:48 -0400 Subject: [PATCH 12/14] Update iiab-diagnostics.README.md --- scripts/iiab-diagnostics.README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics.README.md b/scripts/iiab-diagnostics.README.md index 5759b8822..0b968226d 100644 --- a/scripts/iiab-diagnostics.README.md +++ b/scripts/iiab-diagnostics.README.md @@ -60,4 +60,4 @@ But first off, the file is compiled by harvesting 1 + 6 kinds of things: ## Source Code -Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 100-198 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible. +Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 104-214 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible. From fd14a80eb44a75e21b157d398d27d3925c442f62 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 10 Apr 2020 12:59:28 -0400 Subject: [PATCH 13/14] kiwix-tools 3.0.3 -> 3.1.0 --- roles/kiwix/defaults/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index e2b2086a5..d5b27e8cf 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -26,9 +26,9 @@ kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" # http://download.kiwix.org/release/kiwix-tools/ ...or sometimes... # http://download.kiwix.org/nightly/ -kiwix_version_armhf: "kiwix-tools_linux-armhf-3.0.3" -kiwix_version_linux64: "kiwix-tools_linux-x86_64-3.0.3" -kiwix_version_i686: "kiwix-tools_linux-i586-3.0.3" +kiwix_version_armhf: kiwix-tools_linux-armhf-3.1.0 +kiwix_version_linux64: kiwix-tools_linux-x86_64-3.1.0 +kiwix_version_i686: kiwix-tools_linux-i586-3.1.0 # kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # v0.9 for i686 published May 2014 ("use it to test legacy ZIM content") From c3fde8d9038d6e99ace7b2ad196e2abf479273e4 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Fri, 10 Apr 2020 13:53:40 -0400 Subject: [PATCH 14/14] remove any possible file before creating regions symlink --- roles/osm-vector-maps/tasks/install.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/osm-vector-maps/tasks/install.yml b/roles/osm-vector-maps/tasks/install.yml index 849c42017..8b660ae92 100644 --- a/roles/osm-vector-maps/tasks/install.yml +++ b/roles/osm-vector-maps/tasks/install.yml @@ -11,6 +11,12 @@ url: "{{ iiab_map_url }}/assets/regions.json" # http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden dest: "{{ vector_map_path }}/maplist/assets/" # /library/www/osm-vector-maps +# handle case where a dummy file is already here and would break the symlink step that follows +- name: Remove {{ doc_root }}/common/assets/regions.json + file: + dest: "{{ doc_root }}/common/assets/regions.json" # /library/www/html + state: absent + - name: Symlink catalog {{ doc_root }}/common/assets/regions.json -> {{ vector_map_path }}/maplist/assets/regions.json file: src: "{{ vector_map_path }}/maplist/assets/regions.json" # /library/www/osm-vector-maps