Skip to content

Clean up startup #328

Merged
merged 40 commits into from
Jul 4, 2023
Merged

Clean up startup #328

merged 40 commits into from
Jul 4, 2023

Conversation

donald
Copy link
Collaborator

@donald donald commented Jun 19, 2023

Comb through startup logic

Copy link
Contributor

@pmenzel pmenzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Some nits.

  1. Maybe mention that startup-tags depends on sysinit.target in the second commit, so it’s clear why the dependency are removed without knowing the other commit.
  2. s/ourelf/ourself/
  3. Cleanup → Clean up in the merge/pull request title.

@donald donald changed the title Cleanup startup tags Clean up startup tags Jun 19, 2023
@donald donald force-pushed the cleanup-startup-tags branch 4 times, most recently from f3928ad to 1a7994e Compare June 20, 2023 11:39
@donald donald changed the title Clean up startup tags Clean up startup Jun 20, 2023
@donald
Copy link
Collaborator Author

donald commented Jun 20, 2023

Install:

# From mariux64/bee-files#2923:
bee remove mxstartup-2.19-0.x86_64
bee update lightdm-1.30.0-3.x86_64

make install
rm /etc/systemd/system/klog.service
rm  /etc/systemd/system/xaruba.service
systemctl reenable mxrouter
systemctl reenable startup-tags
systemctl reenable automount
systemctl reenable getty-checktrust
systemctl reenable wait-network-online
systemctl reenable network
systemctl reenable mxvlan
systemctl reenable unbound
systemctl enable i915
systemctl reenable named
systemctl disable mxraid.startup.service
rm /etc/systemd/system/mxraid.startup.service
systemctl enable mxraid.service
systemctl disable fix-lpp
rm /etc/systemd/system/fix-lpp.service
systemctl disable fix-uring
rm /etc/systemd/system/fix-uring.service
systemctl disable udev-settled.target
rm /etc/systemd/system/udev-settled.target

@donald
Copy link
Collaborator Author

donald commented Jun 20, 2023

mariux64/bee-files#2921

@donald donald force-pushed the cleanup-startup-tags branch 3 times, most recently from cb882c2 to 976a745 Compare June 30, 2023 13:22
@donald
Copy link
Collaborator Author

donald commented Jun 30, 2023

Because of the changes to to mxraid/mxmount, we should test startup and shutdown on server with raid.
Because of the changes to named.service, we should test on a wtf-clone
Because of the changes to mxrouter, we should test changes on nsa/bka.

@donald
Copy link
Collaborator Author

donald commented Jul 1, 2023

I think we are good to go. Any comments anyone?

@pmenzel
Copy link
Contributor

pmenzel commented Jul 2, 2023

Awesome (and tedious) work. Very nice. If you could update the merge/pull request description, that’d be great. Also, what you found out about the i915 and Nvidia (even nouveau?) console issue, would be nice to know.

Maybe also share the new systemd-analyze (critical-chain or plot) outputs would be good. You also told me something about the reasons for our network device to come up (spanning tree and avoiding loops?).

@donald
Copy link
Collaborator Author

donald commented Jul 2, 2023

Will poke around a little more :-)

@donald
Copy link
Collaborator Author

donald commented Jul 3, 2023

Import mxstartup?

@donald
Copy link
Collaborator Author

donald commented Jul 3, 2023

btw: automount startup ist slow because of the map translation amd->automount in ExecStartPre=/usr/sbin/make-automaps:

buczek@dose:~/git/mxtools (cleanup-startup-tags)$ sudo time /usr/sbin/make-automaps
Password (for buczek) : 
2.26user 0.36system 0:02.61elapsed 100%CPU (0avgtext+0avgdata 7412maxresident)k
0inputs+280outputs (0major+61333minor)pagefaults 0swaps

Maybe we can just skip the step. The /etc/automount/should be as good as the /etc/amd/* maps.

donald added a commit to mariux64/bee-files that referenced this pull request Jul 4, 2023
PR mariux64/mxtools#328 imports mxstartup into the mxtools repository. Remove
bee-based installation.
donald added 27 commits July 4, 2023 15:36
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.
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.
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.
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
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.
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/
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.
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.
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.
After basic.target, local automount paths should work. Also, we can
start without network connectivity. Remove obsolete dependencies.
We might start up a service which requires network connectivity, so wait
for it.
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/
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.
This is no longer needed. Services can wait for
systemd-udev.settle.service. Services behind sysinit.target already do
that.
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.
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.
Using the default perl triggers an unwanted automounter call during
startup.
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.
Import lightdm.service from bee packge ligthdm-1.30.0-3.x86_64 into this
repository.
Use alias for the order. This also removes the reference to the
non-existing gdm.service.
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.
@donald donald merged commit e8df106 into master Jul 4, 2023
@donald donald mentioned this pull request Jul 5, 2023
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants