File tree Expand file tree Collapse file tree 5 files changed +80
-0
lines changed Expand file tree Collapse file tree 5 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description =Check if systemd-networkd has broken NDisc routes and fix
3+ # Remove Requisite to prevent being killed when restarting networkd
4+ Requisite =systemd-networkd.service
5+ After =systemd-networkd.service
6+
7+ [Service]
8+ Type =oneshot
9+ # This needs to be root for the service restart to work
10+ User =root
11+ Group =root
12+ ExecStart =/usr/local/bin/systemd-networkd-check-and-fix.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Check for occurrences of an NDisc log error
4+ # NOTE: --since timer flag must match the cadence of systemd timer unit. Risk of repeat matches and restart loop
5+ journalctl --no-pager --unit systemd-networkd --since " 1 minutes ago" --grep " Could not set NDisc route" > /dev/null
6+ NDISC_ERROR=$?
7+
8+ if systemctl is-active --quiet systemd-networkd.service && [ " ${NDISC_ERROR} " == 0 ]; then
9+ echo " $( date) systemd-network running but NDisc routes are broken. Restarting systemd.networkd.service"
10+ /usr/bin/systemctl restart systemd-networkd.service
11+ exit # no need to check further
12+ fi
13+
14+ # check for routes
15+ ROUTES=$( ip -6 route list)
16+
17+ if ! echo " ${ROUTES} " | grep default > /dev/null || ! echo " ${ROUTES} " | grep " ::1 dev lo" > /dev/null; then
18+ echo " IPv6 routing table messed up. Restarting systemd.networkd.service"
19+ /usr/bin/systemctl restart systemd-networkd.service
20+ fi
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description=Check if systemd-networkd has broken NDisc routes and fix
3+
4+ [Timer]
5+ # NOTE: cadence must match that of the journalctl search (--since). Risk of repeat matches and restart loop
6+ OnCalendar=minutely
7+
8+ [Install]
9+ WantedBy=timers.target
Original file line number Diff line number Diff line change 7878 - install-supabase-internal
7979 when : debpkg_mode or nixpkg_mode
8080
81+ - name : Fix IPv6 NDisc issues (disabled)
82+ import_tasks : tasks/fix_ipv6_ndisc.yml
83+ tags :
84+ - install-supabase-internal
85+ when : (debpkg_mode or nixpkg_mode) and (qemu_mode is undefined)
86+
8187 - name : Start Postgres Database without Systemd
8288 become : yes
8389 become_user : postgres
Original file line number Diff line number Diff line change 1+ ---
2+ - name : fix Network - systemd timer file
3+ copy :
4+ dest : /etc/systemd/system/systemd-networkd-check-and-fix.timer
5+ src : " files/systemd-networkd/systemd-networkd-check-and-fix.timer"
6+ owner : root
7+ group : root
8+ mode : 0644
9+
10+ - name : fix Network - systemd service file
11+ copy :
12+ dest : /etc/systemd/system/systemd-networkd-check-and-fix.service
13+ src : " files/systemd-networkd/systemd-networkd-check-and-fix.service"
14+ owner : root
15+ group : root
16+ mode : 0644
17+
18+ - name : fix Network - detect script
19+ copy :
20+ dest : /usr/local/bin/systemd-networkd-check-and-fix.sh
21+ src : " files/systemd-networkd/systemd-networkd-check-and-fix.sh"
22+ owner : root
23+ group : root
24+ mode : 0700
25+
26+ - name : fix Network - reload systemd
27+ systemd :
28+ daemon_reload : false
29+
30+ - name : fix Network - ensure systemd timer is installed but disabled
31+ systemd :
32+ name : systemd-networkd-check-and-fix.timer
33+ enabled : false
You can’t perform that action at this time.
0 commit comments