DietPi systemd order | Resolve some systemd unit order quirks#2357
DietPi systemd order | Resolve some systemd unit order quirks#2357
Conversation
+ DietPi-FS_partition_resize | Run unit before local-fs and swap targets reached, but after local-fs-pre.target to have all initial R/O root mounts and remounts done + DietPi-FS_partition_resize | Pull in local-fs-pre.target, which is special static systemd target, that is only reached, if actively pulled in. On fresh DietPi it it reached already, but we need to be failsafe
+ DietPi-RAMdisk | Simplify: "After=local-fs.target" is added via default dependencies, and all mounts have to finish to reach this target; "StandardOutput=tty" does not make sense, if we forward everything to log file + DietPi-RAMdisk | Fix "dietpi-ramdisk.log" being overwritten on boot, rendering shutdown log useless. For now stay with adding logs to final log location directly.
+ DietPi-RAMlog | Simplify: "After=local-fs.target" is added via default dependencies, and all mounts have to finish to reach this target; "StandardOutput=tty" does not make sense, if we forward everything to log file + DietPi-RAMlog | Fix "dietpi-ramlog.log" being overwritten on boot, rendering shutdown log useless. For now stay with adding logs to final log location directly.
+ DietPi-Boot | Log STDERR to log file as well + DietPi-Boot | Run "Before=getty", and with this on idle (can happen early by chance) login prompts + DietPi-Boot | Do not run "After=network-online.target", since this can delay boot much and DietPi-Boot has it's own optional (dietpi.txt) network wait mechanism. Furthermore "network-online.target" is not pulled in by default, but an "active" unit, thus consumer services need/should pull it via Wants=. "apt-daily.service" e.g. does this, but we mask this one.
+ DietPi-PostBoot | Remove "Before=rc[.-]local.service", since those are meant to run before login prompt (Before=getty.target). rc-local is enabled, login prompt will run after postboot, thus over-prompt our banner. + DietPi-PostBoot | Oder "After=multi-user.target", which is the last actual login prompt target and assures, that out banner is shown after login prompt TTY clearing. + DietPi-PostBoot | Avoid /bin/bash sub shell call, which is not required, since we do no stream redirection here
+ DietPi-Kill_SSH | Avoid running in sub shell /bin/bash call. Not required, since we do not redirect streams + DietPi-Kill_SSH | "Before/After=network.target" has no order effect for this service, which is called only on shutdown, since this target is not "reached" on shutdown. "shutdown.target" is the very last target reached on shutdown, so too late anyway. Best results (earliest execution) during my tests was without declaring any ordering.
|
🈯️ Killing SSH now done nearly as first step on shutdown/reboot, although not sure why it was later with Before/After, which otherwise had no effect, at least not the desired one. 🈴 Jessie: Ordering cycle with networking.service (re)appeared:
|
|
🈯️ Resolved deps cycle on Jessie:
|
|
@Fourdee Reading:
File system and "primary partition" information are not preserved. Furthermore obsolete 🈯️ Rechecked on Stretch, no issue there. Fresh Debian Jessie situation:
|
|
Since it is unrelated, moved all the disk/resize issues to: https://github.com/Fourdee/DietPi/issues/2358 Will do final tests for boot order on Buster as well, then merge. |
|
🈴 Not sure if this was the case before, but on RPi, the boot mount was due to I first though it was due to removed So simple solution:
|
|
Will merge, passt local testing on VM (all distros) and RPi (Buster, /boot mount) |
+ DietPi-Patch | Adjust "rc-local.service" to match current order and style and remove DietPi from requirements: https://github.com/Fourdee/DietPi/pull/2357







Status: Ready
Testing:
Reference: https://github.com/Fourdee/DietPi/issues/2356
Commit list/description:
fdiskfails because of this.teeto log file is not possible of course,tee >(systemd-cat -t DietPi-FS_partition_resize -p 5)would have been possible instead to write log tojournald/journalctl, which can then be found viasystemctl -t DietPi-FS_partition_resizeafterwards.cmd <<< 'string'(here string) respectivelycmd << _EOF_ ... _EOF_(here document) actually temporarily create a file based on string on mounted drive, which then fails as well. Not sure, if this file is created within/tmp(not yettmpfsat this early boot state) or current working dir.echo 'string' | cmd) creates the string file in-kernel, so that this is possible without RootFS R/W, but much slower, not only because ofecho, but also because piping creates a sub shell, which takes much time in bash.getty-pre.targetexists on Buster, but not yet on Stretch, which assures thatBefore=getty-pre.targetruns before allgetty@.serviceinstances are started. For now we stay with getty.target (reached AFTER all getty instances started) and getty@ttyq1.