summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2019-10-31 17:00:23 +0100
committerJonathan Bauer2019-10-31 17:00:23 +0100
commitba6753cfabc149cc312f33a3c507b1cc0dbcee3b (patch)
treebf12c077ce4c1722a20319fc82b3eb2143b65a2c
parent[vmware-common] Fix launching usbarbitrator with 15.5.x (diff)
downloadmltk-ba6753cfabc149cc312f33a3c507b1cc0dbcee3b.tar.gz
mltk-ba6753cfabc149cc312f33a3c507b1cc0dbcee3b.tar.xz
mltk-ba6753cfabc149cc312f33a3c507b1cc0dbcee3b.zip
[*] introduce system-check
* hardware stats now only reports hardware info data in /run/hwinfo and /run/hwreport * system-check hooks will generate lightdm warnings and curl the report to the satellite * run-virt now handles the ID44 warnings to cope for network shares on /tmp/virt WARNING PROFI111!
-rw-r--r--core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service3
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats201
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report82
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-warnings14
-rw-r--r--core/modules/hardware-stats/data/opt/openslx/system-check/lang/de/slx-gfx-nouveau1
-rw-r--r--core/modules/hardware-stats/data/opt/openslx/system-check/tags/slx-gfx-nouveau2
-rw-r--r--core/modules/run-virt/data/etc/systemd/system/run-virt-env.service4
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/system-check/hooks.d/30-run-virt44
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-id44-small1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-disabled1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-unsupported1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-lowmemory1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid441
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-hdd0
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-lowmemory1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-nohdd1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-vmstore-fail2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-lowram1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-nohdd1
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-noidd441
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-id44-small2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-disabled2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-unsupported2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-lowmemory2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid442
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-hdd2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-lowmemory2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-nohdd2
-rw-r--r--core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-vmstore-fail2
-rw-r--r--core/modules/system-check/data/etc/systemd/system/system-check.service10
-rw-r--r--core/modules/system-check/data/opt/openslx/scripts/systemd-system_check95
-rw-r--r--core/modules/system-check/data/opt/openslx/system-check/lang/de/slx-contact-support2
-rw-r--r--core/modules/system-check/data/opt/openslx/system-check/tags/slx-contact-support1
-rw-r--r--core/modules/system-check/module.build13
-rw-r--r--core/modules/system-check/module.conf4
-rw-r--r--core/modules/system-check/module.conf.ubuntu3
36 files changed, 373 insertions, 136 deletions
diff --git a/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service b/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service
index 36d47986..7309d0bb 100644
--- a/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service
+++ b/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service
@@ -1,7 +1,8 @@
[Unit]
Description=Gather statistics about this machine and send to boot server
After=tmp.target mount-vm-store.service network.target
-Wants=tmp.target
+Wants=tmp.target system-check.service
+Before=system-check.service
[Service]
Type=oneshot
diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
index 694c0707..6b81d7be 100755
--- a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
+++ b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
@@ -63,36 +63,33 @@ slxfdisk() {
return 127
}
-if [ -z "$SLX_REMOTE_LOG" ]; then
- echo "No remote log url given, will not report"
- exit 1
-fi
-
+################################################################################
# 1) Get MAC Address used for booting
-eval $(grep -Eo BOOTIF=\\S+ /proc/cmdline)
-if [ "${#BOOTIF}" -ne "20" ]; then
+#
+MAC="${SLX_PXE_MAC}"
+if [ -z "$MAC" ]; then
+ # get MAC from sysfs
+ MAC="$(cat /sys/class/net/${SLX_PXE_NETIF:-br0}/address)"
+fi
+if [ -z "$MAC" ]; then
+ BOOTIF="$(grep -Po '(?<=BOOTIF=)[0-9a-f\-:]+' /proc/cmdline)"
+ [ "${#BOOTIF}" -eq "20" ] && MAC="${BOOTIF:3}"
+fi
+if [ -z "$MAC" ]; then
echo "Getting MAC from /proc/cmdline failed, using 'ip a'..."
- BOOTIF=01-$(ip a | grep -A 1 ': br0' | grep -o 'ether ..:..:..:..:..:..' | cut -d' ' -f2 | sed s/:/-/g)
- if [ "${#BOOTIF}" -ne "20" ]; then
- echo "FAIL FAIL FAIL"
- BOOTIF="99-88-77-66-55-44-33"
- fi
+ _mac="$(ip a | grep -A 1 ': br0' | grep -o 'ether ..:..:..:..:..:..' | cut -d' ' -f2)"
+ [ "$_mac" -eq 17 ] && MAC="$_mac"
fi
-MAC=${BOOTIF:3}
-echo "Determined MAC=$MAC"
-
-# 2) Get machine UUID written in stage3.1
-UUID=$(cat /etc/system-uuid)
-if [ -z "$UUID" ] || [ "${#UUID}" -ne "36" ]; then
- echo "No/malformed UUID, aborting" >&2
- exit 1
+if [ -z "$MAC" ]; then
+ MAC="88-77-66-55-44-33"
fi
-echo "UUID=$UUID"
-
-# 3) Uptime in seconds
-UPTIME=$(grep -o -E '^[0-9]+' /proc/uptime)
+# always uppercase and dash-separated
+MAC="${MAC^^}"
+MAC="${MAC//:/-}"
+echo "Determined MAC=$MAC"
-# 4) Number of real and virtual CPU cores
+################################################################################
+# 2) Number of real and virtual CPU cores
# Virtual, cheap way
VCORES=$(grep '^processor\s' /proc/cpuinfo | sort -u | wc -l)
# Real cores
@@ -109,11 +106,15 @@ if [ -z "$CPUCORES" ] || [ "$CPUCORES" = "0" ]; then
fi
echo "$CPUCORES real cores, $VCORES with HT"
-# 5) CPU model name
+################################################################################
+# 3) CPU model name
+#
CPUMODEL=$(grep -m1 '^model name\s*:' /proc/cpuinfo | sed 's/^model name\s*:\s*//;s/\s\s*/ /g;s/^ //;s/ $//')
echo "$CPUMODEL"
-# 6) RAM
+################################################################################
+# 4) RAM
+#
RAM=$(grep -m1 '^MemTotal:' /proc/meminfo | awk '{print $2}')
RAM=$(( $RAM / 1024 ))
if [ -z "$RAM" ] || [ "$RAM" -lt 500 ]; then
@@ -125,7 +126,9 @@ if [ -z "$RAM" ] || [ "$RAM" -lt 500 ]; then
fi
echo "$RAM MB RAM"
-# 7) 64bit virtualization support
+################################################################################
+# 5) 64bit virtualization support
+#
VT="UNSUPPORTED"
VIRTTYPE=$(grep -m1 '^flags\s*:' /proc/cpuinfo | grep -wo -e svm -e vmx)
[ -n "$VIRTTYPE" ] && modprobe msr
@@ -153,7 +156,9 @@ elif [ "$VIRTTYPE" = "svm" ]; then # amd
fi
echo "$VIRTTYPE is $VT"
-# 8) ID44 partition size
+################################################################################
+# 6) ID44 partition size
+#
ID44=0
if ! slx-tools fs_path_isvolatile "/tmp/virt" ; then
ID44_SPACE=($(slx-tools fs_path_space "/tmp/virt"))
@@ -181,7 +186,9 @@ if ! slx-tools fs_path_isvolatile "/tmp/virt" ; then
fi
echo "Scratch space: $ID44 MB"
-# 9) check smart values
+################################################################################
+# 7) check smart values
+#
FDISK=$(mktemp)
declare -a DISKS
shopt -s extglob
@@ -192,6 +199,7 @@ for disk in /dev/disk/by-path/!(*-part*|*-usb-*); do
slxfdisk -l "$disk"
done > "$FDISK"
shopt -u extglob
+[ -z "$SLX_SMARTCTL_MIN_REALLOC" ] && SLX_SMARTCTL_MIN_REALLOC=0
BADSECTORS=0
if which smartctl; then
ALLSMART=$(mktemp)
@@ -226,7 +234,9 @@ if which smartctl; then
fi
echo "SMART: $OVERALL - $REALLOC reallocated, $PENDING pending"
-# A) Read system model and manufacturer
+################################################################################
+# 8) Read system model and manufacturer
+#
dmidec() {
local RETVAL=$(dmidecode "$@" 2>/dev/null | grep -v '^#' | grep -v '^Invalid' | sed 's/\s\s*/ /g;s/^ //;s/ $//')
case "$RETVAL" in
@@ -237,6 +247,10 @@ dmidec() {
echo "$RETVAL"
}
+bashesc () {
+ sed s/\'/\'\"\'\"\'/g <<< $*
+}
+
HW_MODEL=$(dmidec -q -s system-product-name)
HW_MANUF=$(dmidec -q -s system-manufacturer)
# Try fallback to baseboard
@@ -245,138 +259,59 @@ if [ "$HW_MODEL" = "Unknown" ]; then
HW_MANUF=$(dmidec -q -s baseboard-manufacturer)
fi
-MODEL="$HW_MODEL"
-if [ "$HW_MANUF" != "Unknown" ]; then
- MODEL="$MODEL ($HW_MANUF)"
-fi
-echo "System model: $MODEL"
+HW_MANUF=$(bashesc "$HW_MANUF")
+HW_MODEL=$(bashesc "$HW_MODEL")
-# n) Dump raw data to a file
-DATAFILE=$(mktemp)
-cat > "$DATAFILE" <<-EOF
+################################################################################
+# Save raw data to report file
+#
+REPORTFILE="/run/hwreport"
+cat > "$REPORTFILE" <<-EOF
############################### CPU #####################################
Sockets: $(grep '^physical id' /proc/cpuinfo | sort -u | wc -l)
Real cores: $CPUCORES
Virtual cores: $VCORES
######################## Partition tables ###############################
EOF
-cat "$FDISK" >> "$DATAFILE"
-cat >> "$DATAFILE" <<-EOF
+cat "$FDISK" >> "$REPORTFILE"
+cat >> "$REPORTFILE" <<-EOF
############################ PCI ID #####################################
EOF
-lspci -n -m >> "$DATAFILE"
-cat >> "$DATAFILE" <<-EOF
+lspci -n -m >> "$REPORTFILE"
+cat >> "$REPORTFILE" <<-EOF
########################## dmidecode ####################################
EOF
-dmidecode >> "$DATAFILE"
+dmidecode >> "$REPORTFILE"
if [ -n "$ALLSMART" ] && [ -s "$ALLSMART" ]; then
- cat >> "$DATAFILE" <<-EOF
+ cat >> "$REPORTFILE" <<-EOF
########################### smartctl ####################################
EOF
- cat "$ALLSMART" >> "$DATAFILE"
+ cat "$ALLSMART" >> "$REPORTFILE"
fi
-cat >> "$DATAFILE" <<-EOF
+cat >> "$REPORTFILE" <<-EOF
#########################
EOF
echo "Created report file"
[ -n "$ALLSMART" ] && rm -f -- "$ALLSMART"
-# Put some info in local file for later use
-HDDCOUNT="${#DISKS[@]}"
-
-bashesc () {
- sed s/\'/\'\"\'\"\'/g <<<$*
-}
-HW_MANUF=$(bashesc "$HW_MANUF")
-HW_MODEL=$(bashesc "$HW_MODEL")
+################################################################################
+# Save information to local file for later use
+#
cat > "/run/hwinfo" <<HORST
HW_KVM='${VT}'
HW_ID44='${ID44}'
+HW_MAC='${MAC}'
HW_MBRAM='${RAM}'
-HW_HDDCOUNT='${HDDCOUNT}'
+HW_HDDCOUNT='${#DISKS[@]}'
+HW_BADSECTORS='${BADSECTORS}'
HW_MANUF='${HW_MANUF}'
HW_MODEL='${HW_MODEL}'
+HW_CPUMODEL='${CPUMODEL}'
HW_CORES='${CPUCORES}'
HW_THREADS='${VCORES}'
HORST
-# Build warning logfile (for lightdm)
-buildlogfile() {
- . /run/hwinfo
- exec 4> /run/hw-warnings.log
- CONTACT_RZ=
- if [ "$HW_KVM" = "DISABLED" ]; then
- echo "ff0000" "* 64Bit-Gast-Support (VT-x oder AMD-V) ist im BIOS deaktiviert. 64Bit VMs können nicht gestartet werden." >&4
- CONTACT_RZ=jau
- elif [ "$HW_KVM" = "UNSUPPORTED" ]; then
- echo "000000" "* CPU hat keinen 64Bit-Gast-Support (VT-x oder AMD-V). 64Bit VMs können nicht gestartet werden." >&4
- fi
- if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 3400 ]; then
- local GB=$(( ( HW_MBRAM + 300 ) / 1024 ))
- echo "000000" "* Dieser PC hat wenig RAM (${GB}GB). Die Leistung von VM-Sitzungen wird nicht optimal sein." >&4
- fi
- if [ "$HW_ID44" = "0" ]; then
- echo "000000" "* Keine ID44-Partition gefunden. VMs bekommen wenig RAM zugewiesen." >&4
- if [ "$HW_HDDCOUNT" = "0" ]; then
- echo "000000" " Keine Festplatte erkannt; eine Festplatte wird empfohlen, wenn Sie VMs nutzen wollen." >&4
- elif [ -n "$HW_HDDCOUNT" ]; then
- CONTACT_RZ=klar
- fi
- if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 4500 ]; then
- echo "ff0000" " Da der PC wenig RAM hat, ist die Einrichtung einer ID44-Partition dringend zu empfehlen." >&4
- fi
- elif [ -n "$HW_ID44" ] && [ "$HW_ID44" -lt 10000 ]; then
- echo "000000" "* Die ID44-Partition ist sehr klein. VM-Sitzungen könnten nach einiger Zeit aus Speichermangel abstürzen." >&4
- CONTACT_RZ=fjeden
- fi
- if [ -n "$SLX_VM_NFS" ] && ! systemctl status mount-vm-store >/dev/null; then
- echo "ff0000" "* Der VM-Store konnte nicht eingehängt werden. VMs können nicht gestartet werden." >&4
- echo "ff0000" " Versuchen Sie das Problem zu lösen, indem Sie den Computer neu starten." >&4
- fi
- if grep -q '^nouveau ' "/proc/modules"; then
- echo "ff5500" "* Die nVidia-Karte in diesem Rechner wird nur von den quelloffenen Treibern (nouveau) unterstützt, und daher mit verminderter Leistung laufen." >&4
- fi
- if [ -n "$CONTACT_RZ" ]; then
- echo "000000" " -- " >&4
- echo "000000" " -- Wenden Sie sich ggf. an den bwLehrpool-Support Ihres Rechenzentrums -- " >&4
- fi
-}
-
-buildlogfile &
-
-# Fire away
-echo "Submitting to $SLX_REMOTE_LOG"
-if curl --retry 4 --retry-connrefused --max-time 5 --retry-max-time 15 \
- --data-urlencode "type=~poweron" --data-urlencode "uuid=$UUID" --data-urlencode "macaddr=$MAC" \
- --data-urlencode "uptime=$UPTIME" --data-urlencode "realcores=$CPUCORES" --data-urlencode "mbram=$RAM" \
- --data-urlencode "kvmstate=$VT" --data-urlencode "cpumodel=$CPUMODEL" --data-urlencode "id44mb=$ID44" \
- --data-urlencode "badsectors=$BADSECTORS" --data-urlencode "systemmodel=$MODEL" \
- --data-urlencode "data@$DATAFILE" "$SLX_REMOTE_LOG" | grep -q "RESULT=0"; then
- echo "Success"
- rm -f -- "$DATAFILE"
- START=$(( $RANDOM % 5 ))
- DELAY=$(( $RANDOM % 20 ))
- cat > "/etc/cron.d/usage_stats" <<-EOF
- # Update usage statistics on server
-
- SHELL=/bin/sh
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/openslx/sbin:/opt/openslx/bin
-
- ${START}-59/5 * * * * root sleep ${DELAY}; /opt/openslx/scripts/cron-system_usage_update
- EOF
- touch "/etc/cron.d" # Sometimes, aufs doesn't update the mtime of dirs when creating files,
- # so cron would not rescan the cron directory
- cleanup
- # Trigger right now so resource usage gets updated
- /opt/openslx/scripts/cron-system_usage_update
- exit 0
-else
- echo "Failed..."
-fi
-
-echo "Server doesn't seem to support hardware/usage stats - disabling logging"
-rm -f -- "/etc/cron.d/usage_stats"
cleanup
-exit 1
+exit 0
diff --git a/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report b/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report
new file mode 100755
index 00000000..4510bfe4
--- /dev/null
+++ b/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report
@@ -0,0 +1,82 @@
+#!/bin/ash
+
+export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin
+
+. /opt/openslx/config
+
+disable_remote_logging() {
+ echo "Server doesn't seem to support hardware/usage stats - disabling logging"
+ rm -f -- "/etc/cron.d/usage_stats"
+}
+
+# sends the hardware information of this machine generated by
+# systemd-hardware_stats_gather in /run/hwreport and /run/hwinfo
+report_hardware_info() {
+ if [ -z "$SLX_REMOTE_LOG" ]; then
+ disable_remote_logging
+ return 1
+ fi
+ local hwreport="/run/hwreport"
+ if [ ! -s "$hwreport" ]; then
+ echo "Missing hwreport file: $hwreport"
+ # TODO send data without?
+ return 1
+ fi
+
+ # Read generated data and current uptime and send it
+ local hwinfo="/run/hwinfo"
+ if [ ! -s "$hwinfo" ]; then
+ echo "Missing hwinfo file: $hwinfo"
+ return 1
+ fi
+ . "$hwinfo"
+
+ # got everything, get the last infos
+ local uptime=$(grep -oE '^[0-9]+' /proc/uptime)
+
+ uuid=$(cat /etc/system-uuid)
+ if [ -z "$uuid" ] || [ "${#uuid}" -ne "36" ]; then
+ echo "No/malformed UUID, aborting" >&2
+ exit 1
+ fi
+
+ # Combine manufacturer and model name (for displaying purposes)
+ local model="$HW_MODEL"
+ if [ "$HW_MANUF" != "Unknown" ]; then
+ model="$model ($HW_MANUF)"
+ fi
+ # just assume the uuid/mac dumped are valid here (its checked often enough :))
+ echo -n "Submitting to '$SLX_REMOTE_LOG' ... "
+ curl --retry 4 --retry-connrefused --max-time 5 --retry-max-time 15 \
+ --data-urlencode "type=~poweron" --data-urlencode "uuid=$uuid" --data-urlencode "macaddr=$HW_MAC" \
+ --data-urlencode "uptime=$uptime" --data-urlencode "realcores=$HW_CORES" --data-urlencode "mbram=$HW_MBRAM" \
+ --data-urlencode "kvmstate=$HW_KVM" --data-urlencode "cpumodel=$HW_CPUMODEL" --data-urlencode "id44mb=$HW_ID44" \
+ --data-urlencode "badsectors=$HW_BADSECTORS" --data-urlencode "systemmodel=$model" \
+ --data-urlencode "data@$hwreport" "$SLX_REMOTE_LOG" | grep -q "RESULT=0"
+ local ret=$?
+ if [ "$ret" -ne 0 ]; then
+ echo "failed."
+ disable_remote_logging
+ return 1
+ fi
+ echo "succeeded."
+ rm -f -- "$hwreport"
+ START=$(( $RANDOM % 5 ))
+ DELAY=$(( $RANDOM % 20 ))
+ cat > "/etc/cron.d/usage_stats" <<-EOF
+ # Update usage statistics on server
+ SHELL=/bin/sh
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/openslx/sbin:/opt/openslx/bin
+
+ ${START}-59/5 * * * * root sleep ${DELAY}; /opt/openslx/scripts/cron-system_usage_update
+ EOF
+ # TODO remove this hack one day: Sometimes, aufs doesn't update the mtime of dirs
+ # when creating files, so cron would not rescan the cron directory.
+ touch "/etc/cron.d"
+ # Trigger right now so resource usage gets updated
+ /opt/openslx/scripts/cron-system_usage_update
+ return 0
+}
+
+report_hardware_info
+
diff --git a/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-warnings b/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-warnings
new file mode 100755
index 00000000..54894119
--- /dev/null
+++ b/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-warnings
@@ -0,0 +1,14 @@
+#!/bin/ash
+# This file is executed in /opt/openslx/scripts/systemd-generate_warnings
+# If a first parameter is given, we write to that file instead of stdout.
+
+. /opt/openslx/config
+. /run/hwinfo
+
+if [ -n "$1" ]; then
+ exec >> "$1"
+fi
+
+if grep -q '^nouveau ' "/proc/modules"; then
+ echo 'slx-gfx-nouveau'
+fi
diff --git a/core/modules/hardware-stats/data/opt/openslx/system-check/lang/de/slx-gfx-nouveau b/core/modules/hardware-stats/data/opt/openslx/system-check/lang/de/slx-gfx-nouveau
new file mode 100644
index 00000000..a85f6c36
--- /dev/null
+++ b/core/modules/hardware-stats/data/opt/openslx/system-check/lang/de/slx-gfx-nouveau
@@ -0,0 +1 @@
+* Die nVidia-Karte in diesem Rechner wird nur von den quelloffenen Treibern (nouveau) unterstützt, und daher mit verminderter Leistung laufen.
diff --git a/core/modules/hardware-stats/data/opt/openslx/system-check/tags/slx-gfx-nouveau b/core/modules/hardware-stats/data/opt/openslx/system-check/tags/slx-gfx-nouveau
new file mode 100644
index 00000000..3459a3a4
--- /dev/null
+++ b/core/modules/hardware-stats/data/opt/openslx/system-check/tags/slx-gfx-nouveau
@@ -0,0 +1,2 @@
+color="ff5500"
+contact=
diff --git a/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service b/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service
index 7140dcf2..88b76789 100644
--- a/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service
+++ b/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service
@@ -1,7 +1,7 @@
[Unit]
Description=Sets up the virtualization environment
-Before=graphical.target
-Wants=network-dns.target
+Before=graphical.target system-check.service
+Wants=network-dns.target system-check.service
After=network-dns.target
[Service]
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/hooks.d/30-run-virt b/core/modules/run-virt/data/opt/openslx/system-check/hooks.d/30-run-virt
new file mode 100755
index 00000000..2621ec83
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/hooks.d/30-run-virt
@@ -0,0 +1,44 @@
+#!/bin/ash
+
+. /opt/openslx/config
+. /opt/openslx/bin/slx-tools
+. /run/hwinfo
+
+if [ -n "$1" ]; then
+ exec >> "$1"
+fi
+
+if [ "$HW_KVM" = "DISABLED" ]; then
+ echo 'slx-virt-kvm-disabled'
+elif [ "$HW_KVM" = "UNSUPPORTED" ]; then
+ echo 'slx-virt-kvm-unsupported'
+fi
+
+if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 3400 ]; then
+ GB=$(( ( HW_MBRAM + 300 ) / 1024 ))
+ echo "slx-virt-lowmemory|${GB}"
+fi
+
+if [ -n "$SLX_VM_NFS" ] && ! systemctl status mount-vm-store >/dev/null; then
+ echo 'slx-virt-vmstore-fail'
+fi
+
+# TODO: when native sessions will be rolled out, we should always
+# check if an ID44 partition is present (to back the base OS).
+if fs_path_ismountpoint /tmp/virt; then
+ exit 0
+fi
+
+if [ "$HW_ID44" = "0" ]; then
+ echo 'slx-virt-noid44'
+ if [ "$HW_HDDCOUNT" = "0" ]; then
+ echo 'slx-virt-noid44-nohdd'
+ elif [ -n "$HW_HDDCOUNT" ]; then
+ echo 'slx-virt-noid44-hdd'
+ fi
+ if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 4500 ]; then
+ echo 'slx-virt-noid44-lowmemory'
+ fi
+elif [ -n "$HW_ID44" ] && [ "$HW_ID44" -lt 10000 ]; then
+ echo 'slx-virt-id44-small'
+fi
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-id44-small b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-id44-small
new file mode 100644
index 00000000..7f18ef1d
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-id44-small
@@ -0,0 +1 @@
+* Die ID44-Partition ist sehr klein. VM-Sitzungen könnten nach einiger Zeit aus Speichermangel abstürzen.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-disabled b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-disabled
new file mode 100644
index 00000000..407c8604
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-disabled
@@ -0,0 +1 @@
+* 64Bit-Gast-Support (VT-x oder AMD-V) ist im BIOS deaktiviert. 64Bit VMs können nicht gestartet werden.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-unsupported b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-unsupported
new file mode 100644
index 00000000..47e58f38
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-kvm-unsupported
@@ -0,0 +1 @@
+* CPU hat keinen 64Bit-Gast-Support (VT-x oder AMD-V). 64Bit VMs können nicht gestartet werden.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-lowmemory b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-lowmemory
new file mode 100644
index 00000000..3ccd7389
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-lowmemory
@@ -0,0 +1 @@
+* Dieser PC hat wenig RAM (%1%GB). Die Leistung von VM-Sitzungen wird nicht optimal sein.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44 b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44
new file mode 100644
index 00000000..e1938fdb
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44
@@ -0,0 +1 @@
+* Keine ID44-Partition gefunden. VMs bekommen wenig RAM zugewiesen.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-hdd b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-hdd
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-hdd
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-lowmemory b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-lowmemory
new file mode 100644
index 00000000..b92e38ac
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-lowmemory
@@ -0,0 +1 @@
+ Da der PC wenig RAM hat, ist die Einrichtung einer ID44-Partition dringend zu empfehlen.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-nohdd b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-nohdd
new file mode 100644
index 00000000..d3f09b29
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-noid44-nohdd
@@ -0,0 +1 @@
+ Keine Festplatte erkannt; eine Festplatte wird empfohlen, wenn Sie VMs nutzen wollen.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-vmstore-fail b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-vmstore-fail
new file mode 100644
index 00000000..eb5cccf7
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/de/slx-virt-vmstore-fail
@@ -0,0 +1,2 @@
+* Der VM-Store konnte nicht eingehängt werden. VMs können nicht gestartet werden.
+ Versuchen Sie das Problem zu lösen, indem Sie den Computer neu starten.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-lowram b/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-lowram
new file mode 100644
index 00000000..b71b3527
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-lowram
@@ -0,0 +1 @@
+ Since this computer has little memory, it is recommended to setup an ID44 partition.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-nohdd b/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-nohdd
new file mode 100644
index 00000000..55cf0065
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-nohdd
@@ -0,0 +1 @@
+ No hard drive detected; it is recommended to use at least one to use VMs.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-noidd44 b/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-noidd44
new file mode 100644
index 00000000..25b36f02
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/lang/en/slx-virt-noidd44
@@ -0,0 +1 @@
+* No ID44 partition found. VMs will be assigned less RAM.
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-id44-small b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-id44-small
new file mode 100644
index 00000000..b1e4f6eb
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-id44-small
@@ -0,0 +1,2 @@
+color="000000"
+contact=yes
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-disabled b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-disabled
new file mode 100644
index 00000000..9b452642
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-disabled
@@ -0,0 +1,2 @@
+color="ff0000"
+contact=yes
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-unsupported b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-unsupported
new file mode 100644
index 00000000..0e801767
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-kvm-unsupported
@@ -0,0 +1,2 @@
+color="000000"
+contact=
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-lowmemory b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-lowmemory
new file mode 100644
index 00000000..0e801767
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-lowmemory
@@ -0,0 +1,2 @@
+color="000000"
+contact=
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44 b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44
new file mode 100644
index 00000000..0e801767
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44
@@ -0,0 +1,2 @@
+color="000000"
+contact=
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-hdd b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-hdd
new file mode 100644
index 00000000..265ec18f
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-hdd
@@ -0,0 +1,2 @@
+color=
+contact=yes
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-lowmemory b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-lowmemory
new file mode 100644
index 00000000..78745c72
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-lowmemory
@@ -0,0 +1,2 @@
+color="ff0000"
+contact=
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-nohdd b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-nohdd
new file mode 100644
index 00000000..0e801767
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-noid44-nohdd
@@ -0,0 +1,2 @@
+color="000000"
+contact=
diff --git a/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-vmstore-fail b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-vmstore-fail
new file mode 100644
index 00000000..78745c72
--- /dev/null
+++ b/core/modules/run-virt/data/opt/openslx/system-check/tags/slx-virt-vmstore-fail
@@ -0,0 +1,2 @@
+color="ff0000"
+contact=
diff --git a/core/modules/system-check/data/etc/systemd/system/system-check.service b/core/modules/system-check/data/etc/systemd/system/system-check.service
new file mode 100644
index 00000000..c519b0cc
--- /dev/null
+++ b/core/modules/system-check/data/etc/systemd/system/system-check.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=todo
+Before=display-manager.service
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=/opt/openslx/scripts/systemd-system_check
+RemainAfterExit=yes
diff --git a/core/modules/system-check/data/opt/openslx/scripts/systemd-system_check b/core/modules/system-check/data/opt/openslx/scripts/systemd-system_check
new file mode 100644
index 00000000..d7403ca9
--- /dev/null
+++ b/core/modules/system-check/data/opt/openslx/scripts/systemd-system_check
@@ -0,0 +1,95 @@
+#!/bin/bash
+#
+# Kind of a generic message generation script. Scripts stored in
+# /opt/openslx/messages.d will be given the lightdm warnings file as first
+# param. They can choose to write to it or ignore it (when just curl'ing e.g.)
+
+. /opt/openslx/bin/slx-tools
+
+declare -rg root_dir="/opt/openslx/system-check"
+generate_messages() {
+ local hook_dir="${root_dir}/hooks.d"
+ local lang=en
+ # determine lang
+ if [ -z "$LANG" ] && [ -s "/etc/default/locale" ]; then
+ . /etc/default/locale
+ fi
+ [ -n "$LANG" ] && lang="${LANG:0:2}"
+
+ local dm_warning_file="$( \
+ awk -F'=' '$1 == "greeter-message-file" {print $2}' \
+ /etc/lightdm/qt-lightdm-greeter.conf)"
+ [ -z "$dm_warning_file" ] && dm_warning_file="/run/hw-warnings.log"
+ local dm_warning_tmp="$(mktemp)"
+
+ if [ ! -d "$hook_dir" ]; then
+ echo "Missing '$hook_dir' - dev failure?"
+ return 1
+ fi
+ for file in "$hook_dir"/*; do
+ [ -x "$file" ] || continue
+ (
+ "$file" "$dm_warning_tmp"
+ ) &
+ done
+ wait
+ # post-process, dm_warning_file contains just tags now
+ # check in /opt/openslx/messages/{lang,tags}
+ local blacklist="${root_dir}/blacklist"
+ local color do_contact
+ while read -r tag rest; do
+ IFS='|' tag_with_params=($tag)
+ # blacklisted?
+ grep -q "${tag_with_params[0]}" "$blacklist" && continue
+ # "meta" info?
+ [ -s "${root_dir}/tags/${tag_with_params[0]}" ] && \
+ . "${root_dir}/tags/${tag_with_params[0]}"
+ print_tag "${color:-000000}" "${tag_with_params[@]}" \
+ >> "$dm_warning_file"
+ # contact?
+ [ -n "$contact" ] && do_contact="yes"
+ done < "$dm_warning_tmp"
+
+ # add contact footer if needed
+ local support_tag="slx-contact-support"
+ if [ -n "$do_contact" ]; then
+ [ -s "${root_dir}/tags/${support_tag}" ] && \
+ . "${root_dir}/tags/${support_tag}"
+ print_tag "${color:-000000}" "${support_tag}" \
+ >> "$dm_warning_file"
+ fi
+}
+
+# print_tag <prefix> <file> <vars...>
+print_tag() {
+ [ "$#" -ge 2 ] || return 1
+ regex_imatch "$1" '^[0-9a-f]{6}$' || return 1
+ local prefix="$1"
+ shift
+ # since we fully pass the parsed tag as array, the first param
+ # is the tag name, the rest are the variables to substitute %i% with.
+ local tag="$1"
+ shift
+ # get localized message for this tag
+ local file="${root_dir}/lang/${lang}/${tag}"
+ if [ ! -f "$file" ]; then
+ # fallback
+ echo "000000" "Missing translation for '$tag'."
+ return 1
+ fi
+ while read -r line; do
+ line_cur="$line"
+ # go over vars and replace %i% with them
+ local count=1
+ while [ "$#" -ne 0 ]; do
+ line_cur="${line_cur//%${count}%/${1}}"
+ shift
+ (( count++ ))
+ done
+ echo "$prefix" "$line_cur"
+ done < "$file"
+}
+
+generate_messages
+exit 0
+
diff --git a/core/modules/system-check/data/opt/openslx/system-check/lang/de/slx-contact-support b/core/modules/system-check/data/opt/openslx/system-check/lang/de/slx-contact-support
new file mode 100644
index 00000000..304bd566
--- /dev/null
+++ b/core/modules/system-check/data/opt/openslx/system-check/lang/de/slx-contact-support
@@ -0,0 +1,2 @@
+ --
+ -- Wenden Sie sich ggf. an den bwLehrpool-Support Ihres Rechenzentrums --
diff --git a/core/modules/system-check/data/opt/openslx/system-check/tags/slx-contact-support b/core/modules/system-check/data/opt/openslx/system-check/tags/slx-contact-support
new file mode 100644
index 00000000..d3ed38eb
--- /dev/null
+++ b/core/modules/system-check/data/opt/openslx/system-check/tags/slx-contact-support
@@ -0,0 +1 @@
+color="000000"
diff --git a/core/modules/system-check/module.build b/core/modules/system-check/module.build
new file mode 100644
index 00000000..3c6eb632
--- /dev/null
+++ b/core/modules/system-check/module.build
@@ -0,0 +1,13 @@
+#!/bin/bash
+fetch_source() {
+ :
+}
+
+build() {
+ :
+}
+
+post_copy() {
+ :
+}
+
diff --git a/core/modules/system-check/module.conf b/core/modules/system-check/module.conf
new file mode 100644
index 00000000..90ac6b08
--- /dev/null
+++ b/core/modules/system-check/module.conf
@@ -0,0 +1,4 @@
+#!/bin/bash
+REQUIRED_MODULES=""
+REQUIRED_BINARIES=""
+
diff --git a/core/modules/system-check/module.conf.ubuntu b/core/modules/system-check/module.conf.ubuntu
new file mode 100644
index 00000000..41b87b6d
--- /dev/null
+++ b/core/modules/system-check/module.conf.ubuntu
@@ -0,0 +1,3 @@
+#!/bin/bash
+REQUIRED_INSTALLED_PACKAGES=""
+REQUIRED_CONTENT_PACKAGES=""