From b88374f2cc28b67429364935f50d5373b06a09da Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 29 Jun 2023 13:31:12 +0200 Subject: [PATCH 01/40] klog.service: Import existing file into repository --- misc_systemd_units/klog.service | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 misc_systemd_units/klog.service diff --git a/misc_systemd_units/klog.service b/misc_systemd_units/klog.service new file mode 100644 index 00000000..fdb607fe --- /dev/null +++ b/misc_systemd_units/klog.service @@ -0,0 +1,12 @@ +[Unit] +Description=Kernel Log Daemon +DefaultDependencies=no +Requires=syslog.target +After=syslog.target + +[Service] +ExecStart=/sbin/klogd -n +StandardOutput=syslog + +[Install] +WantedBy=basic.target From 7106154fffa6f3a042ae83e4f327acb7520e694f Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 29 Jun 2023 13:31:27 +0200 Subject: [PATCH 02/40] klog.service: Remove Note, that this service has not been enabled and /sbin/klogd doesn't exist. --- misc_systemd_units/klog.service | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 misc_systemd_units/klog.service diff --git a/misc_systemd_units/klog.service b/misc_systemd_units/klog.service deleted file mode 100644 index fdb607fe..00000000 --- a/misc_systemd_units/klog.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Kernel Log Daemon -DefaultDependencies=no -Requires=syslog.target -After=syslog.target - -[Service] -ExecStart=/sbin/klogd -n -StandardOutput=syslog - -[Install] -WantedBy=basic.target From 16994618b06dfb9914aec236f02c1d4e2e296654 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sun, 2 Jul 2023 10:01:13 +0200 Subject: [PATCH 03/40] fix-lpp, fix-uring: Remove We no longer have kernels which require these security live-patches, so remove. --- install.sh | 2 -- misc_systemd_units/fix-lpp.service | 11 ----------- misc_systemd_units/fix-uring.service | 11 ----------- 3 files changed, 24 deletions(-) delete mode 100644 misc_systemd_units/fix-lpp.service delete mode 100644 misc_systemd_units/fix-uring.service diff --git a/install.sh b/install.sh index d58444cf..95a08d4b 100755 --- a/install.sh +++ b/install.sh @@ -243,8 +243,6 @@ install_data misc_etc_files/udev/rules.d/10-ioschedulers.rules \ install_data slowio/slowio.slice "$DESTDIR$systemdunitdir/slowio.slice" install_exec slowio/slowio-mem-control "$DESTDIR$sysconfdir/systemd/system-generators/slowio-mem-control" install_exec slowio/slowio "$DESTDIR$usr_sbindir/slowio" -install_data misc_systemd_units/fix-lpp.service "$DESTDIR$systemdunitdir/fix-lpp.service" -install_data misc_systemd_units/fix-uring.service "$DESTDIR$systemdunitdir/fix-uring.service" install_exec misc_etc_files/mxq/gpu-policy "$DESTDIR$sysconfdir/mxq/gpu-policy" install_data misc_etc_files/os-release "$DESTDIR$sysconfdir/os-release" install_exec forensics/forensics "$DESTDIR$usr_sbindir/forensics" diff --git a/misc_systemd_units/fix-lpp.service b/misc_systemd_units/fix-lpp.service deleted file mode 100644 index 17632170..00000000 --- a/misc_systemd_units/fix-lpp.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -ConditionPathExists=/lib/modules/%v/fix-lpp.ko - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=modprobe fix-lpp -ExecStop=rmmod fix-lpp - -[Install] -WantedBy=basic.target diff --git a/misc_systemd_units/fix-uring.service b/misc_systemd_units/fix-uring.service deleted file mode 100644 index 1de7b37b..00000000 --- a/misc_systemd_units/fix-uring.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -ConditionPathExists=/lib/modules/%v/fix-uring.ko - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=modprobe fix-uring -ExecStop=rmmod fix-uring - -[Install] -WantedBy=basic.target From e0d9cb2339ad7892eeb3e5d9237c285885f63746 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 07:44:08 +0200 Subject: [PATCH 04/40] mxraid: Remove relict development files --- mxraid/README | 37 ----------------------------- mxraid/run_mxmount_after_raid.patch | 9 ------- mxraid/test_install.sh | 33 ------------------------- 3 files changed, 79 deletions(-) delete mode 100644 mxraid/README delete mode 100644 mxraid/run_mxmount_after_raid.patch delete mode 100755 mxraid/test_install.sh diff --git a/mxraid/README b/mxraid/README deleted file mode 100644 index 54d74d31..00000000 --- a/mxraid/README +++ /dev/null @@ -1,37 +0,0 @@ ---- aus einer mail -To: Peter Marquardt -From: Thomas Kreitler -Subject: mdadm.conf, kleiner ist besser :) -Date: Tue, 26 Sep 2017 17:03:10 +0200 ---- - -Hi, - -mit etwas probieren hab' ich die wohl 'minimalste' mdadm-config gefunden. - - -Vorher: --=-=-=-=-=-= schnipp =-=-=-=-=-=- -# /etc/local/mdadm/M0000.conf: -# config file for 'M0000', to be processed with: -# mdadm -A /dev/md0 -c /etc/local/mdadm/M0000.conf - -DEVICE /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi - -ARRAY /dev/md0 name=deadbird.molgen.mpg.de:M0000 metadata=1.2 level=raid6 num-devices=8 - -devices=/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde,/dev/sdf,/dev/sdg,/dev/sdh,/dev/sdi --=-=-=-=-=-= schnipp =-=-=-=-=-=- - - -Nacher: --=-=-=-=-=-= schnipp =-=-=-=-=-=- -ARRAY /dev/md0 devices=/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde,/dev/sdf,/dev/sdg,/dev/sdh,/dev/sdi --=-=-=-=-=-= schnipp =-=-=-=-=-=- - -leider geht kein: - - cat some.conf | mdadm -c- - - - diff --git a/mxraid/run_mxmount_after_raid.patch b/mxraid/run_mxmount_after_raid.patch deleted file mode 100644 index dc8e428e..00000000 --- a/mxraid/run_mxmount_after_raid.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- devel_mxmount/mxmount.service.old 2016-08-23 13:23:14.000000000 +0200 -+++ devel_mxmount/mxmount.service 2017-09-20 14:21:41.876330617 +0200 -@@ -1,5 +1,6 @@ - [Unit] - Description=MX mount local data filessystems -+After=mxraid.startup.service - ConditionPathExists=/etc/mxmounts - - [Service] diff --git a/mxraid/test_install.sh b/mxraid/test_install.sh deleted file mode 100755 index 6c5d1f46..00000000 --- a/mxraid/test_install.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh - -# Script to *test* installation of mxraid related parts on a host. -# This is *not* the regular install script. - -function die() { echo $1; exit; } - -[ "$UID" != "0" ] && die 'must be root' - -cp -v mxraid /usr/sbin -cp -v mxraid_assemble /usr/sbin - -# systemd units -cp -v mxraid.startup.service /etc/systemd/system -cp -v mxraid.shutdown.service /etc/systemd/system - -# phase 1, keep mxmounts ability to assemble, because mxraid is still declawed -# # 'fix' mxmount -# sed -i -e '/mdadm --assemble/ s/system/# system/' /usr/bin/mxmount - -# adjust mxmount unit, this will be done 'correctly' in mxmount after testing - -if ! grep -q mxraid.startup.service /etc/systemd/system/mxmount.service ; then - CWD=`pwd` - ( - cd /etc/systemd/system - cat $CWD/run_mxmount_after_raid.patch | patch -p1 --verbose - ) -fi - -# this must be done manually after the real install -systemctl enable mxraid.startup.service -systemctl enable mxraid.shutdown.service From 1245bb54d7d288787a5e75e187a5eade5ee51785 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 07:50:13 +0200 Subject: [PATCH 05/40] mxnetctl: Remove "upgrade" command Remove upgrade function, because we'll never need it again. --- mxnetctl/mxnetctl | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/mxnetctl/mxnetctl b/mxnetctl/mxnetctl index 24dbece4..304641c1 100755 --- a/mxnetctl/mxnetctl +++ b/mxnetctl/mxnetctl @@ -17,7 +17,6 @@ sub USAGE { usage: $0 start [options] stop [options] # (ignored) - upgrade # switch from eth to net options: --quiet : do not log actions @@ -193,40 +192,6 @@ sub start { } } - - -sub upgrade { - umask 022; - - -d '/etc/local' or mkdir '/etc/local' or die "/etc/local: $!\n"; - - read_mxnet(); - for my $dev (grep /^(eth|net)(\d+)/,network_hardware_devices()) { - my $hw=get_hw_address($dev); - my $new_dev=preferred_device_name($dev,$hw); - } - write_mxnet(); - - unlink "/etc/udev/rules.d/70-persistent-net.rules"; - - my $data=slurpfile('/etc/systemd/system/network.service'); - unless ($data=~/mxnetctl/) { - $data=~s#^ExecStart#ExecStart=/usr/sbin/mxnetctl start\nExecStart#m; - $data=~s/eth(\d+)/sprintf 'net%02d',$1/eg; - open my $out,'>','/etc/systemd/system/network.service' or die "/etc/systemd/system/network.service: $!\n"; - print $out $data; - close $out; - } - - warn "updated /etc/local/mxnet , /etc/systemd/system/network.service , /etc/udev/rules.d/70-persistent-net.rules - reboot to activate\n"; -} - - - - - - - GetOptions(OPTIONS) or die USAGE; @ARGV>=1 or die USAGE; @@ -238,9 +203,6 @@ if ($cmd eq 'start') { start(); } elsif ($cmd eq 'stop') { ; -} elsif ($cmd eq 'upgrade') { - upgrade(); - ; } else { die USAGE; } From 850eef8c290cbe9a4e4f8d315491bb609ea15e9a Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 07:54:03 +0200 Subject: [PATCH 06/40] mxnetctl: Remove redundant whitespace and useless comments --- mxnetctl/mxnetctl | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/mxnetctl/mxnetctl b/mxnetctl/mxnetctl index 304641c1..8f0bc151 100755 --- a/mxnetctl/mxnetctl +++ b/mxnetctl/mxnetctl @@ -4,8 +4,6 @@ use warnings; use Getopt::Long; -# options - our ($opt_quiet,$opt_noop,$opt_ignore_hw); use constant OPTIONS => ( 'quiet' => \$opt_quiet, @@ -24,7 +22,7 @@ options: __EOF__ } - + sub scandir { my ($dirname)=@_; opendir my $dir,$dirname or die "$dirname: $!\n"; @@ -58,27 +56,23 @@ sub get_hw_address { # 'eth1' -> '00:1b:21:79:76:67' return slurpfile_chomp($path); } - our %HW_TO_DEV; # ( '00:1b:21:79:76:67' => 'net02' , ... ) our %DEV_TO_HW; # ('net02'=>'00:1b:21:79:76:67', ... ) our $CHANGES; - sub register_stable { my ($hw,$dev)=@_; # force one-to-one mapping, even if file is erroneus - + exists $DEV_TO_HW{$dev} and delete $HW_TO_DEV{$DEV_TO_HW{$dev}}; exists $HW_TO_DEV{$dev} and delete $DEV_TO_HW{$HW_TO_DEV{$hw}}; - $HW_TO_DEV{$hw}=$dev; $DEV_TO_HW{$dev}=$hw; $CHANGES++; } - sub read_mxnet { %HW_TO_DEV=(); %DEV_TO_HW=(); @@ -102,12 +96,6 @@ sub write_mxnet { print $mxnet $DEV_TO_HW{$dev},' ',$dev."\n"; } print $mxnet "\n"; - -# open my $out,'>',"/etc/local/mxnet-udev.rules" or die "/etc/local/mxnet-udev.rules: $!\n"; -# print $out "# generated ".scalar(localtime)." by $0\n\n"; -# for my $dev (sort keys %DEV_TO_HW) { -# print $out qq'SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="$DEV_TO_HW{$dev}", NAME="$dev"\n'; -# } } } @@ -119,7 +107,6 @@ sub get_unused_name { } } - sub rename_if { my ($src,$dst)=@_; warn "rename $src to $dst\n" unless $opt_quiet; @@ -134,7 +121,6 @@ sub rename_if { } } - sub preferred_device_name { my ($dev,$hw)=@_; @@ -152,21 +138,19 @@ sub preferred_device_name { return $new_dev; } - - our $TMP_NUM=0; sub out_of_the_way { my ($dev)=@_; # only 'netXX' or 'ethX' - never 'tmpXX' - + -e "/sys/class/net/$dev/device" or return; - + my $i = $dev=~/(\d+)/; rename_if($dev,sprintf('tmpnet%02d',$TMP_NUM++)); } sub start { read_mxnet(); - + # 1: rename configured ethX and netXX devices to configured netXX - move away conflicting devices for my $dev (grep /^(eth|net)(\d+)/,network_hardware_devices()) { @@ -186,7 +170,6 @@ sub start { rename_if($dev,$new_dev); } - #if ($CHANGES || ! -e "/etc/local/mxnet-udev.rules") { if ($CHANGES) { write_mxnet(); } @@ -198,7 +181,6 @@ GetOptions(OPTIONS) or die USAGE; my ($cmd)=@ARGV; - if ($cmd eq 'start') { start(); } elsif ($cmd eq 'stop') { @@ -206,11 +188,3 @@ if ($cmd eq 'start') { } else { die USAGE; } - - - - - - - - From beefa58d0bac1e3f191a4fe995ee914c1a73d9fd Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 12:35:58 +0200 Subject: [PATCH 07/40] xaruba.service: Remove This service provided access to the aruba wlan controller for guest provisioning. This is long obsolete. --- install.sh | 1 - misc_systemd_units/xaruba.service | 14 -------------- 2 files changed, 15 deletions(-) delete mode 100644 misc_systemd_units/xaruba.service diff --git a/install.sh b/install.sh index 95a08d4b..9e1289bf 100755 --- a/install.sh +++ b/install.sh @@ -125,7 +125,6 @@ install_data misc_systemd_units/enable_overcommit_memory.service "$DESTDIR$syste install_data misc_systemd_units/startup-tags.service "$DESTDIR$systemdunitdir/startup-tags.service" install_data misc_systemd_units/unbound.service "$DESTDIR$systemdunitdir/unbound.service" install_exec misc_systemd_units/unbound-startup "$DESTDIR$usr_sbindir/unbound-startup" -install_data misc_systemd_units/xaruba.service "$DESTDIR$systemdunitdir/xaruba.service" install_exec mkmotd/mkmotd.pl "$DESTDIR$usr_sbindir/mkmotd.pl" install_data mkmotd/motd.service "$DESTDIR$systemdunitdir/motd.service" install_exec mxgrub/mxgrub "$DESTDIR$usr_sbindir/mxgrub" diff --git a/misc_systemd_units/xaruba.service b/misc_systemd_units/xaruba.service deleted file mode 100644 index 67c456e7..00000000 --- a/misc_systemd_units/xaruba.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -After=network.service gateway.service mxmount.service -Before=network.target - -ConditionHost=macheteinfach.molgen.mpg.de - -[Service] -Type=oneshot -RemainAfterExit=true -ExecStart=/usr/sbin/ip-nat start 141.14.27.49 443 172.19.109.10 4343 20 net04 -ExecStop=/usr/sbin/ip-nat stop 141.14.27.49 443 172.19.109.10 4343 20 net04 - -[Install] -WantedBy=network.target From 4fcc54c7e7a6312ac8220760da46d5b1a0235ee5 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 13:17:09 +0200 Subject: [PATCH 08/40] ip6.service: Import existing file into repository --- install.sh | 1 + misc_systemd_units/ip6.service | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 misc_systemd_units/ip6.service diff --git a/install.sh b/install.sh index 9e1289bf..a8a4153e 100755 --- a/install.sh +++ b/install.sh @@ -262,6 +262,7 @@ install_data misc_etc_files/request-key.d/id_resolver.conf \ "$DESTDIR$sysconfdir/request-key.d/id_resolver.conf" install_symlink /etc/local/access.conf "$DESTDIR$sysconfdir/security/access.conf" install_data misc_etc_files/cups/client.conf "$DESTDIR$sysconfdir/cups/client.conf" +install_data misc_systemd_units/ip6.service "$DESTDIR$systemdunitdir/ip6.service" postinstall exit diff --git a/misc_systemd_units/ip6.service b/misc_systemd_units/ip6.service new file mode 100644 index 00000000..728636a0 --- /dev/null +++ b/misc_systemd_units/ip6.service @@ -0,0 +1,15 @@ +[Unit] +DefaultDependencies=no +Wants=startup-tags.service +After=startup-tags.service +ConditionPathExists=/node/tags/ip6 + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/bash -c "echo 0 >/proc/sys/net/ipv6/conf/all/disable_ipv6" +ExecStop=/usr/bin/bash -c "echo 1 >/proc/sys/net/ipv6/conf/all/disable_ipv6" + +[Install] +WantedBy=network.target + From 5af77c3f78eb3f704197fd851bf4f5483ddb43a4 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 13:53:52 +0200 Subject: [PATCH 09/40] mxrouter.service: Import existing file into repository --- install.sh | 1 + mxrouter/mxrouter.service | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 mxrouter/mxrouter.service diff --git a/install.sh b/install.sh index a8a4153e..7e682503 100755 --- a/install.sh +++ b/install.sh @@ -263,6 +263,7 @@ install_data misc_etc_files/request-key.d/id_resolver.conf \ install_symlink /etc/local/access.conf "$DESTDIR$sysconfdir/security/access.conf" install_data misc_etc_files/cups/client.conf "$DESTDIR$sysconfdir/cups/client.conf" install_data misc_systemd_units/ip6.service "$DESTDIR$systemdunitdir/ip6.service" +install_data mxrouter/mxrouter.service "$DESTDIR$systemdunitdir/mxrouter.service" postinstall exit diff --git a/mxrouter/mxrouter.service b/mxrouter/mxrouter.service new file mode 100644 index 00000000..4d6d5765 --- /dev/null +++ b/mxrouter/mxrouter.service @@ -0,0 +1,17 @@ +[Unit] +Description=MX Router setup +Requires=network.service mxvlan.service +After=network.service mxvlan.service +Before=network.target +ConditionPathIsDirectory=/etc/local/mxrouter + +[Service] +Type=oneshot +RemainAfterExit=yes +StandardOutput=syslog +ExecStart=/usr/sbin/mxrouterctl start +ExecStop=/usr/sbin/mxrouterctl stop + +[Install] +WantedBy=network.target + From 4e69a295aa2a057f4b839825a4ae216e140291ba Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 15:04:28 +0200 Subject: [PATCH 10/40] mxrouter.service: Clean up mxrouter.service does not provice (local) network service, so normalize it. --- mxrouter/mxrouter.service | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mxrouter/mxrouter.service b/mxrouter/mxrouter.service index 4d6d5765..fd20b932 100644 --- a/mxrouter/mxrouter.service +++ b/mxrouter/mxrouter.service @@ -1,8 +1,4 @@ [Unit] -Description=MX Router setup -Requires=network.service mxvlan.service -After=network.service mxvlan.service -Before=network.target ConditionPathIsDirectory=/etc/local/mxrouter [Service] @@ -13,5 +9,5 @@ ExecStart=/usr/sbin/mxrouterctl start ExecStop=/usr/sbin/mxrouterctl stop [Install] -WantedBy=network.target +WantedBy=multi-user.target From e3dae4e6d11c23371d18a11978acde40deac2835 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 07:23:42 +0200 Subject: [PATCH 11/40] tree: Remove Description= from all units If a unit doesn't have a Description option, systemd will use the unit name in messages. I think that is better, because then you don't need to be familiar with the descriptions to mentally map, for example, "MX mount local data filessystems" (sic!) to "mxmount.service" to get from a log message to the unit name which you can use as an argument to `systemctl`or `journalctl`. --- blink/blinkd.service | 1 - checktrust/getty-checktrust.service | 1 - crashkernel/crashkernel.service | 1 - logrotate/logrotate.service | 1 - logrotate/logrotate.timer | 1 - misc_systemd_units/admin-sshd.service | 1 - misc_systemd_units/automount.service | 1 - misc_systemd_units/baucamhttpd.service | 3 --- misc_systemd_units/eturnal.service | 1 - misc_systemd_units/getcams.service | 3 --- misc_systemd_units/mxvlan.service | 1 - misc_systemd_units/network.service | 1 - misc_systemd_units/nfsd.service | 1 - misc_systemd_units/pacbio-sshd.service | 1 - misc_systemd_units/sshd.service | 1 - misc_systemd_units/udev-settled.target | 1 - mkmotd/motd.service | 1 - mxmount/mxmount.service | 1 - mxproxmox/proxmox-backup.service | 3 --- mxproxmox/proxmox-backup.timer | 2 -- mxraid/mxraid.shutdown.service | 1 - mxraid/mxraid.startup.service | 4 ---- nvidiactl/nvidia.service | 1 - serial-log/serial-log@.service | 3 --- 24 files changed, 36 deletions(-) diff --git a/blink/blinkd.service b/blink/blinkd.service index 966b2b1d..c93b5142 100644 --- a/blink/blinkd.service +++ b/blink/blinkd.service @@ -1,5 +1,4 @@ [Unit] -Description=blinkd ConditionHost=!wheatley.molgen.mpg.de ConditionHost=!cerberus.molgen.mpg.de ConditionHost=!welcome.molgen.mpg.de diff --git a/checktrust/getty-checktrust.service b/checktrust/getty-checktrust.service index 2d301e30..5c0765b8 100644 --- a/checktrust/getty-checktrust.service +++ b/checktrust/getty-checktrust.service @@ -1,5 +1,4 @@ [Unit] -Description=Check Mariux64 trust for getty Before=getty@.service [Install] diff --git a/crashkernel/crashkernel.service b/crashkernel/crashkernel.service index 2a2cf4cc..28b17e1b 100644 --- a/crashkernel/crashkernel.service +++ b/crashkernel/crashkernel.service @@ -1,5 +1,4 @@ [Unit] -Description=load crashkernel if enabled Wants=startup-crashmemory.service After=startup-crashmemory.service ConditionPathExists=/node/startup-crashmemory/available diff --git a/logrotate/logrotate.service b/logrotate/logrotate.service index b1c8a7c9..60b41876 100644 --- a/logrotate/logrotate.service +++ b/logrotate/logrotate.service @@ -1,5 +1,4 @@ [Unit] -Description=Rotate log files Documentation=man:logrotate(8) man:logrotate.conf(5) RequiresMountsFor=/var/log ConditionACPower=true diff --git a/logrotate/logrotate.timer b/logrotate/logrotate.timer index ea379318..af88397d 100644 --- a/logrotate/logrotate.timer +++ b/logrotate/logrotate.timer @@ -1,5 +1,4 @@ [Unit] -Description=Daily rotation of log files Documentation=man:logrotate(8) man:logrotate.conf(5) [Timer] diff --git a/misc_systemd_units/admin-sshd.service b/misc_systemd_units/admin-sshd.service index 70d1e8ee..5cd099fb 100644 --- a/misc_systemd_units/admin-sshd.service +++ b/misc_systemd_units/admin-sshd.service @@ -1,5 +1,4 @@ [Unit] -Description=Admin sshd After=network.target ConditionHost=|bka.molgen.mpg.de diff --git a/misc_systemd_units/automount.service b/misc_systemd_units/automount.service index e9d1c4f7..15187462 100644 --- a/misc_systemd_units/automount.service +++ b/misc_systemd_units/automount.service @@ -1,5 +1,4 @@ [Unit] -Description=Automounter Requires=basic.target After=basic.target diff --git a/misc_systemd_units/baucamhttpd.service b/misc_systemd_units/baucamhttpd.service index bed423e5..3bab0f55 100644 --- a/misc_systemd_units/baucamhttpd.service +++ b/misc_systemd_units/baucamhttpd.service @@ -1,6 +1,3 @@ -[Unit] -Description=mxstartup baucamhttpd - [Service] User=zmuser ExecStartPre=/project/baucam/allowhosts.pl diff --git a/misc_systemd_units/eturnal.service b/misc_systemd_units/eturnal.service index e30df3d3..a5b1755d 100644 --- a/misc_systemd_units/eturnal.service +++ b/misc_systemd_units/eturnal.service @@ -1,5 +1,4 @@ [Unit] -Description=eturnal STUN/TURN server Wants=epmd.service After=epmd.service network.target Documentation=https://eturnal.net/documentation/ diff --git a/misc_systemd_units/getcams.service b/misc_systemd_units/getcams.service index b944f0d6..7d1f20ea 100644 --- a/misc_systemd_units/getcams.service +++ b/misc_systemd_units/getcams.service @@ -1,6 +1,3 @@ -[Unit] -Description=mxstartup baucamhttpd - [Service] User=zmuser WorkingDirectory=/project/baucam diff --git a/misc_systemd_units/mxvlan.service b/misc_systemd_units/mxvlan.service index 2d28d49d..bd889a86 100644 --- a/misc_systemd_units/mxvlan.service +++ b/misc_systemd_units/mxvlan.service @@ -1,5 +1,4 @@ [Unit] -Description=MX VLAN Setup Wants=network.service After=network.service Before=network.target diff --git a/misc_systemd_units/network.service b/misc_systemd_units/network.service index 09e2cf7f..fac91273 100644 --- a/misc_systemd_units/network.service +++ b/misc_systemd_units/network.service @@ -1,5 +1,4 @@ [Unit] -Description=Network Connectivity DefaultDependencies=no [Service] diff --git a/misc_systemd_units/nfsd.service b/misc_systemd_units/nfsd.service index 91fa8ca4..403382e2 100644 --- a/misc_systemd_units/nfsd.service +++ b/misc_systemd_units/nfsd.service @@ -1,5 +1,4 @@ [Unit] -Description=NFS Daemon ConditionPathExists=/etc/exports Requires=local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount After=local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount unbound.service mxmount.service diff --git a/misc_systemd_units/pacbio-sshd.service b/misc_systemd_units/pacbio-sshd.service index 69d82c69..08c0eccd 100644 --- a/misc_systemd_units/pacbio-sshd.service +++ b/misc_systemd_units/pacbio-sshd.service @@ -1,5 +1,4 @@ [Unit] -Description=vlan.pacbio auf smrtlink sshd After=network.target ConditionHost=smrtlink.molgen.mpg.de diff --git a/misc_systemd_units/sshd.service b/misc_systemd_units/sshd.service index 375efde7..5b6caed3 100644 --- a/misc_systemd_units/sshd.service +++ b/misc_systemd_units/sshd.service @@ -1,5 +1,4 @@ [Unit] -Description=OpenSSH Secure Shell Service After=syslog.target network.target [Service] diff --git a/misc_systemd_units/udev-settled.target b/misc_systemd_units/udev-settled.target index 1f0ce5d9..05fa0e59 100644 --- a/misc_systemd_units/udev-settled.target +++ b/misc_systemd_units/udev-settled.target @@ -6,7 +6,6 @@ # per DefaultDependencies=yes. [Unit] -Description=udev Settled DefaultDependencies=no Wants=systemd-udev-settle.service After=systemd-udev-settle.service diff --git a/mkmotd/motd.service b/mkmotd/motd.service index 67d6e448..2c55cc42 100644 --- a/mkmotd/motd.service +++ b/mkmotd/motd.service @@ -1,5 +1,4 @@ [Unit] -Description=Make motd After=startup-tags.service [Service] diff --git a/mxmount/mxmount.service b/mxmount/mxmount.service index c5d64aea..e9fa10b9 100644 --- a/mxmount/mxmount.service +++ b/mxmount/mxmount.service @@ -1,5 +1,4 @@ [Unit] -Description=MX mount local data filessystems After=mxraid.startup.service ConditionPathExists=/etc/mxmounts diff --git a/mxproxmox/proxmox-backup.service b/mxproxmox/proxmox-backup.service index f842f4f2..26dd8714 100644 --- a/mxproxmox/proxmox-backup.service +++ b/mxproxmox/proxmox-backup.service @@ -1,6 +1,3 @@ -[Unit] -Description=Proxmox Backup - [Service] Slice=slowio.slice ExecStart=/usr/sbin/slowio PHASE2 /usr/bin/mxproxmox local-backups diff --git a/mxproxmox/proxmox-backup.timer b/mxproxmox/proxmox-backup.timer index 83ff55c5..aa108d8e 100644 --- a/mxproxmox/proxmox-backup.timer +++ b/mxproxmox/proxmox-backup.timer @@ -1,6 +1,4 @@ [Unit] -Description=Daily trigger of promox-backup.service - ConditionHost=!deathofrats.molgen.mpg.de [Timer] diff --git a/mxraid/mxraid.shutdown.service b/mxraid/mxraid.shutdown.service index 218a8418..05871c5d 100644 --- a/mxraid/mxraid.shutdown.service +++ b/mxraid/mxraid.shutdown.service @@ -1,5 +1,4 @@ [Unit] -Description=MX disassemble local software raids After=lazy-umount-nfs.service DefaultDependencies=false diff --git a/mxraid/mxraid.startup.service b/mxraid/mxraid.startup.service index 6e799b9c..5971bc03 100644 --- a/mxraid/mxraid.startup.service +++ b/mxraid/mxraid.startup.service @@ -1,7 +1,3 @@ -[Unit] -Description=MX assemble local software raids -# ConditionPathExists=/etc/mdadmconf_db - [Service] Type=oneshot RemainAfterExit=yes diff --git a/nvidiactl/nvidia.service b/nvidiactl/nvidia.service index 3b7a8fd8..b6b96d53 100644 --- a/nvidiactl/nvidia.service +++ b/nvidiactl/nvidia.service @@ -1,5 +1,4 @@ [Unit] -Description=NVIDIA Kernel Driver Before=gdm.service [Service] diff --git a/serial-log/serial-log@.service b/serial-log/serial-log@.service index 917907c7..c8feee89 100644 --- a/serial-log/serial-log@.service +++ b/serial-log/serial-log@.service @@ -1,6 +1,3 @@ -[Unit] -Description=TTY logger - [Service] ExecStart=/usr/libexec/serial-log %I Type=simple From a821f509d528dd58555e7a5b2e555f850fdbd278 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 29 Jun 2023 09:26:31 +0200 Subject: [PATCH 12/40] tree: Remove dependency on obsoleted gateway.service --- misc_systemd_units/named.service | 2 +- misc_systemd_units/unbound.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc_systemd_units/named.service b/misc_systemd_units/named.service index edc7a81f..917b4d08 100644 --- a/misc_systemd_units/named.service +++ b/misc_systemd_units/named.service @@ -1,5 +1,5 @@ [Unit] -After=network.service gateway.service mxmount.service automount.service +After=network.service mxmount.service automount.service Before=mxstartup-mxvip.service ConditionHost=wtf.molgen.mpg.de diff --git a/misc_systemd_units/unbound.service b/misc_systemd_units/unbound.service index b03d7132..3cf1239e 100644 --- a/misc_systemd_units/unbound.service +++ b/misc_systemd_units/unbound.service @@ -1,5 +1,5 @@ [Unit] -After=network.service gateway.service +After=network.service [Service] Type=forking From 28a7a1f1fed6b91f86abd79dfa52b787f7011338 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 19 Jun 2023 15:07:24 +0200 Subject: [PATCH 13/40] startup-tags: Pull startup-tags from sysinit.target Make startup-tags a dependency of sysinit-target With this change, we no longer need to create an explicit dependency to this unit in conditionally started service or socket units, because these units have a default order dependency on sysinit.target and the later basic.target. --- misc_systemd_units/startup-tags.service | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/misc_systemd_units/startup-tags.service b/misc_systemd_units/startup-tags.service index fc2b4de8..fd0ce9b6 100644 --- a/misc_systemd_units/startup-tags.service +++ b/misc_systemd_units/startup-tags.service @@ -1,7 +1,12 @@ [Unit] +DefaultDependencies=no +After=systemd-remount-fs.service +Before=sysinit.target [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/sbin/hostconfig --populate-node +[Install] +WantedBy=sysinit.target From 6285deb3b839ccc4aae9f8eb8937dc2de41542f6 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 19 Jun 2023 16:49:15 +0200 Subject: [PATCH 14/40] tree: Remove dependencies on startup-tags.service startup-tags.service has been made a dependency of sysinit.target. As all services depend on sysinit.target by default, we no longer need an explicit dependency on startup-targs.service in the individual services. --- misc_systemd_units/enable_overcommit_memory.service | 2 -- mkmotd/motd.service | 3 --- 2 files changed, 5 deletions(-) diff --git a/misc_systemd_units/enable_overcommit_memory.service b/misc_systemd_units/enable_overcommit_memory.service index 46b86b73..6b6e94ce 100644 --- a/misc_systemd_units/enable_overcommit_memory.service +++ b/misc_systemd_units/enable_overcommit_memory.service @@ -1,6 +1,4 @@ [Unit] -Wants=startup-tags.service -After=startup-tags.service ConditionPathExists=|/node/tags/desktop ConditionHost=|beebee-ate.molgen.mpg.de ConditionHost=|icebear.molgen.mpg.de diff --git a/mkmotd/motd.service b/mkmotd/motd.service index 2c55cc42..51b997d1 100644 --- a/mkmotd/motd.service +++ b/mkmotd/motd.service @@ -1,6 +1,3 @@ -[Unit] -After=startup-tags.service - [Service] Type=oneshot ExecStart=/usr/sbin/mkmotd.pl From 78694b188346570c954e4fae80e1a607f15c7be3 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 20 Jun 2023 09:19:49 +0200 Subject: [PATCH 15/40] automount.service: Start before basic.target Currently, automount.service races with mxstartup.service. mxstartup itself and also the services it starts, expect paths like /pkg to be available. So make automount namespace part of basic.target. Normal Services order after basic.target by default. --- misc_systemd_units/automount.service | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/misc_systemd_units/automount.service b/misc_systemd_units/automount.service index 15187462..b5a0aad9 100644 --- a/misc_systemd_units/automount.service +++ b/misc_systemd_units/automount.service @@ -1,6 +1,8 @@ [Unit] -Requires=basic.target -After=basic.target +DefaultDependencies=no +Requires=sysinit.target +After=sysinit.target +Before=basic.target [Service] Type=forking @@ -11,5 +13,5 @@ ExecReload=/bin/kill -HUP $MAINPID Restart=always [Install] -WantedBy=multi-user.target +WantedBy=basic.target From a0a6050d54a560526dee42d5249ec8d33c4d76ae Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 21 Jun 2023 16:34:47 +0200 Subject: [PATCH 16/40] getty-checktrust: Fix dependencies It is not possible to use template units with directives, so Before=getty@.service does not work. There is a getty-pre.target unit which can be requested by services, which want to be ordered before getty. Use that instead. Although, WantedBy=getty@.service does work, this is strictly not correct, because we want this service to run indepdendent from getty, for example, to set the tag for lightdm. Change to WantedBy=multi-user.target. --- checktrust/getty-checktrust.service | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/checktrust/getty-checktrust.service b/checktrust/getty-checktrust.service index 5c0765b8..21eb79c2 100644 --- a/checktrust/getty-checktrust.service +++ b/checktrust/getty-checktrust.service @@ -1,10 +1,11 @@ [Unit] -Before=getty@.service - -[Install] -WantedBy=getty@.service +Wants=getty-pre.target +Before=getty-pre.target [Service] Type=oneshot ExecStart=/usr/libexec/getty-checktrust RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From 01237182f0625b2e024d2900168cf2c3079b1837 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 07:59:07 +0200 Subject: [PATCH 17/40] Add wait-network-online.service Add a service which waits (max 15 seconds) for the network to be available. We define 'available' as the ability to ping our default router by its name, which implies dns is working. Service units, which really need network to start, should add After=network-online.target Wants=network-online.target --- install.sh | 2 ++ misc_systemd_units/wait-network-online.service | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 misc_systemd_units/wait-network-online.service diff --git a/install.sh b/install.sh index 7e682503..e529f2a3 100755 --- a/install.sh +++ b/install.sh @@ -264,6 +264,8 @@ install_symlink /etc/local/access.conf "$DESTDIR$sysconfdir/s install_data misc_etc_files/cups/client.conf "$DESTDIR$sysconfdir/cups/client.conf" install_data misc_systemd_units/ip6.service "$DESTDIR$systemdunitdir/ip6.service" install_data mxrouter/mxrouter.service "$DESTDIR$systemdunitdir/mxrouter.service" +install_data misc_systemd_units/wait-network-online.service \ + "$DESTDIR$systemdunitdir/wait-network-online.service" postinstall exit diff --git a/misc_systemd_units/wait-network-online.service b/misc_systemd_units/wait-network-online.service new file mode 100644 index 00000000..425e7a29 --- /dev/null +++ b/misc_systemd_units/wait-network-online.service @@ -0,0 +1,14 @@ +[Unit] +DefaultDependencies=no +After=sysinit.target network.target +Before=network-online.target + +[Service] +Type=oneshot +RemainAfterExit=true +TimeoutStartSec=15 +StandardOutput=null +ExecStart=bash -c 'while ! ping -c 1 -w 1 rick.molgen.mpg.de; do sleep 1 ; done' + +[Install] +WantedBy=network-online.target From 915614d53d52ae7ab655e199fa47d2b4bd1d2a49 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 09:45:24 +0200 Subject: [PATCH 18/40] sysctl.conf: Allow inet free binds Allow inet free binds (bind to any ip address) so that services which bind to specific ip addresses (e.g. $MX_IPADDR) don't need to wait for network setup. This simplifies our startup, because we can avoid to pull network-online.target or order units after network.service just to to be able to listen to a specific address. Note, that we still need network to resolve names to addresses. --- misc_etc_files/sysctl.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/misc_etc_files/sysctl.conf b/misc_etc_files/sysctl.conf index 242ef180..0f4c7a67 100644 --- a/misc_etc_files/sysctl.conf +++ b/misc_etc_files/sysctl.conf @@ -45,3 +45,9 @@ kernel.shmall = 34359738368 # user request: Allow CPU event access by users without CAP_SYS_ADMIN kernel.perf_event_paranoid = -1 + +# allow inet free binds (bind to any ip address) so that services which bind to +# specific ip addresses (e.g. $MX_IPADDR) don't need to wait for network setup + +net.ipv4.ip_nonlocal_bind = 1 +net.ipv6.ip_nonlocal_bind = 1 From 9f89f0b994d8bce2cb7f6475b27e181f7bb1cf8f Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 09:54:18 +0200 Subject: [PATCH 19/40] tree: Fix network startup See [1]. The network service providers (network.service, mxvlan.service, unbound.service) are pulled from multi-user.target (not from network.target). network.service pulls network.target so that other services might use "After=network.target" (only for shutdown order). network.service, which has DefaultDependencies=no, needs to order iteslf behind sysinit.target, so that the network devices are available. [1]: https://systemd.io/NETWORK_ONLINE/ --- misc_systemd_units/mxvlan.service | 6 +++--- misc_systemd_units/network.service | 5 ++++- misc_systemd_units/unbound.service | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/misc_systemd_units/mxvlan.service b/misc_systemd_units/mxvlan.service index bd889a86..735d6f53 100644 --- a/misc_systemd_units/mxvlan.service +++ b/misc_systemd_units/mxvlan.service @@ -1,6 +1,6 @@ [Unit] -Wants=network.service -After=network.service +DefaultDependencies=no +After=sysinit.target Before=network.target [Service] @@ -11,5 +11,5 @@ ExecStop=/usr/sbin/mxvlanctl stop ExecReload=/usr/sbin/mxvlanctl restart [Install] -WantedBy=network.target +WantedBy=multi-user.target diff --git a/misc_systemd_units/network.service b/misc_systemd_units/network.service index fac91273..6eba6542 100644 --- a/misc_systemd_units/network.service +++ b/misc_systemd_units/network.service @@ -1,5 +1,8 @@ [Unit] DefaultDependencies=no +After=sysinit.target +Before=network.target +Wants=network.target [Service] EnvironmentFile=/etc/local/mxhost.conf @@ -12,4 +15,4 @@ ExecStart=/sbin/ip route add default via 141.14.16.128 ExecStop=/sbin/ip addr del ${MX_IPADDR}/20 dev ${MX_NETDEV} [Install] -WantedBy=network.target +WantedBy=multi-user.target diff --git a/misc_systemd_units/unbound.service b/misc_systemd_units/unbound.service index 3cf1239e..f962954e 100644 --- a/misc_systemd_units/unbound.service +++ b/misc_systemd_units/unbound.service @@ -1,5 +1,7 @@ [Unit] -After=network.service +DefaultDependencies=no +After=sysinit.target +Before=network.target [Service] Type=forking @@ -8,5 +10,5 @@ ExecStart=/usr/sbin/unbound PIDFile=/var/unbound/unbound.pid [Install] -WantedBy=network.target +WantedBy=multi-user.target From 73c9252dcf0093b2f0a7177e191823eaa4af14f7 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 10:25:34 +0200 Subject: [PATCH 20/40] tree: Don't let services wait for network.target --- clusterd/clusterd.service | 4 ---- misc_systemd_units/admin-sshd.service | 2 -- misc_systemd_units/sshd.service | 3 --- mxshadow/mxshadow.service | 2 -- 4 files changed, 11 deletions(-) diff --git a/clusterd/clusterd.service b/clusterd/clusterd.service index c5566ef4..99125dff 100644 --- a/clusterd/clusterd.service +++ b/clusterd/clusterd.service @@ -1,7 +1,3 @@ -[Unit] -Requires=network.target -After=network.target - [Service] ExecStart=/usr/sbin/clusterd --daemon Restart=always diff --git a/misc_systemd_units/admin-sshd.service b/misc_systemd_units/admin-sshd.service index 5cd099fb..450c7c90 100644 --- a/misc_systemd_units/admin-sshd.service +++ b/misc_systemd_units/admin-sshd.service @@ -1,6 +1,4 @@ [Unit] -After=network.target - ConditionHost=|bka.molgen.mpg.de [Service] diff --git a/misc_systemd_units/sshd.service b/misc_systemd_units/sshd.service index 5b6caed3..be8c5872 100644 --- a/misc_systemd_units/sshd.service +++ b/misc_systemd_units/sshd.service @@ -1,6 +1,3 @@ -[Unit] -After=syslog.target network.target - [Service] EnvironmentFile=/etc/local/mxhost.conf ExecStart=/usr/sbin/sshd -D -o "ListenAddress ${MX_IPADDR}" diff --git a/mxshadow/mxshadow.service b/mxshadow/mxshadow.service index f72505e3..239dfec2 100644 --- a/mxshadow/mxshadow.service +++ b/mxshadow/mxshadow.service @@ -1,6 +1,4 @@ [Unit] -Requires=network.target -After=network.target ConditionHost=wtf.molgen.mpg.de [Service] From bc416e70d9dde3a7c79efe2d0f46e22a7a5d6815 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sun, 2 Jul 2023 15:13:55 +0200 Subject: [PATCH 21/40] netlog: Wait for network-online.target not network.target --- netlog/netlog.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netlog/netlog.service b/netlog/netlog.service index 56b70616..bdcf0748 100644 --- a/netlog/netlog.service +++ b/netlog/netlog.service @@ -1,6 +1,6 @@ [Unit] -Requires=network.target -After=network.target +Wants=network-online.target +After=network-online.target [Service] ExecStart=/usr/sbin/netlog --daemon /var/log/messages /var/log/mail.log From d9666a52d43eef12cddf36bd9d190f44203399fd Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 10:50:17 +0200 Subject: [PATCH 22/40] getty-checktrust: Wait for network --- checktrust/getty-checktrust.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/checktrust/getty-checktrust.service b/checktrust/getty-checktrust.service index 21eb79c2..9ddd4334 100644 --- a/checktrust/getty-checktrust.service +++ b/checktrust/getty-checktrust.service @@ -1,6 +1,8 @@ [Unit] Wants=getty-pre.target Before=getty-pre.target +After=network-online.target +Wants=network-online.target [Service] Type=oneshot From 3e605d5674ecfdf5eced7f32bb5b557cb218c1ff Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 11:01:15 +0200 Subject: [PATCH 23/40] nvidiactl: Order after getty-pre.target Units, which want to use the console before getty is started, can order themself before getty-pre.target. Use the same target before loading a graphics driver which disrupts the screen. --- nvidiactl/nvidia.service | 1 + 1 file changed, 1 insertion(+) diff --git a/nvidiactl/nvidia.service b/nvidiactl/nvidia.service index b6b96d53..6bf81da0 100644 --- a/nvidiactl/nvidia.service +++ b/nvidiactl/nvidia.service @@ -1,5 +1,6 @@ [Unit] Before=gdm.service +After=getty-pre.target [Service] Type=oneshot From 9df0af52e4a8c3860f0a0fce9b5683fdde2fd3fa Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 11:13:13 +0200 Subject: [PATCH 24/40] modprobe.d: Disable i915 --- install.sh | 1 + misc_etc_files/modprobe.d/disable-i915.conf | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 misc_etc_files/modprobe.d/disable-i915.conf diff --git a/install.sh b/install.sh index e529f2a3..20fc2260 100755 --- a/install.sh +++ b/install.sh @@ -266,6 +266,7 @@ install_data misc_systemd_units/ip6.service "$DESTDIR$systemdunitd install_data mxrouter/mxrouter.service "$DESTDIR$systemdunitdir/mxrouter.service" install_data misc_systemd_units/wait-network-online.service \ "$DESTDIR$systemdunitdir/wait-network-online.service" +install_data misc_etc_files/modprobe.d/disable-i915.conf "$DESTDIR$sysconfdir/modprobe.d/disable-i915.conf" postinstall exit diff --git a/misc_etc_files/modprobe.d/disable-i915.conf b/misc_etc_files/modprobe.d/disable-i915.conf new file mode 100644 index 00000000..288e8336 --- /dev/null +++ b/misc_etc_files/modprobe.d/disable-i915.conf @@ -0,0 +1,11 @@ +# Disable autoloading of i915 driver so that the console output is +# not destroyed during boot for systems with the monitor on an nvidia card. +# Loading the i915 driver seems to disable the console output to the +# nvida card, possibly switching it to the intel card. +# +# When the console is free, we probe the driver manually, so we can use its other +# functionalities like audio. +# +# For yet unknown reasons, `blacklist i915` does not work so use `install i915 /bin/true` for now. + +install i915 /bin/true From 0b8af459ad9a2089e3b989b39a0e53486df53896 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 11:23:51 +0200 Subject: [PATCH 25/40] i915.service: Add After we disabled autoloading of i915 to avoid loosing the startup console on an nvidia card, we need to load it manually. Add service to do so. --- install.sh | 1 + misc_systemd_units/i915.service | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 misc_systemd_units/i915.service diff --git a/install.sh b/install.sh index 20fc2260..01c29935 100755 --- a/install.sh +++ b/install.sh @@ -267,6 +267,7 @@ install_data mxrouter/mxrouter.service "$DESTDIR$systemdunitd install_data misc_systemd_units/wait-network-online.service \ "$DESTDIR$systemdunitdir/wait-network-online.service" install_data misc_etc_files/modprobe.d/disable-i915.conf "$DESTDIR$sysconfdir/modprobe.d/disable-i915.conf" +install_data misc_systemd_units/i915.service "$DESTDIR$systemdunitdir/i915.service" postinstall exit diff --git a/misc_systemd_units/i915.service b/misc_systemd_units/i915.service new file mode 100644 index 00000000..419a2e08 --- /dev/null +++ b/misc_systemd_units/i915.service @@ -0,0 +1,10 @@ +[Unit] +After=getty-pre.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=modprobe -C /dev/null i915 + +[Install] +WantedBy=multi-user.target From 4307bd0f6d33154e7ad084cab237806954a238eb Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 13:04:26 +0200 Subject: [PATCH 26/40] mxraid, mxmount: Start before basic.target There is a race when other services want to use local amd paths. All services order behind basic.target per default, so move mxraid and mxmount before it. Also make mxraid.startup.service and mxraid.shutdown.service into one but temporarily keep mxraid.shutdown.service for running systems. Use systemd-udev-settle.service instead of our udev-settled.target, which can be removed in a later commit. --- install.sh | 2 +- mxmount/mxmount.service | 5 ++++- mxraid/mxraid.service | 16 ++++++++++++++++ mxraid/mxraid.startup.service | 7 ------- 4 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 mxraid/mxraid.service delete mode 100644 mxraid/mxraid.startup.service diff --git a/install.sh b/install.sh index 01c29935..4db71efe 100755 --- a/install.sh +++ b/install.sh @@ -145,7 +145,7 @@ install_exec pkgadmin/pkgadmin "$DESTDIR$usr_sbindir/p install_cron pkgadmin/crond-pkgadmin-update "$DESTDIR$crond_dir/pkgadmin-update" install_exec mxraid/mxraid "$DESTDIR$usr_sbindir/mxraid" install_exec mxraid/mxraid_assemble "$DESTDIR$usr_sbindir/mxraid_assemble" -install_data mxraid/mxraid.startup.service "$DESTDIR$systemdunitdir/mxraid.startup.service" +install_data mxraid/mxraid.service "$DESTDIR$systemdunitdir/mxraid.service" install_data mxraid/mxraid.shutdown.service "$DESTDIR$systemdunitdir/mxraid.shutdown.service" install_exec mxraid/mdcheck.safe "$DESTDIR$usr_bindir/mdcheck.safe" install_cron mxraid/crond-mdcheck "$DESTDIR$crond_dir/mdcheck" diff --git a/mxmount/mxmount.service b/mxmount/mxmount.service index e9fa10b9..b32ba9da 100644 --- a/mxmount/mxmount.service +++ b/mxmount/mxmount.service @@ -1,6 +1,9 @@ [Unit] -After=mxraid.startup.service +DefaultDependencies=no ConditionPathExists=/etc/mxmounts +Before=local-fs.target +After=systemd-udev-settle.service +Wants=systemd-udev-settle.service [Service] Type=oneshot diff --git a/mxraid/mxraid.service b/mxraid/mxraid.service new file mode 100644 index 00000000..6858263e --- /dev/null +++ b/mxraid/mxraid.service @@ -0,0 +1,16 @@ +[Unit] +DefaultDependencies=no +After=systemd-udev-settle.service +Wants=systemd-udev-settle.service +Before=mxmount.service +Conflicts=shutdown.target +Before=shutdown.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/sbin/mxraid start +ExecStop=/usr/sbin/mxraid stop + +[Install] +WantedBy=local-fs.target diff --git a/mxraid/mxraid.startup.service b/mxraid/mxraid.startup.service deleted file mode 100644 index 5971bc03..00000000 --- a/mxraid/mxraid.startup.service +++ /dev/null @@ -1,7 +0,0 @@ -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/sbin/mxraid start - -[Install] -WantedBy=local-fs.target From ee1d3fa2c9a956c63bc49f2acf04bea6abb0818a Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 13:41:56 +0200 Subject: [PATCH 27/40] named.service: Remove obsolete dependencies After basic.target, local automount paths should work. Also, we can start without network connectivity. Remove obsolete dependencies. --- misc_systemd_units/named.service | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/misc_systemd_units/named.service b/misc_systemd_units/named.service index 917b4d08..f43ee4c0 100644 --- a/misc_systemd_units/named.service +++ b/misc_systemd_units/named.service @@ -1,7 +1,4 @@ [Unit] -After=network.service mxmount.service automount.service - -Before=mxstartup-mxvip.service ConditionHost=wtf.molgen.mpg.de [Service] @@ -11,5 +8,5 @@ ExecStart=/package/dns/2014-12-03/sbin/named -4 -c /package/dns/2014-12-03/etc/n ExecStopPost=-/sbin/ip addr del 141.14.16.1/20 dev net03 [Install] -WantedBy=network.target +WantedBy=multi-user.target From d8c9acf306921d78c505eeb1023ebf481fd0b8ab Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2023 13:57:56 +0200 Subject: [PATCH 28/40] mxstartup: Wait for network online We might start up a service which requires network connectivity, so wait for it. --- install.sh | 2 ++ misc_systemd_units/mxstartup.service.d/fix-tmp.conf | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 misc_systemd_units/mxstartup.service.d/fix-tmp.conf diff --git a/install.sh b/install.sh index 4db71efe..7f032106 100755 --- a/install.sh +++ b/install.sh @@ -268,6 +268,8 @@ install_data misc_systemd_units/wait-network-online.service \ "$DESTDIR$systemdunitdir/wait-network-online.service" install_data misc_etc_files/modprobe.d/disable-i915.conf "$DESTDIR$sysconfdir/modprobe.d/disable-i915.conf" install_data misc_systemd_units/i915.service "$DESTDIR$systemdunitdir/i915.service" +install_data misc_systemd_units/mxstartup.service.d/fix-tmp.conf \ + "$DESTDIR$systemdunitdir/mxstartup.service.d/fix-tmp.conf" postinstall exit diff --git a/misc_systemd_units/mxstartup.service.d/fix-tmp.conf b/misc_systemd_units/mxstartup.service.d/fix-tmp.conf new file mode 100644 index 00000000..b4db8813 --- /dev/null +++ b/misc_systemd_units/mxstartup.service.d/fix-tmp.conf @@ -0,0 +1,10 @@ +# Can be removed when mxtstartup.service is moved from the mxstartup bee +# package into mxtools and corrected. +# +# Order after network-online, because we don't know about the requirements of +# the services started from mxstartup. Also, sometimes host names are used, +# which required dns + +[Unit] +After=network-online.target +Wants=network-online.target From dc9eeba0fb7bd4010709f951b389a6e315aaa459 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sun, 2 Jul 2023 10:05:38 +0200 Subject: [PATCH 29/40] automount.service: Shut down before network On shutdown, automount tries to unmount all remaining mount points. This might include remote mountpoints. Order after network.target, so that automount gets stopped before network.target. See [1]. [1]: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ --- misc_systemd_units/automount.service | 1 + 1 file changed, 1 insertion(+) diff --git a/misc_systemd_units/automount.service b/misc_systemd_units/automount.service index b5a0aad9..f3516c45 100644 --- a/misc_systemd_units/automount.service +++ b/misc_systemd_units/automount.service @@ -3,6 +3,7 @@ DefaultDependencies=no Requires=sysinit.target After=sysinit.target Before=basic.target +After=network.target [Service] Type=forking From b2ae36b35f96ccc5d76474f48146a905c18ba3f6 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sun, 2 Jul 2023 14:27:24 +0200 Subject: [PATCH 30/40] nfsd.service: Remove redundant depdencies automount.service, which now is before basic.target, ist rather slow to start. nfsd.service doesn't need to wait for it, because we are not going to export automount paths. --- misc_systemd_units/nfsd.service | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/misc_systemd_units/nfsd.service b/misc_systemd_units/nfsd.service index 403382e2..6cfab997 100644 --- a/misc_systemd_units/nfsd.service +++ b/misc_systemd_units/nfsd.service @@ -1,8 +1,10 @@ [Unit] +DefaultDependencies=no ConditionPathExists=/etc/exports -Requires=local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount -After=local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount unbound.service mxmount.service -Wants=unbound.service +Requires=proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount +After=proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount +After=sysinit.target +Conflicts=shutdown.target [Service] ExecStartPre=/bin/mkdir -p /var/lib/nfs/v4recovery From f64e2a9bff4005239471432c205d11b39f8bde03 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sat, 1 Jul 2023 17:31:37 +0200 Subject: [PATCH 31/40] udev-settled.target: Remove obsolete unit This is no longer needed. Services can wait for systemd-udev.settle.service. Services behind sysinit.target already do that. --- install.sh | 1 - misc_systemd_units/udev-settled.target | 16 ---------------- 2 files changed, 17 deletions(-) delete mode 100644 misc_systemd_units/udev-settled.target diff --git a/install.sh b/install.sh index 7f032106..02c77af7 100755 --- a/install.sh +++ b/install.sh @@ -151,7 +151,6 @@ install_exec mxraid/mdcheck.safe "$DESTDIR$usr_bindir/md install_cron mxraid/crond-mdcheck "$DESTDIR$crond_dir/mdcheck" install_exec kvm_monitor/kvm_monitor.pl "$DESTDIR$udev_helperdir/kvm_monitor.pl" install_data kvm_monitor/51-raritan-kvm.rules "$DESTDIR$udev_rulesdir/51-raritan-kvm.rules" -install_data misc_systemd_units/udev-settled.target "$DESTDIR$systemdunitdir/udev-settled.target" install_exec mxmirror/mxmirror "$DESTDIR$usr_sbindir/mxmirror" install_data misc_systemd_units/named.service "$DESTDIR$systemdunitdir/named.service" install_data misc_systemd_units/baucamhttpd.service "$DESTDIR$systemdunitdir/baucamhttpd.service" diff --git a/misc_systemd_units/udev-settled.target b/misc_systemd_units/udev-settled.target deleted file mode 100644 index 05fa0e59..00000000 --- a/misc_systemd_units/udev-settled.target +++ /dev/null @@ -1,16 +0,0 @@ -# Our services assume local devices are available -# Request and wait for systemd-udev-settle.service before basic.target -# -# Order behind network.service, because our network.service currently -# has DefaultDependencies=no. Other services are behind basic.target -# per DefaultDependencies=yes. - -[Unit] -DefaultDependencies=no -Wants=systemd-udev-settle.service -After=systemd-udev-settle.service -Before=basic.target -Before=network.service - -[Install] -WantedBy=basic.target From 24df8b4256e7409cb43d463b07e55ecf10f445b4 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 3 Jul 2023 18:29:11 +0200 Subject: [PATCH 32/40] mxstartup: Import files form source repository Import files from b51f29e5 ("Merge pull request #10 from mariux64/fix-su-option") of github.molgen.mpg.de:mariux64/mxstartup.git into repository. It is just cumbersome to have these n a seperate repository with releases and bee installation. The mxstartup bee package should be deinstalled if this is merged. --- install.sh | 5 + mxstartup/mxservicectl | 150 +++++++++++++++++++ mxstartup/mxstartup.service | 14 ++ mxstartup/mxstartup2mxconfig | 277 +++++++++++++++++++++++++++++++++++ mxstartup/mxstartupctl | 30 ++++ mxstartup/mxvipctl | 217 +++++++++++++++++++++++++++ 6 files changed, 693 insertions(+) create mode 100755 mxstartup/mxservicectl create mode 100644 mxstartup/mxstartup.service create mode 100755 mxstartup/mxstartup2mxconfig create mode 100755 mxstartup/mxstartupctl create mode 100755 mxstartup/mxvipctl diff --git a/install.sh b/install.sh index 02c77af7..aa636876 100755 --- a/install.sh +++ b/install.sh @@ -269,6 +269,11 @@ install_data misc_etc_files/modprobe.d/disable-i915.conf "$DESTDIR$sysconfdir/m install_data misc_systemd_units/i915.service "$DESTDIR$systemdunitdir/i915.service" install_data misc_systemd_units/mxstartup.service.d/fix-tmp.conf \ "$DESTDIR$systemdunitdir/mxstartup.service.d/fix-tmp.conf" +install_exec mxstartup/mxservicectl "$DESTDIR$usr_sbindir/mxservicectl" +install_exec mxstartup/mxstartup2mxconfig "$DESTDIR$usr_sbindir/mxstartup2mxconfig" +install_exec mxstartup/mxstartupctl "$DESTDIR$usr_sbindir/mxstartupctl" +install_exec mxstartup/mxvipctl "$DESTDIR$usr_sbindir/mxvipctl" +install_data mxstartup/mxstartup.service "$DESTDIR$systemdunitdir/mxstartup.service" postinstall exit diff --git a/mxstartup/mxservicectl b/mxstartup/mxservicectl new file mode 100755 index 00000000..1808f652 --- /dev/null +++ b/mxstartup/mxservicectl @@ -0,0 +1,150 @@ +#!/bin/bash + +CMD_IP="/sbin/ip" +CMD_MXS2MXSRV="/usr/sbin/mxstartup2mxconfig" + +RUNDIR="/run/mariux" + +# expands *-pattern in pathnames to null if no matching files are found.. +shopt -s nullglob + +# exit on any error +set -e + +function mxsrv_start_one() { + local cfg=$1 + local -i i mip mfwd + + echo "starting ${cfg} .." + + . ${cfg} + + test "$MX_SRV_USER" = "-" && MX_SRV_USER="root" + + case "${MX_SRV_SCRIPT}" in + *.service) + systemctl start "${MX_SRV_SCRIPT}" || true + ;; + *) + su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} start" & + ;; + esac + + mv ${cfg}{,.r} + + unset -v MX_SRV_USER MX_SRV_SCRIPT +} + +function mxsrv_stop_one() { + local cfg=$1 + local -i i mip mfwd + + echo "stopping ${cfg} .." + + . ${cfg} + + test "$MX_SRV_USER" = "-" && MX_SRV_USER="root" + + case "${MX_SRV_SCRIPT}" in + *.service) + systemctl stop "${MX_SRV_SCRIPT}" || true + ;; + *) + su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} stop" & + ;; + esac + + rm ${cfg} + + unset -v MX_SRV_USER MX_SRV_SCRIPT +} + +function mxsrv_start() { + local cfg + local pattern=$1 + + : ${pattern:=*} + + for cfg in ${RUNDIR}/mxservice.${pattern}.cfg ; do + if [ -e ${cfg}.r ] ; then + echo >&2 "skipping $cfg: already running.." + continue + fi + + if [ ! -r ${cfg} ] ; then + echo >&2 "skipping $cfg: can't read file" + continue + fi + + if [ ! -O ${cfg} ] ; then + echo >&2 "skipping $cfg: possible hack attempt?" + continue + fi + + mxsrv_start_one ${cfg} + + done +} + +function mxsrv_stop() { + local cfg + local pattern=$1 + + : ${pattern:=*} + + for cfg in ${RUNDIR}/mxservice.${pattern}.cfg.r ; do + if [ ! -r ${cfg} ] ; then + echo >&2 "skipping $cfg: can't read file" + continue + fi + + if [ ! -O ${cfg} ] ; then + echo >&2 "skipping $cfg: possible hack attempt?" + continue + fi + + mxsrv_stop_one ${cfg} + + done +} + + +function create_run_dir_if_not_exists() { + if [ ! -d ${RUNDIR} ] ; then + mkdir -m 0700 ${RUNDIR} + fi + + if [ ! -O ${RUNDIR} ] ; then + echo >&2 "${RUNDIR}: wrong owner: possible hack attempt? exiting.." + exit 1 + fi +} + +function create_mxservice() { + ${CMD_MXS2MXSRV} ${RUNDIR} >/dev/null +} + + +############################################################################## + +create_run_dir_if_not_exists + +case "${1}" in + start) + create_mxservice + mxsrv_start $2 + ;; + stop) + mxsrv_stop $2 + ;; + restart) + mxsrv_stop $2 + create_mxservice + mxsrv_start $2 + ;; + *) + echo >&2 "$0 start|stop" + ;; +esac + + diff --git a/mxstartup/mxstartup.service b/mxstartup/mxstartup.service new file mode 100644 index 00000000..b76807d9 --- /dev/null +++ b/mxstartup/mxstartup.service @@ -0,0 +1,14 @@ +[Unit] +Description=Mariux mxstartup classic +After=mxmount.service network.target +Requires=mxmount.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/mxstartupctl start +ExecStop=/usr/sbin/mxstartupctl stop +RemainAfterExit=yes +StandardOutput=syslog + +[Install] +WantedBy=multi-user.target diff --git a/mxstartup/mxstartup2mxconfig b/mxstartup/mxstartup2mxconfig new file mode 100755 index 00000000..b1b20101 --- /dev/null +++ b/mxstartup/mxstartup2mxconfig @@ -0,0 +1,277 @@ +#!/usr/bin/perl + +use Sys::Hostname; +use Data::Dumper; +use Socket; + +######################################## + +my $configfile = "/etc/mxstartups"; +my $rundir = "/run/mariux"; + +######################################## + +my $fullhostname = hostname; +my ($hostname) = $fullhostname =~ /^(.*?)\./; + +my $packed_ip; + +# wait till hostname is resolvable.. +while(!($packed_ip=gethostbyname($fullhostname))) { + sleep 1; +} + +my $hostip = inet_ntoa($packed_ip); + +if(defined $ARGV[0]) { + $rundir = $ARGV[0]; +} + +unless(-d $rundir and -w $rundir) { + print STDERR "can't write to directory $rundir\n"; + exit 1; +} + +@lines = read_file($configfile); + +my ($host, $user, $script, $ip); + +LINE: foreach(@lines) { + unless(($name, $host, $user, $script, $ip) = /^(\S+) (\S+) (\S+) (\S+)\s*(.*?)$/) { + print "format error: '$_'\n"; + next; + } + + my @hosts = split /[;,]/,$host; + + @hosts = expand_hosts(@hosts); + + my $match=undef; + foreach my $host (@hosts) { + if($host eq $hostname or $host eq $fullhostname or $hostname =~ /^$host$/ or $fullhostname =~ /^$host$/) { + $match=$host; + } + } + + next LINE unless(defined $match); + + save_config_mxservice($name, $user, $script); + + my @ips = split /\s*[,; ]\s*/,$ip; + my $pip = parse_ips(@ips); + print_ips_cfg($pip); + +} + + + +sub read_file { + my $file = shift; + open F, "$file" or die "can't open $file: $!\n"; + + my @lines=(); + my $line=""; + my $cont=0; + + while() { + chomp; + next if(/^\s*#/ or /^\s*$/); + + $cont=0; + + s/#.*$//; # remove comments.. + + $_ = $line . $_; + + if(s/\\\s*$//) { + # line continous in next line.. + $cont=1; + } + + $line = $_; + + unless($cont) { + $line =~ s/\s+/ /g; + push @lines, $line; + $line=""; + } + } + return @lines; +} + +sub eth_to_net_if_not_exists { + my $dev = shift; + my $net; + my $num; + + $dev !~ /^eth/ and return $dev; + + -d "/sys/class/net/${dev}" and return $dev; + + ($num) = $dev =~ /^eth(\d+)$/; + $net = sprintf "net%02d", $num; + + -d "/sys/class/net/${net}" and return $net; + + return $dev; +} + +sub parse_ips { + local $_; + + my $H = {}; + my $default_device = 'eth0'; + + foreach(@_) { + my $device = $default_device; + my %ports = (); + my $ip = "-"; + my $_todest = undef; + my $addressprefix; + + if(/\{(\S+)\}(\S+)/) { # extract device "{device}ip[d:t][..]" + $device = $1; + $_=$2; + } + + while((/(\S+)\[(\d+):(\d+)\]/)) { # extract ports + $ports{$3}=$2; + $_=$1; + } + + if($_ =~ /(\S+)\:(\S+)/) { + $_todest = $2; + $_ = $1; + } + + if (/(\S+)\/(\S+)/) { + $_=$1; + $addressprefix=$2; + } else { + $addressprefix=20; + } + + if("$_" eq "-") { + $_ = $fullhostname; + } + + unless (defined $_todest) { + $_todest=$_; + } + + +# printf "ip = $_\n"; +# printf "todest = $_todest\n"; + + if (! ($tmphostname = gethostbyname($_)) ) { + printf STDERR "mxvip::$name *ERROR* Can't resolve '$_'. Skipping.\n"; + next; + } + $ip = inet_ntoa($tmphostname); + + if (! ($tmphostname = gethostbyname($_todest)) ) { + printf STDERR "mxvip::$name *ERROR* Can't resolve '$_'. Skipping.\n"; + next; + } + $_todest = inet_ntoa($tmphostname); + + $device = eth_to_net_if_not_exists($device); + + $H->{$ip} = { device => $device, addressprefix => $addressprefix, ports => {%ports}, todest => $_todest }; + } + + return $H; +} + + + +############################################################################## + +sub save_config_mxservice { + my ($service, $user, $script) = @_; + + my $config = "$rundir/mxservice.$name.cfg"; + + printf "mxservice::$name creating service-config: $config\n"; + + open SCRIPT, ">", "$config" or die "can't open $config: $!"; + print SCRIPT qq(MX_SRV_USER="$user"\n); + print SCRIPT qq(MX_SRV_SCRIPT="$script"\n); + close SCRIPT or die "can't close $script: $!"; +} + +############################################################################## + +sub print_ips_cfg { + my $H = shift; + + my %up = (); + + my $i=0; + my $r=0; + + my $script = "$rundir/mxvip.$name.cfg"; + + printf "mxvip::$name creating start script: $script\n"; + + open SCRIPT, ">", "$script" or die "can't open $script: $!"; + + foreach my $ip (keys %$H) { + if("$ip" ne "$hostip") { + + my $broadcast=join('.',unpack('C*',pack('N',unpack('N',pack('C*',split '\.',$ip)) | (1<<(32-$H->{$ip}->{addressprefix}))-1 ))); + + print SCRIPT qq(# ip $i\n); + print SCRIPT qq(MX_IP_ADDRESS[$i]="$ip"\n); + print SCRIPT qq(MX_IP_ADDRESSPREFIX[$i]="$H->{$ip}->{addressprefix}"\n); + print SCRIPT qq(MX_IP_BROADCAST[$i]="$broadcast"\n); + print SCRIPT qq(MX_IP_DEVICE[$i]="$H->{$ip}->{device}"\n); + $i++; + + $up{$H->{$ip}->{device}}=1; + } + + my $j=$i-1; + foreach my $port (keys %{$H->{$ip}->{ports}}) { + print SCRIPT qq(# forward $i :: $r\n); + print SCRIPT qq(MX_FWD_IP[$r]="$j"\n); + print SCRIPT qq(MX_FWD_SRC_IP[$r]="$ip"\n); + print SCRIPT qq(MX_FWD_SRC_PORT[$r]="$H->{$ip}->{ports}->{$port}"\n); + print SCRIPT qq(MX_FWD_DST_IP[$r]="$H->{$ip}->{todest}"\n); + print SCRIPT qq(MX_FWD_DST_PORT[$r]="$port"\n); + $r++; + } + } + + close SCRIPT or die "can't close $script: $!"; +} + +############################################################################## + +sub hostconfig_list { + my $tag = shift; + $_=`/usr/sbin/hostconfig --list $tag 2>/dev/null`; + return ( split ); +} + + +sub expand_hosts { + my @oh = @_; + my @hosts = (); + + + foreach my $host (@oh) { + if($host =~ /^\@(\S+)/) { + push @hosts, hostconfig_list($1); + } + elsif ($host =~ /^(\/\S+)/) { + next unless(-r $1); + push @hosts, expand_hosts(read_file($1)); + } else { + push @hosts, $host; + } + } + return @hosts; +} + +__DATA__ diff --git a/mxstartup/mxstartupctl b/mxstartup/mxstartupctl new file mode 100755 index 00000000..8dbaf94b --- /dev/null +++ b/mxstartup/mxstartupctl @@ -0,0 +1,30 @@ +#!/bin/bash + +remoteuser=molgen + + +case "${1}" in + start) + while ! id ${remoteuser} >/dev/null 2>&1 ; do + echo >&2 "WARNING: Waiting for NIS (failed to resolve remote user ${remoteuser})" + sleep 1 + done + mxvipctl start $2 + mxservicectl start $2 + ;; + stop) + mxservicectl stop $2 + mxvipctl stop $2 + ;; + restart) + mxservicectl stop $2 + mxvipctl stop $2 + mxvipctl start $2 + mxservicectl start $2 + ;; + *) + echo >&2 "$0 start|stop|restart " + ;; +esac + + diff --git a/mxstartup/mxvipctl b/mxstartup/mxvipctl new file mode 100755 index 00000000..0939c0a6 --- /dev/null +++ b/mxstartup/mxvipctl @@ -0,0 +1,217 @@ +#!/bin/bash + +CMD_IP="/sbin/ip" +CMD_IPTABLES="/usr/sbin/iptables" +CMD_MXS2MXVIP="/usr/sbin/mxstartup2mxconfig" + +RUNDIR="/run/mariux" + +# expands *-pattern in pathnames to null if no matching files are found.. +shopt -s nullglob + +function mxvip_start_one() { + local vip=$1 + local -i i mip mfwd + + echo "starting ${vip} .." + + . ${vip} + + mip=${#MX_IP_ADDRESS[*]} + mfwd=${#MX_FWD_IP[*]} + +# echo "ip addresses found: ${mip}" + + #MX_FWD_DST_IP=([0]="141.14.30.222" [1]="141.14.20.135" [2]="141.14.27.44" [3]="141.14.27.44") + #MX_FWD_DST_PORT=([0]="8080" [1]="9191" [2]="9090" [3]="6789") + #MX_FWD_IP=([0]="-1" [1]="0" [2]="1" [3]="1") + #MX_FWD_SRC_IP=([0]="141.14.30.222" [1]="141.14.20.135" [2]="141.14.27.44" [3]="141.14.27.44") + #MX_FWD_SRC_PORT=([0]="80" [1]="91" [2]="90" [3]="80") + #MX_IP_ADDRESS=([0]="141.14.20.135" [1]="141.14.27.44") + #MX_IP_ADDRESSPREFIX=([0]="20" [1]="20") + #MX_IP_BROADCAST=([0]="141.14.31.255" [1]="141.14.31.255") + #MX_IP_DEVICE=([0]="eth0" [1]="eth0") + + i=0 + while [ ${i} -lt ${mip} ] ; do +# echo " $i -> ${MX_IP_ADDRESS[$i]}" + + echo "adding ip ${MX_IP_ADDRESS[$i]}/${MX_IP_ADDRESSPREFIX[$i]} broadcast ${MX_IP_BROADCAST[$i]} to ${MX_IP_DEVICE[$i]}" + + ${CMD_IP} addr add ${MX_IP_ADDRESS[$i]}/${MX_IP_ADDRESSPREFIX[$i]} broadcast ${MX_IP_BROADCAST[$i]} dev ${MX_IP_DEVICE[$i]} + ${CMD_IP} link set up dev ${MX_IP_DEVICE[$i]} + + i=i+1 + done + +# echo "fwds found: ${mfwd}" + + i=0 + while [ ${i} -lt ${mfwd} ] ; do + echo "adding forward ${MX_FWD_SRC_IP[$i]}:${MX_FWD_SRC_PORT[$i]} <-> ${MX_FWD_DST_IP[$i]}:${MX_FWD_DST_PORT[$i]}" + + ${CMD_IPTABLES} -t nat -A PREROUTING -p tcp -j DNAT -d ${MX_FWD_SRC_IP[$i]} --dport ${MX_FWD_SRC_PORT[$i]} --to-destination ${MX_FWD_DST_IP[$i]}:${MX_FWD_DST_PORT[$i]} + ${CMD_IPTABLES} -t nat -A OUTPUT -p tcp -j DNAT -d ${MX_FWD_SRC_IP[$i]} --dport ${MX_FWD_SRC_PORT[$i]} --to-destination ${MX_FWD_DST_IP[$i]}:${MX_FWD_DST_PORT[$i]} + ${CMD_IPTABLES} -t nat -A POSTROUTING -p tcp -j SNAT --dst ${MX_FWD_DST_IP[$i]} --dport ${MX_FWD_SRC_PORT[$i]} --to-source ${MX_FWD_SRC_IP[$i]} + + i=i+1 + done + + unset ${!MX_IP_*} + unset ${!MX_FWD_*} + + mv ${vip}{,.r} +} + +function mxvip_stop_one() { + local vip=$1 + local -i i mip mfwd + + echo "stopping ${vip} .." + + . ${vip} + + mip=${#MX_IP_ADDRESS[*]} + mfwd=${#MX_FWD_IP[*]} + +# echo "ip addresses found: ${mip}" + + #MX_FWD_DST_IP=([0]="141.14.30.222" [1]="141.14.20.135" [2]="141.14.27.44" [3]="141.14.27.44") + #MX_FWD_DST_PORT=([0]="8080" [1]="9191" [2]="9090" [3]="6789") + #MX_FWD_IP=([0]="-1" [1]="0" [2]="1" [3]="1") + #MX_FWD_SRC_IP=([0]="141.14.30.222" [1]="141.14.20.135" [2]="141.14.27.44" [3]="141.14.27.44") + #MX_FWD_SRC_PORT=([0]="80" [1]="91" [2]="90" [3]="80") + #MX_IP_ADDRESS=([0]="141.14.20.135" [1]="141.14.27.44") + #MX_IP_ADDRESSPREFIX=([0]="20" [1]="20") + #MX_IP_BROADCAST=([0]="141.14.31.255" [1]="141.14.31.255") + #MX_IP_DEVICE=([0]="eth0" [1]="eth0") + +# echo "fwds found: ${mfwd}" + + i=0 + while [ ${i} -lt ${mfwd} ] ; do + echo "removing forward ${MX_FWD_SRC_IP[$i]}:${MX_FWD_SRC_PORT[$i]} <-> ${MX_FWD_DST_IP[$i]}:${MX_FWD_DST_PORT[$i]}" + + ${CMD_IPTABLES} -t nat -D PREROUTING -p tcp -j DNAT -d ${MX_FWD_SRC_IP[$i]} --dport ${MX_FWD_SRC_PORT[$i]} --to-destination ${MX_FWD_DST_IP[$i]}:${MX_FWD_DST_PORT[$i]} + ${CMD_IPTABLES} -t nat -D OUTPUT -p tcp -j DNAT -d ${MX_FWD_SRC_IP[$i]} --dport ${MX_FWD_SRC_PORT[$i]} --to-destination ${MX_FWD_DST_IP[$i]}:${MX_FWD_DST_PORT[$i]} + ${CMD_IPTABLES} -t nat -D POSTROUTING -p tcp -j SNAT --dst ${MX_FWD_DST_IP[$i]} --dport ${MX_FWD_SRC_PORT[$i]} --to-source ${MX_FWD_SRC_IP[$i]} + + i=i+1 + done + + i=0 + while [ ${i} -lt ${mip} ] ; do +# echo " $i -> ${MX_IP_ADDRESS[$i]}" + + dev=${MX_IP_DEVICE[$i]} + + if [ ! -d "/sys/class/net/${dev}" -a "${dev:0:3}" = "eth" ] ; then + net=$(printf "net%02d" "${dev:3}") + if [ -d "/sys/class/net/${net}" ] ; then + MX_IP_DEVICE[$i]=$net + fi + fi + + echo "removing ip ${MX_IP_ADDRESS[$i]}/${MX_IP_ADDRESSPREFIX[$i]} broadcast ${MX_IP_BROADCAST[$i]} to ${MX_IP_DEVICE[$i]}" + + ${CMD_IP} addr del ${MX_IP_ADDRESS[$i]}/${MX_IP_ADDRESSPREFIX[$i]} broadcast ${MX_IP_BROADCAST[$i]} dev ${MX_IP_DEVICE[$i]} +# echo "${CMD_IP} link set up dev ${MX_IP_DEVICE[$i]}" + + i=i+1 + done + + unset ${!MX_IP_*} + unset ${!MX_FWD_*} + + rm ${vip} +} + +function mxvip_start() { + local vip + local pattern=$1 + + : ${pattern:=*} + + for vip in ${RUNDIR}/mxvip.${pattern}.cfg ; do + if [ -e ${vip}.r ] ; then + echo >&2 "skipping $vip: already running.." + continue + fi + + if [ ! -r ${vip} ] ; then + echo >&2 "skipping $vip: can't read file" + continue + fi + + if [ ! -O ${vip} ] ; then + echo >&2 "skipping $vip: possible hack attempt?" + continue + fi + + mxvip_start_one ${vip} + + done +} + +function mxvip_stop() { + local vip + local pattern=$1 + + : ${pattern:=*} + + for vip in ${RUNDIR}/mxvip.${pattern}.cfg.r ; do + if [ ! -r ${vip} ] ; then + echo >&2 "skipping $vip: can't read file" + continue + fi + + if [ ! -O ${vip} ] ; then + echo >&2 "skipping $vip: possible hack attempt?" + continue + fi + + mxvip_stop_one ${vip} + + done +} + + +function create_run_dir_if_not_exists() { + if [ ! -d ${RUNDIR} ] ; then + mkdir -m 0700 ${RUNDIR} + fi + + if [ ! -O ${RUNDIR} ] ; then + echo >&2 "${RUNDIR}: wrong owner: possible hack attempt? exiting.." + exit 1 + fi +} + +function create_mxvip() { + ${CMD_MXS2MXVIP} ${RUNDIR} >/dev/null +} + + +############################################################################## + +create_run_dir_if_not_exists + +case "${1}" in + start) + create_mxvip + mxvip_start $2 + ;; + stop) + mxvip_stop $2 + ;; + restart) + mxvip_stop $2 + create_mxvip + mxvip_start $2 + ;; + *) + echo >&2 "$0 start|stop" + ;; +esac + + From 852e22a97a6a0ba8fb4a0077795b9cdaf498acb9 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 3 Jul 2023 18:38:47 +0200 Subject: [PATCH 33/40] Revert "mxstartup: Wait for network online" This reverts commit 7d5d66cf7db1151c23e0c749b6d47cb3f252c161. --- install.sh | 2 -- misc_systemd_units/mxstartup.service.d/fix-tmp.conf | 10 ---------- 2 files changed, 12 deletions(-) delete mode 100644 misc_systemd_units/mxstartup.service.d/fix-tmp.conf diff --git a/install.sh b/install.sh index aa636876..c9a25160 100755 --- a/install.sh +++ b/install.sh @@ -267,8 +267,6 @@ install_data misc_systemd_units/wait-network-online.service \ "$DESTDIR$systemdunitdir/wait-network-online.service" install_data misc_etc_files/modprobe.d/disable-i915.conf "$DESTDIR$sysconfdir/modprobe.d/disable-i915.conf" install_data misc_systemd_units/i915.service "$DESTDIR$systemdunitdir/i915.service" -install_data misc_systemd_units/mxstartup.service.d/fix-tmp.conf \ - "$DESTDIR$systemdunitdir/mxstartup.service.d/fix-tmp.conf" install_exec mxstartup/mxservicectl "$DESTDIR$usr_sbindir/mxservicectl" install_exec mxstartup/mxstartup2mxconfig "$DESTDIR$usr_sbindir/mxstartup2mxconfig" install_exec mxstartup/mxstartupctl "$DESTDIR$usr_sbindir/mxstartupctl" diff --git a/misc_systemd_units/mxstartup.service.d/fix-tmp.conf b/misc_systemd_units/mxstartup.service.d/fix-tmp.conf deleted file mode 100644 index b4db8813..00000000 --- a/misc_systemd_units/mxstartup.service.d/fix-tmp.conf +++ /dev/null @@ -1,10 +0,0 @@ -# Can be removed when mxtstartup.service is moved from the mxstartup bee -# package into mxtools and corrected. -# -# Order after network-online, because we don't know about the requirements of -# the services started from mxstartup. Also, sometimes host names are used, -# which required dns - -[Unit] -After=network-online.target -Wants=network-online.target From 231e6a1e462d3839110030442d44be58f150f01a Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 3 Jul 2023 18:39:56 +0200 Subject: [PATCH 34/40] mxstartup.service: Fix dependencies Only wait for network online, because /etc/,xstartups uses hostnames which need to be resolved and services started by it might fail when they don't have network. Remove other dependencies are already resolved by DefaultDependencies. Also remove Desription for easier debugging. --- mxstartup/mxstartup.service | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mxstartup/mxstartup.service b/mxstartup/mxstartup.service index b76807d9..0376fe25 100644 --- a/mxstartup/mxstartup.service +++ b/mxstartup/mxstartup.service @@ -1,7 +1,6 @@ [Unit] -Description=Mariux mxstartup classic -After=mxmount.service network.target -Requires=mxmount.service +After=network-online.target +Wants=network-online.target [Service] Type=oneshot From b093447a0752b217b648219348d34e8b6f21e3f0 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 3 Jul 2023 18:42:39 +0200 Subject: [PATCH 35/40] mxstartup2mxconfig: Use system perl Using the default perl triggers an unwanted automounter call during startup. --- mxstartup/mxstartup2mxconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mxstartup/mxstartup2mxconfig b/mxstartup/mxstartup2mxconfig index b1b20101..e61749ef 100755 --- a/mxstartup/mxstartup2mxconfig +++ b/mxstartup/mxstartup2mxconfig @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#! /usr/local/system/perl/bin/perl use Sys::Hostname; use Data::Dumper; From 2b9fb60e38f62a4b183cc02bcb608591fdbabeac Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Jul 2023 14:32:33 +0200 Subject: [PATCH 36/40] automount.service: Do not rebuild automount maps on boot Avoid the time consuming step to regenerate automount maps from the amd maps. It dowsn't make much sense, because the amd maps should be as good as the amd maps. --- misc_systemd_units/automount.service | 1 - 1 file changed, 1 deletion(-) diff --git a/misc_systemd_units/automount.service b/misc_systemd_units/automount.service index f3516c45..de33886c 100644 --- a/misc_systemd_units/automount.service +++ b/misc_systemd_units/automount.service @@ -7,7 +7,6 @@ After=network.target [Service] Type=forking -ExecStartPre=/usr/sbin/make-automaps ExecStart=/usr/sbin/automount -v PIDFile=/run/autofs-running ExecReload=/bin/kill -HUP $MAINPID From 23f1e701519d9e27b1e42b0e6e35cb38b87a8750 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Jul 2023 15:04:40 +0200 Subject: [PATCH 37/40] lightdm.service: Import into mxtools Import lightdm.service from bee packge ligthdm-1.30.0-3.x86_64 into this repository. --- install.sh | 1 + misc_systemd_units/lightdm.service | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 misc_systemd_units/lightdm.service diff --git a/install.sh b/install.sh index c9a25160..650a91dd 100755 --- a/install.sh +++ b/install.sh @@ -272,6 +272,7 @@ install_exec mxstartup/mxstartup2mxconfig "$DESTDIR$usr_sbindir/ install_exec mxstartup/mxstartupctl "$DESTDIR$usr_sbindir/mxstartupctl" install_exec mxstartup/mxvipctl "$DESTDIR$usr_sbindir/mxvipctl" install_data mxstartup/mxstartup.service "$DESTDIR$systemdunitdir/mxstartup.service" +install_data misc_systemd_units/lightdm.service "$DESTDIR$systemdunitdir/lightdm.service" postinstall exit diff --git a/misc_systemd_units/lightdm.service b/misc_systemd_units/lightdm.service new file mode 100644 index 00000000..05d7f03d --- /dev/null +++ b/misc_systemd_units/lightdm.service @@ -0,0 +1,14 @@ +[Unit] +Description=LightDM +Wants=nvidia.service startup-tags.service +After=systemd-user-sessions.service nvidia.service startup-tags.service +ConditionPathExists=/node/tags/lightdm + +[Service] +ExecStart=/usr/bin/lightdm +Restart=always +BusName=org.freedesktop.DisplayManager +UMask=007 + +[Install] +WantedBy=graphical.target From 40b27820a622db0b0b92f365850f992f34d1a176 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Jul 2023 15:36:01 +0200 Subject: [PATCH 38/40] lightdm.service: Add alias display-manager.service --- misc_systemd_units/lightdm.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc_systemd_units/lightdm.service b/misc_systemd_units/lightdm.service index 05d7f03d..76d97e4d 100644 --- a/misc_systemd_units/lightdm.service +++ b/misc_systemd_units/lightdm.service @@ -11,4 +11,4 @@ BusName=org.freedesktop.DisplayManager UMask=007 [Install] -WantedBy=graphical.target +Alias=display-manager.service From aaa68a33f99cf2fca51bf0173fa629d3dc44793e Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Jul 2023 15:37:27 +0200 Subject: [PATCH 39/40] nvidia.service: Order before display-manager Use alias for the order. This also removes the reference to the non-existing gdm.service. --- nvidiactl/nvidia.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvidiactl/nvidia.service b/nvidiactl/nvidia.service index 6bf81da0..25ce4a98 100644 --- a/nvidiactl/nvidia.service +++ b/nvidiactl/nvidia.service @@ -1,5 +1,5 @@ [Unit] -Before=gdm.service +Before=display-manager.service After=getty-pre.target [Service] From f1476fab209eced536a630d6fcfc4055a42424a7 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Jul 2023 15:09:59 +0200 Subject: [PATCH 40/40] lightdm.service: Remove obsolete references Remove startup-tags condition, because we only have lightdm now. Remove dependencies on startup-tags.service as well, which would not be needed even if we used the tags. Also, remove After= dependency to nvidia.service, because this is now handled by nvidia.service with a Before=display-manager.service dependency. --- misc_systemd_units/lightdm.service | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/misc_systemd_units/lightdm.service b/misc_systemd_units/lightdm.service index 76d97e4d..aabd4427 100644 --- a/misc_systemd_units/lightdm.service +++ b/misc_systemd_units/lightdm.service @@ -1,8 +1,5 @@ [Unit] -Description=LightDM -Wants=nvidia.service startup-tags.service -After=systemd-user-sessions.service nvidia.service startup-tags.service -ConditionPathExists=/node/tags/lightdm +After=systemd-user-sessions.service [Service] ExecStart=/usr/bin/lightdm