Skip to content

Commit

Permalink
basic.target: Pull network
Browse files Browse the repository at this point in the history
Currently, the network is started more or less by chance, because a few
services have dependencies on network.target, which in fact is even
wrong.

Following the systemd.special(7) and bootup(7) logic, network.target
should be a passive unit and no units should have a Wants or Requires
dependencies on it.

A unit which really wants or requires network connectivity should depend
on network-online.target, on the other hand, typicall service units
really don't need network connectivity.

However, Mariux64 is kind of special in some ways:

- We have services started on dedicated IP addresses and vlan
  interfaces. For the bind to work, the vlan interfaces have to exist
  and also the ip addreses must be configured, unless the service uses
  the IP_FREEBIND socket option or we globally enable ip_nonlocal_bind.

- We have a global filesystem namespace using automounted remote
  filesystems. Services, cron-jobs and user sessions might all require
  the network to be available to access the files which happen to be on
  a remote systems.

So in fact we shouldn't start normal user processses via mxstartup or
cron or login sessions before we tried our best to provide network
connectivity.

So for Mariux64, which havenly depends on the network, make the attempt
to start the network part of the basic os service, available with
basic-target.

After this change, all normal services can assume, that the ip
interfaces are available, the ip addresses have been configured (if not
done by mxstartup), we've waited a reasonable time for the link to come
up, the default route has been set, automount-paths are available, name
resolution works and important services like the default nameserver or
mxshadow are available. At least in the realm of the local systems
responsibility, of course, things will still fail if the network or the
peer server have issues.
  • Loading branch information
donald committed Jun 20, 2023
1 parent 51d25a0 commit f7fa5cc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ 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_etc_files/systemd/system/basic.target.d/want-network.conf \
"$DESTDIR$sysconfdir/systemd/system/basic.target.d/want-network.conf"

postinstall
exit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Unit]

Wants=network.target
After=network-online.target
2 changes: 2 additions & 0 deletions misc_systemd_units/ip6.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[Unit]

DefaultDependencies=no

Wants=startup-tags.service
After=startup-tags.service
ConditionPathExists=/node/tags/ip6
Expand Down
2 changes: 2 additions & 0 deletions misc_systemd_units/mxvlan.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[Unit]

DefaultDependencies=no

Wants=network.service
After=network.service
Before=network.target
Expand Down

0 comments on commit f7fa5cc

Please sign in to comment.