View previous topic :: View next topic |
Author |
Message |
sitquietly Apprentice
Joined: 23 Oct 2010 Posts: 150 Location: On the Wolf River, Tennessee
|
Posted: Mon Aug 09, 2021 8:30 pm Post subject: systemd considered harmful -- return to Gentoo |
|
|
I had decided to ignore my own best judgment and run systemd linux on a couple of systems where linux and freebsd both import the same 8TB data pool. The pool mounts datasets for users directly into their home directories. This has proved very handy and has much better behavior than the alternative of symlinks into the pool (especially since I make heavy use of stow for putting dotfiles into place).
Didn't work and I should have seen it coming. Feel stupid. Well, actually systemd is stupid -- mounting filesystems onto mount points is not deterministic! There is always a race condition in systemd which is only avoided by "workarounds". This became hotly evident to me when my zfs mounts were sometimes there and sometimes NOT.
The systemd folk will kindly tell you that you are responsible for avoiding race failures by using workarounds such as zfs mount-generator or (maybe) zfs legacy mounts instead of standard, easy zfs mounts.
Or just don't use zfs -- it doesn't play well with systemd-linux.
My foray into systemd-linux was quickly terminated and I returned to OpenRC Gentoo. I love deterministic startup.
Deterministic System: a deterministic system is a system in which no randomness is involved in the development of future states of the system. A deterministic model will thus always produce the same output from a given starting condition or initial state. e.g. systemd is non-deterministic and is considered harmful. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3688 Location: Rasi, Finland
|
Posted: Mon Aug 09, 2021 9:16 pm Post subject: |
|
|
For some special mounts to work properly with systemd I needed to create (/modify) the .mount unit files. It's a pita.
I still use systemd on one laptop. I keep it as a testing ground to watch the progress (? degress/congress :P) of systemd.
Still many kinks so be solved.
(Moved topic to Gentoo Chat.) _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22624
|
Posted: Tue Aug 10, 2021 1:24 am Post subject: |
|
|
I understand the OP was primarily intended as a rant, but I am curious as to what went wrong. What exactly was done that systemd behaved non-deterministically? In what way were the mounts non-deterministic? If you are not stacking one mount below another, the precise order in which filesystems mount should not matter. If you are stacking one below another, then you need to enforce an ordering. Although openrc does not, as far as I know, use mount --fork, the functionality for non-deterministic mounts is provided in mount itself, so non-systemd users can still potentially get in trouble with dependent mounts.
Where does systemd acknowledge the problem that led to OP and blame the user for holding it wrong? |
|
Back to top |
|
|
sitquietly Apprentice
Joined: 23 Oct 2010 Posts: 150 Location: On the Wolf River, Tennessee
|
Posted: Tue Aug 10, 2021 4:56 am Post subject: |
|
|
Hu wrote: | I understand the OP was primarily intended as a rant, but I am curious ... |
It was not intended as rant; it's not a rant. It is a warning. Maybe a few others can benefit by being forewarned that systemd is based on a clever idea that we can bring up a system not by careful transition from one well-defined state to the next but by -- well let Lennart explain:
"A central characteristic of systemd is its socket activation, which allows it to start background services in parallel without explicitly specifying any dependencies as soon as the basic system is set up and the local filesystems have been mounted. The clever aspect is that systemd itself creates the sockets that are used as communication pathways for the services that are to be launched, and then hands the sockets over to the services while launching.
The Syslog and D-Bus services are good examples to illustrate this concept. When it is started, D-Bus connects to the /dev/log socket and uses it to communicate with the log daemon so that this daemon can write status and error messages to the system log if required. Therefore, SysV-init distributions only launch D-Bus once the Syslog service is fully functional.
Systemd, on the other hand, creates /dev/log itself and then launches Syslog and D-Bus at the same time..." [http://www.h-online.com/open/features/Control-Centre-The-systemd-Linux-init-system-1565543.html]
This clever idea requires an elaborate declarative language to define the "workarounds" to make it work despite being essentially one big race condition. The mount failures that ensue under different conditions are well-known and some of the reports (not rants, user-reports) can be found by googling "systemd mounts are non-deterministic" or something similar to that... |
|
Back to top |
|
|
ulenrich Veteran
Joined: 10 Oct 2010 Posts: 1483
|
Posted: Tue Aug 10, 2021 9:10 am Post subject: |
|
|
sitquietly says: My alternative system hides all race conditions behind a big wall of artificial tardiness. |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6065 Location: Removed by Neddy
|
Posted: Tue Aug 10, 2021 9:32 am Post subject: |
|
|
Event driven startup is always better then time-triggered startup with regards to efficient use of time and validating a precursor exists.
This however is dependent on the event-generator generating its event at at point in time which corresponds to when it itself is in a valid state and the event supervisor acknowledging what is an event as the event to indicate completion/readyness. If the event is generated early in its logic OR what is being monitored as an event is synonymous with other startup activities, well you will have a false indication of availability and all the corresponding race conditions that comes with it.
If accessing a socket is required for a process to complete but accessing a socket is used by some supervisor to indicate completion then the flaw is with the supervisor and the method used to determine availability. If the process accesses a socket prematurely but does not require aspects of that connection to complete then the flaw is with the process for signaling too early
Someone made a mistake, either architecturally or in implementation
[Moderator edit: rephrased last line based on a user complaint. -Hu] _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54577 Location: 56N 3W
|
Posted: Tue Aug 10, 2021 10:30 am Post subject: |
|
|
Naib.
... or both.
sitquietly,
As soon as you trigger things with events, like interrupts, your system is no longer deterministic. However it can still be robust without being deterministic.
I'm sure Naib will have something to say about that assertion :) _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6065 Location: Removed by Neddy
|
Posted: Tue Aug 10, 2021 10:54 am Post subject: |
|
|
Just a bit
But I think this is an ontology concern here. How we use the term "deterministic" might not be as concise as the OP or others. 100% an event driven architecture cannot be considered deterministic if that which triggers the event is itself non-deterministic
BuT I KnOw HpTtpD wIlL sTaRt AfTeR dHcP lEaSiNg
That's not deterministic that's just a clearly defined sequence based upon events and as long as the producer and consumer act on the correct stimulus it can be robust _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
sitquietly Apprentice
Joined: 23 Oct 2010 Posts: 150 Location: On the Wolf River, Tennessee
|
Posted: Tue Aug 10, 2021 1:39 pm Post subject: |
|
|
NeddySeagoon wrote: | it can still be robust without being deterministic. |
How true, and I thought systemd might have achieved more robustness ... but then I thought I had my donkey almost completely trained to live without food when he up and died on me!
Great responses. I appreciate everyone responding and I hope that no one misses that I was writing largely to express thanks for OpenRC Gentoo.
Solution found: OpenRC. Thanks! |
|
Back to top |
|
|
mrbassie l33t
Joined: 31 May 2013 Posts: 821 Location: Go past the sign for cope, right at the sign for seethe. If you see the target you've missed it.
|
Posted: Tue Aug 10, 2021 3:47 pm Post subject: Re: systemd considered harmful -- return to Gentoo |
|
|
sitquietly wrote: |
The systemd folk will kindly tell you that you are responsible for avoiding race failures by using definately-not-workarounds but features such as zfs mount-generator or (maybe) zfs legacy mounts instead of standard, easy zfs mounts. |
FTFY.
j/k. |
|
Back to top |
|
|
guitou Guru
Joined: 02 Oct 2003 Posts: 534 Location: France
|
Posted: Tue Aug 10, 2021 5:56 pm Post subject: |
|
|
Hi.
Don't know especially about zfs, but if using fstab, you may enforce systemd mount ordering using specific mount options: x-systemd-{before,after}.
Not as straightforward as just relying on mount point definitions order, but it does the job.
++
Gi) |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2052 Location: United Kingdom
|
Posted: Tue Aug 10, 2021 11:16 pm Post subject: |
|
|
Have not tried it myself, but Mount filesystem in certain order using /etc/fstab states that the mount order for systemd can be specified in /etc/fstab as per the following example:
Code: | UUID=716664b6-1475-4c11-9297-5920bb4f0677 /first_part ext4 defaults 0 0
UUID=3f46ad95-0d39-4f56-975d-2e61fc26230b /second_part ext4 defaults,x-systemd.requires-mounts-for=/first_part 0 0 |
Could this method be used in the case of zfs as well? _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.
My blog |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22624
|
Posted: Wed Aug 11, 2021 2:08 am Post subject: |
|
|
The fstab shown by Fitzcarraldo seems not to need ordering. Neither mount seemingly depends on the other. OP: I was hoping for an example fstab that systemd mishandles, so I could understand whether there is enough information present that it should have been able to do the right thing. |
|
Back to top |
|
|
sitquietly Apprentice
Joined: 23 Oct 2010 Posts: 150 Location: On the Wolf River, Tennessee
|
Posted: Wed Aug 11, 2021 12:15 pm Post subject: |
|
|
Hu wrote: | The fstab shown by Fitzcarraldo seems not to need ordering. Neither mount seemingly depends on the other. OP: I was hoping for an example fstab that systemd mishandles, so I could understand whether there is enough information present that it should have been able to do the right thing. |
When properly implemented zfs has no entry in fstab and no workarounds are required to get zfs mounts to come up after the root filesystem is actually present. Rather than search for a way to force systemd to work with zfs, as I've said, I use OpenRC which behaves predictably.
My point is not to find a way to workaround systemd unpredictability but to warn others about yet one more race condition which makes systemd harmful, and to give thanks for sturdy, predictable OpenRC. Some of us, including me, have had recurrent problems with startup and shutdown races such that the system can sometimes (unpredictably) hang at shutdown forcing a power switch shutdown. There are workarounds for each specific problem. Or there is a reliable init system. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22624
|
Posted: Wed Aug 11, 2021 6:59 pm Post subject: |
|
|
If there are no fstab entries for zfs, how does zfs get mounted at all? How can systemd screw this up if zfs is all automagically mounted outside the normal fstab flow? Is there some special openrc init script / systemd unit file required for zfs, and only the openrc init script is actually correct? |
|
Back to top |
|
|
mrbassie l33t
Joined: 31 May 2013 Posts: 821 Location: Go past the sign for cope, right at the sign for seethe. If you see the target you've missed it.
|
Posted: Thu Aug 12, 2021 5:52 pm Post subject: |
|
|
Hu wrote: |
How can systemd screw this up if zfs is all automagically mounted outside the normal fstab flow? Is there some special openrc init script / systemd unit file required for zfs, and only the openrc init script is actually correct? |
Holding it wrong? |
|
Back to top |
|
|
Morality124 Tux's lil' helper
Joined: 20 Feb 2018 Posts: 102
|
Posted: Sat Aug 14, 2021 6:12 pm Post subject: |
|
|
Hu wrote: | If there are no fstab entries for zfs, how does zfs get mounted at all? How can systemd screw this up if zfs is all automagically mounted outside the normal fstab flow? Is there some special openrc init script / systemd unit file required for zfs, and only the openrc init script is actually correct? |
ZFS uses services to access/mount ZFS pools and datasets. _________________ OTW 2.0
"Put your message in a modem and throw it in the cyber sea." |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22624
|
Posted: Sat Aug 14, 2021 6:42 pm Post subject: |
|
|
I was hoping for an answer that would make sense to those of us who are not proficient with ZFS pools, so that we could explore whether the problem was an inherent limitation in systemd, a defect in how ZFS integrates with systemd, or a bug in systemd. What kind of services are these? /etc/init.d/zfs-mount-my-local-filesystems?
Parallelism is normally a good thing, and if openrc only works because it is not parallel, that is bad and should be fixed. Proper support for parallelism should make ZFS pools work properly under both systemd and openrc. On the other hand, if openrc would work properly even when the non-default parallel startup is enabled, it would be interesting to explore why parallelism works under openrc and not under systemd. |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3916
|
Posted: Sat Aug 14, 2021 7:05 pm Post subject: |
|
|
Quote: |
Hu wrote:
If there are no fstab entries for zfs, how does zfs get mounted at all? How can systemd screw this up if zfs is all automagically mounted outside the normal fstab flow? Is there some special openrc init script / systemd unit file required for zfs, and only the openrc init script is actually correct?
|
@dataset-creation you define where things get mounted in relation to the rpool top.
So when the rpool is imported @boot the datasets are auto mounted.
I find Gentoo's implementation of systemd refreshingly light and un-bloated.
I am not a systemd fan but maybe it zfs fault not systemd's _________________
|
|
Back to top |
|
|
|