LWN: Comments on "Systemd 254 released" https://lwn.net/Articles/939511/ This is a special feed containing comments posted to the individual LWN article titled "Systemd 254 released". en-us Wed, 22 Oct 2025 19:14:31 +0000 Wed, 22 Oct 2025 19:14:31 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Systemd 254 released, exponential growing restart for intervals for Restart= https://lwn.net/Articles/970042/ https://lwn.net/Articles/970042/ zdzichu <div class="FormattedComment"> I written about this feature some time ago, here's the link to my blog:<br> <p> <a href="https://enotty.pipebreaker.pl/posts/2024/01/how-systemd-exponential-restart-delay-works/">https://enotty.pipebreaker.pl/posts/2024/01/how-systemd-e...</a><br> <p> Two examples and a link to the formula in the source code.<br> </div> Tue, 16 Apr 2024 14:32:28 +0000 Systemd 254 released, exponential growing restart for intervals for Restart= https://lwn.net/Articles/969970/ https://lwn.net/Articles/969970/ jdyrhovden <div class="FormattedComment"> Based on the recent update, I'm curious about the methodology behind calculating the exponential increase in restart intervals. How is the growth factor determined? Additionally, I would appreciate an illustrative example demonstrating the calculation process for each step.<br> <p> <p> * The service activation logic gained new settings RestartSteps= and<br> RestartMaxDelaySec= which allow exponentially-growing restart<br> intervals for Restart=.<br> </div> Tue, 16 Apr 2024 13:36:21 +0000 Systemd 254 released https://lwn.net/Articles/940609/ https://lwn.net/Articles/940609/ tao <div class="FormattedComment"> Surely if supporting systemd-sysv-generator requires almost no maintenance, it'd be a great target for newcomers who want a good way to get their feet wet and to get major kudos from the apparently enormous community of people who want to use initscripts instead of systemd units.<br> </div> Sun, 06 Aug 2023 17:21:03 +0000 Systemd 254 released https://lwn.net/Articles/940598/ https://lwn.net/Articles/940598/ anselm <blockquote><em>That's why it's a dick move.</em></blockquote> <p> I disagree. At some point the training wheels need to come off the bicycle. </p> <p> Properly-written systemd unit files make it possible for system services to avail themselves of all sorts of convenient systemd features which improve stability, security, and general service handling. Most of this remains unused by services which just keep using SysV init files with autogenerated service unit definitions. Programmers who, in 2023, insist on providing only SysV init files do their users an obvious disservice, and there is no reason anymore for systemd to be complicit in this. </p> <p> Note that there is nothing at all preventing programmers from providing <em>both</em> a systemd service unit <em>and</em> a SysV init file for their system services. Nobody talks about forcing anyone to give up SysV init support completely. It's just that nowadays most people can do a lot better with proper systemd support rather than legacy SysV init files – and even if software authors are too lazy and irresponsible to acknowledge this, they can still provide a minimal 10-line generator-style service unit that just calls the SysV init script, big deal. </p> Sun, 06 Aug 2023 12:21:32 +0000 Systemd 254 released https://lwn.net/Articles/940596/ https://lwn.net/Articles/940596/ bluca <div class="FormattedComment"> In case you never noticed, Linux (as in the kernel) breaks compatibility all the time. Every new release something breaks and need changes somewhere, whether it's a netlink message, or a uevent, or an LSM, etc etc. The answer is always 'deal with it'.<br> </div> Sun, 06 Aug 2023 11:12:42 +0000 Systemd 254 released https://lwn.net/Articles/940585/ https://lwn.net/Articles/940585/ Cyberax <div class="FormattedComment"> <span class="QuotedText">&gt; Systemd has been around as the de-facto standard for mainstream Linux distributions for more than a decade now. </span><br> <p> Yup. Just like Linux should drop anything that is older than a decade. Those developers having chutzpah not to move all their API use to io_uring in 2023!<br> <p> Yeah, I understand that it can be at least a couple of orders of magnitude more complicated task. But still, the thing that users like is not breaking their stuff. And this particular change will absolutely break some users' workflows.<br> <p> Also consider this, supporting systemd-sysv-generator requires almost no maintenance. Yet now many distros will probably have to scramble and keep patches on top of systemd to support this. And it will absolutely require an order of magnitude more aggregate man-hours to do that.<br> <p> That's why it's a dick move. <br> </div> Sun, 06 Aug 2023 03:34:53 +0000 Systemd 254 released https://lwn.net/Articles/940503/ https://lwn.net/Articles/940503/ anselm <blockquote><em>I still have fairly new software (less than 3 years old!) that only has SysV scripts. Yeah, I can easily writer a wrapper script, I know. However, having a tool to do it is nice.</em></blockquote> <p> You have that tool now. It's called systemd (or <tt>systemd-sysv-generator</tt> if you want to be picky; it even comes with its own man page). There's nothing wrong with copying its output against a rainy day. </p> <blockquote><em>So yep, removing it is a dick move.</em></blockquote> <p> I'd consider it a friendly suggestion to some people to get off their lazy fat behinds. </p> <p> Systemd has been around as the de-facto standard for mainstream Linux distributions for more than a decade now. If in 2023 there are people who have the chutzpah to distribute commercial software that comes only with a SysV init script, they deserve a stern talking-to. (And if the software in question is FLOSS, here's your chance to do something nice for the community.) </p> Fri, 04 Aug 2023 16:49:03 +0000 Systemd 254 released https://lwn.net/Articles/940488/ https://lwn.net/Articles/940488/ jwarnica <div class="FormattedComment"> At this point, even if you don't know why the *n* versions of the basic c library are better, you just do it.<br> <p> At some point the lazyness of simply writing a 5 line ini has to overwhelm any ideological attachments to 1000 line shell scripts. <br> <p> Just do it.<br> </div> Fri, 04 Aug 2023 14:32:54 +0000 Systemd 254 released https://lwn.net/Articles/940424/ https://lwn.net/Articles/940424/ rschroev <div class="FormattedComment"> And neither are the ExecStop= commands executed when ExecStartPost failed:<br> <p> $ sudo systemd-run --quiet -t -p ExecStop="echo hello" -p ExecStartPost="false" true<br> -&gt; gives no output<br> <p> So it seems we both did misread the code. Good, that solves my worries.<br> </div> Fri, 04 Aug 2023 07:47:35 +0000 Systemd 254 released https://lwn.net/Articles/940395/ https://lwn.net/Articles/940395/ malmedal <div class="FormattedComment"> <span class="QuotedText">&gt; And that's what's probably behind ExecStop being executed in my case (still doesn't explain the killing spree ...)</span><br> <p> Wild guess. Some init-scripts kill process-groups instead of pids, so if it hit the wrong one... <br> <p> <p> </div> Thu, 03 Aug 2023 21:14:27 +0000 Systemd 254 released https://lwn.net/Articles/940377/ https://lwn.net/Articles/940377/ bluca <div class="FormattedComment"> They are not:<br> <p> $ sudo systemd-run --quiet -t -p ExecStop="echo hello" false<br> $ sudo systemd-run --quiet -t -p ExecStop="echo hello" true<br> hello<br> </div> Thu, 03 Aug 2023 18:56:34 +0000 Systemd 254 released https://lwn.net/Articles/940372/ https://lwn.net/Articles/940372/ rschroev <div class="FormattedComment"> <span class="QuotedText">&gt; I don't see why it would be "totally confusing and unexpected" to a user that the commands in ExecStop are not run if the service fails to start. If the service failed to start, what's the point in trying to stop it? You don't try to close a file that you failed to open, either.</span><br> <p> But according to the source code, the ExecStop commands *are* run even if the service fails to start. Referring to zdzichu's comment somewhere in this thread (see <a href="https://lwn.net/Articles/940224/">https://lwn.net/Articles/940224/</a>), line 2264 in service.c (in service_enter_running()) calls service_enter_stop() when a service fails to start. service_enter_stop() in turn executes the ExecStop commands.<br> <p> I agree with you: I don't expect ExecStop to be triggered if a service fails to start. The documentation agrees, if I interpret it correctly. But unless both zdzichu and I are misreading the code, the code does trigger it in that case.<br> </div> Thu, 03 Aug 2023 18:09:26 +0000 Systemd 254 released https://lwn.net/Articles/940361/ https://lwn.net/Articles/940361/ anselm <blockquote><em>I'm sorry YOU don't want initscripts on YOUR laptop, bluca. Some others of us would prefer that that compatibility layer stay. Thanks.</em></blockquote> <p> Nobody will prevent your init scripts from working. All that changes is that you will have to come up with your own systemd service units that call them. If your service is running now you can copy a simple one from <tt>/run/systemd/generator.late</tt> for later. </p> <p> This is independent from the fact that on a systemd-based machine, when you're using init scripts – especially with a very simple (auto-generated) service unit – you're deliberately forgoing a bunch of cool and useful features which systemd provides out of the box, which could make your service easier to control, more stable, and more secure, and which SysV init files generally do not bother with. Of course this is your privilege, but it may be worth considering whether making a dedicated systemd service unit for your service which works without the init script and takes more direct advantage of systemd's features might not be a good idea after all. </p> Thu, 03 Aug 2023 17:21:08 +0000 Systemd 254 released https://lwn.net/Articles/940346/ https://lwn.net/Articles/940346/ jem <p>The linked man page contains the following text for <tt>ExecStop</tt>: "Commands <b>to</b> execute to stop the service started via <tt>ExecStart</tt>". This hints that the purpose of <tt>ExecStop</tt> is to provide the commands to explicitly stop the service, triggered by some external event like <tt>systemctl stop</tt>.</p> <p><q>But *when*? Is it triggered e.g. at the time you do 'systemctl stop', regardless of what happened to the service in the meantime? Or is triggered at the time systemd notices that the service went away? That's a big difference.</q></p> <p>Looking at the code, it is called as a direct result of <tt>systemctl stop</tt>, which calls <tt>service_stop</tt>. If the service state is <tt>SERVICE_RUNNING</tt>, the <tt>service_stop</tt> function unconditionally calls <tt>service_enter_stop</tt>, which in turn executes the command specified in <tt>ExecStop</tt> (if any).</p> <p>I don't see why it would be "totally confusing and unexpected" to a user that the commands in <tt>ExecStop</tt> are not run if the service fails to start. If the service failed to start, what's the point in trying to stop it? You don't try to close a file that you failed to open, either.</p> Thu, 03 Aug 2023 16:55:51 +0000 Systemd 254 released https://lwn.net/Articles/940348/ https://lwn.net/Articles/940348/ Wol <div class="FormattedComment"> <span class="QuotedText">&gt; In that case these newly spawn processes will live inside the cgroup of the service and are going to be killed by systemd once the main service is stopped.</span><br> <p> Oh the joys of people not reading the thread. The killing spree is OF OTHER SERVICES which have nothing whatsoever to do with the service causing the problem ...<br> <p> Ie something is seriously wrong somewhere. I just need to debug it.<br> <p> Cjhers,<br> Wol<br> </div> Thu, 03 Aug 2023 15:37:47 +0000 Systemd 254 released https://lwn.net/Articles/940340/ https://lwn.net/Articles/940340/ jccleaver <div class="FormattedComment"> <span class="QuotedText">&gt;Unit files are stable. Old and crufty init scripts were known for many things, but being stable is definitely not one of them. You will still be able to use them of course, if you like them - not on systemd though.</span><br> <p> Thank you for so clearly demonstrating my original point in this thread.<br> <p> What you're calling "old and crufty" others call stability. Some of us (many of us) prefer imperative to declarative during important phases of operation because it makes it easier for a human to debug. Even leaving aside the fact that init scripts have been updated less and less due to systemd-migration, init scripts haven't changed much because they *just worked*... This is especially the case on the Red Hat/Fedora side of the ecosystem, instead of the Debian landscape where things actually were a bit more painful. But init script conventions in Fedora-world had been locked down pretty well for a long while.<br> <p> Regardless, your "you can use them, but since I don't, you're not going to use them on systemd" attitude is *PRECISELY* what earns you such vitriol from admins downstream of your decisions. <br> <p> I'm sorry YOU don't want initscripts on YOUR laptop, bluca. Some others of us would prefer that that compatibility layer stay. Thanks.<br> </div> Thu, 03 Aug 2023 14:35:37 +0000 Systemd 254 released https://lwn.net/Articles/940282/ https://lwn.net/Articles/940282/ gioele <div class="FormattedComment"> <span class="QuotedText">&gt; And that's what's probably behind ExecStop being executed in my case (still doesn't explain the killing spree ...)</span><br> <p> Maybe the service was also launching other services or calling other init scripts?<br> <p> In that case these newly spawn processes will live inside the cgroup of the service and are going to be killed by systemd once the main service is stopped.<br> </div> Thu, 03 Aug 2023 13:05:09 +0000 Systemd 254 released https://lwn.net/Articles/940278/ https://lwn.net/Articles/940278/ Wol <div class="FormattedComment"> I'm guessing that at least one pathological behaviour here is<br> <p> (1) systemd fires off a process<br> (2) this process fires off the daemon and exits<br> (3) systemd sees the process has terminated, and runs ExecStop<br> <p> That certainly is the sort of behaviour I assumed was behind the double-daemonisation, and why this fork option was added to the unit file - to prevent exactly this mis-understanding by systemd. I must admit that wasn't obvious from said documentation but it was all in there ...<br> <p> And that's what's probably behind ExecStop being executed in my case (still doesn't explain the killing spree ...)<br> <p> Cheers,<br> Wol<br> </div> Thu, 03 Aug 2023 12:28:16 +0000 Systemd 254 released https://lwn.net/Articles/940267/ https://lwn.net/Articles/940267/ anselm <blockquote><em>If you don't know what that script is doing, what the daemon it's starting is doing, not it's NOT that trivial.</em></blockquote> <p> And that should help convince anyone that allowing arbitrary shell code for daemon startup is, with hindsight, not the greatest of ideas. At least with systemd you know where you stand. </p> <blockquote><em>And you don't stand a hope in hell of knocking them out that quick.</em></blockquote> <p> For most if not all SysV init scripts it's not a huge problem to come up with simple service units that call them (nobody said you <em>had</em> to get rid of the init script altogether, after all). Systemd even does that automatically, for now anyway. That way you're not taking advantage of many of the helpful and convenient things systemd can do, but it's a start. If you're only interested in keeping the service working as before once the automatic support for SysV init scripts is removed from systemd, it may be all you need to do. You could even take a peek in <tt>/run/systemd/generator.late</tt> to see what you can find there. </p> <p> It's when you want to replace the init script completely with a service unit that you need to look at the init script to see what exactly it does, and that of course takes time (especially with some of the more gnarly init scripts out there). I don't think anyone has seriously doubted that. </p> Thu, 03 Aug 2023 11:17:46 +0000 Systemd 254 released https://lwn.net/Articles/940266/ https://lwn.net/Articles/940266/ rschroev <div class="FormattedComment"> I can't reword it because I don't have a good enough grasp on how it works. Every new piece of information seems to contradicts the previous one. And when the documentation doesn't match the code, I can't know which one of them (if any) is correct.<br> <p> <span class="QuotedText">&gt; to me it's perfectly obvious that ExecStop is ran regardless of _how_ a unit went away</span><br> <p> But *when*? Is it triggered e.g. at the time you do 'systemctl stop', regardless of what happened to the service in the meantime? Or is triggered at the time systemd notices that the service went away? That's a big difference.<br> <p> <span class="QuotedText">&gt; To me, "Note that the commands specified in ExecStop= are only executed when the service started successfully first." is clear.</span><br> <p> It seems clear to me too, but my interpretation is contradicted by the list in zdzichu's comment (<a href="https://lwn.net/Articles/940224/">https://lwn.net/Articles/940224/</a>), which is correct as far as I can see. According to that, the commands in ExecStop= *are* executed even if the service did *not* start successfully, at the moment systemd detects that.<br> </div> Thu, 03 Aug 2023 11:11:55 +0000 Systemd 254 released https://lwn.net/Articles/940265/ https://lwn.net/Articles/940265/ bluca <div class="FormattedComment"> There's 2 cases here: either you have nothing at all, and then this change to the generator doesn't affect you in any way, or you have an init script used through the deprecated generator. In the latter case, it is as simple as taking the generated unit and initially just shipping that as-is. That _is_ trivial, it's just a copy and a git add!<br> Why is it better? Because you can then iteratively improve on that, pick up recommended patterns, add sandboxing, etc etc, so that it can evolve and improve over time, rather than being ossified to the lowest common denominator of whatever silliness was happening back in the 80s.<br> </div> Thu, 03 Aug 2023 10:57:24 +0000 Systemd 254 released https://lwn.net/Articles/940262/ https://lwn.net/Articles/940262/ paulj <div class="FormattedComment"> In my experience it _is_ pretty simple:<br> <p> 1. Open the init script<br> 2. Find where it launches your daemon<br> 3. Remove the argument telling the daemon to daemonise<br> 4a. If this is the first one you're doing: Write the trivial systemd unit file to ExecStart that script<br> 4b. If not the first, copy the trivial systemd unit file you've already got and change the ExecStart line.<br> <p> Pretty much every daemon I've ever used, there is an argument to enable or disable daemonisation, cause a) developers want to be able to debug daemons (run under GDB usefully); b) there already are other init systems (inc. various SysVs Unixes in the olden days, like AIX, that already have various process managers; and other hacky homebrew and vendor-hacky process managers) that want processes to not daemonise; and so this is nearly always easy to figure out and set.<br> <p> </div> Thu, 03 Aug 2023 10:45:49 +0000 Systemd 254 released https://lwn.net/Articles/940257/ https://lwn.net/Articles/940257/ bluca <div class="FormattedComment"> Writing documentation is hard - what is obvious to me as developer, can be entirely opaque to a given user, and it's difficult to tell when what is what. In this case, to me it's perfectly obvious that ExecStop is ran regardless of _how_ a unit went away, because we don't track commands being sent by admins/programs, we track cgroups. So, to me, "Note that the commands specified in ExecStop= are only executed when the service started successfully first." is clear. But to a user, this might be totally confusing and unexpected.<br> <p> So, long story short, that manpage is here: <a href="https://github.com/systemd/systemd/blob/main/man/systemd.service.xml">https://github.com/systemd/systemd/blob/main/man/systemd....</a> please send a PR to reword so that it becomes clear to you as a user, and I'll happily review and merge it<br> </div> Thu, 03 Aug 2023 10:35:41 +0000 Systemd 254 released https://lwn.net/Articles/940254/ https://lwn.net/Articles/940254/ Wol <div class="FormattedComment"> I believe the systemd documentation itself warns of the consequences of "double daemonisation" or whatever it is in SysV scripts. There are various behaviours common (indeed, almost mandatory) under other init systems that are pathological to systemd. It would not surprise me if this binary assumes SysV (or indeed no init system at all) and behaves in a manner systemd neither likes nor expects.<br> <p> What then triggers the mass killing I don't know. All I know is (1) it only happens if the systemd unit file contains an ExecStop. And (2) iirc the systemd logs actually point the finger straight at this binary!<br> <p> At some point I need to fix it, but it's a load of reverse engineering I don't have time for :-(<br> <p> Cheers,<br> Wol<br> </div> Thu, 03 Aug 2023 10:07:15 +0000 Systemd 254 released https://lwn.net/Articles/940253/ https://lwn.net/Articles/940253/ Wol <div class="FormattedComment"> Bingo.<br> <p> This thread all started because the OP to whom I replied said that someone else could port 30 or so SysV init scripts to systemd unit files in a few hours. If you don't know what that script is doing, what the daemon it's starting is doing, not it's NOT that trivial. And you don't stand a hope in hell of knocking them out that quick.<br> <p> And I just gave my experience as an example, where an attempt to start a binary with a systemd unit file blew up in my face spectacularly, precisely because I didn't know what exactly that binary was doing. I know there are landmines. I know I clearly stepped on one. I just haven't debugged which one, yet :-)<br> <p> Cheers,<br> Wol<br> </div> Thu, 03 Aug 2023 10:00:58 +0000 Systemd 254 released https://lwn.net/Articles/940236/ https://lwn.net/Articles/940236/ rschroev <div class="FormattedComment"> I feel some of these conflict with the documentation. From <a href="https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStop=:">https://www.freedesktop.org/software/systemd/man/systemd....</a><br> <p> "Note that the commands specified in ExecStop= are only executed when the service started successfully first. They are not invoked if the service was never started at all, or in case its start-up failed, for example because any of the commands specified in ExecStart=, ExecStartPre= or ExecStartPost= failed (and weren't prefixed with "-", see above) or timed out."<br> <p> That directly conflicts with your items 1, 2, and 4, and I feel it also conflicts with 6 and 9. And I don't see where it is documented that ExecStop= commands are called when systemd detects that processes have stopped (I haven't read *all* the documentation though, there's quite a lot of it); I feel generally while the documentation does explain what ExecStop does, it doesn't say enough about if and when ExecStop is triggered.<br> <p> If the documentation is wrong, incomplete or unclear, I don't see how we're supposed to write correct unit files that work in all cases including edge cases. We shouldn't have to read the code to find out.<br> </div> Thu, 03 Aug 2023 08:33:40 +0000 Systemd 254 released https://lwn.net/Articles/940224/ https://lwn.net/Articles/940224/ zdzichu <p>I disagree, ExecStop can be invoked if is defined and <ol> <li> when sysadmin run <tt>systemctl stop unit</tt>;</li> <li> when systemd decides to stop unit;</li> <li> when unit exited/failed by itself.</li></ol></p> <p> By coincidence, systemd is <b>open source</b> so we don't have to guess!</p> <p> <a href="https://github.com/systemd/systemd/blob/e3b7fe92e90fd107ea9be30112e00e227ca18501/src/core/service.c#L2185">Function <code>service_enter_stop()</code></a> runs <code>ExecStop=</code> if the section defined. <code>service_enter_stop()</code> is invoked in 10 cases: <ol> <li> line 2264 – service did not start successfully and is not RemainAfterExit=true</li> <li> line 2294 – ExecStartPost failed</li> <li> line 2663 – command_next failed? (I don't know this mechanism)</li> <li> line 2692 – failed to start main task</li> <li> line 2801 – stop command is invoked</li> <li> line 3632 – PIDFile was specified but never wrote by the service</li> <li> line 3688 – Out of Memory condition manifested</li> <li> line 3815 – both main and control processes exited</li> <li> line 4004 – another failure of PIDFile</li> <li> line 4128 – RuntimeMaxSec= was reached</li> </ol></p> <p>In summary, when ExecStop= is defined, it is run in multitude of cases, including service failure to start*. Not only when administrator requests service to stop.</p> <p><small>* - I suspect failures to start are most often caused by wrong Type=. I once wrote <a href="https://enotty.pipebreaker.pl/2014/10/08/failure-modes-of-incorrect-type-in-systemd-units/">a blog note</a> with a table explaning the symptoms of mismatch.</small></p> Thu, 03 Aug 2023 07:35:09 +0000 Systemd 254 released https://lwn.net/Articles/940221/ https://lwn.net/Articles/940221/ jem <div class="FormattedComment"> The key thing here is what *triggers* the invocation of the command in ExecStop. The command is run as a result of systemd actively wanting to stop the service, not because it has suddenly detected that the process has exited. The sentence from "man systemd.service" you quoted means that systemd does *not* check whether the program is alive or not, it runs it anyway.<br> </div> Thu, 03 Aug 2023 06:41:18 +0000 Systemd 254 released https://lwn.net/Articles/940218/ https://lwn.net/Articles/940218/ zdzichu Your understanding is incomplete. Quoting <tt>man systemd.service</tt>: <blockquote>Also note that the stop operation is always performed if the service started successfully, even if the processes in the service terminated on their own or were killed. </blockquote> Nevertheless, Wol's stories about one service stop killing unrelated services are hard to believe in. Unless he wrote <code>ExecStop=/usr/bin/killall…</code> Thu, 03 Aug 2023 06:28:44 +0000 Systemd 254 released https://lwn.net/Articles/940208/ https://lwn.net/Articles/940208/ rschroev <div class="FormattedComment"> <span class="QuotedText">&gt; I suspect the fact that it's backgrounding makes systemd think it's stopped and triggers the exec stop.</span><br> <p> If that's what you see then that's what happening, but it goes completely against my understanding of how systemd behaves. It is my understanding that systemd runs the ExecStop commands when it wants to stop the service, not when it detects that the service is stopped.<br> </div> Wed, 02 Aug 2023 23:14:40 +0000 Systemd 254 released https://lwn.net/Articles/940207/ https://lwn.net/Articles/940207/ rschroev <div class="FormattedComment"> If I understood everything correctly, you're trying to manage third-party software of which you don't really know how it expects to be managed properly. That's always going to be an uphill battle, regardless of which supervisor you use. Writing code, or config files in this case, doesn't work very well when you don't have a specification for what the code is supposed to do.<br> </div> Wed, 02 Aug 2023 23:01:51 +0000 Systemd 254 released https://lwn.net/Articles/940157/ https://lwn.net/Articles/940157/ mjg59 <div class="FormattedComment"> It came from paulj in <a href="https://lwn.net/Articles/939956/">https://lwn.net/Articles/939956/</a> - he's suggesting that you write a systemd unit that just wraps the existing sysv script. You appear to have misinterpreted that as a suggestion that your program was a script.<br> </div> Wed, 02 Aug 2023 17:18:59 +0000 Systemd 254 released https://lwn.net/Articles/940128/ https://lwn.net/Articles/940128/ mb <div class="FormattedComment"> <span class="QuotedText">&gt;If you're a Unix fan, unit files probably felt familiar to you</span><br> <p> I'm sorry. That doesn't really make any sense. At all.<br> <p> And you're also running in circles. Multiple times. We all understand that you do have trouble writing a unit file and didn't succeed so far. But that's far from being the norm.<br> </div> Wed, 02 Aug 2023 15:09:47 +0000 Systemd 254 released https://lwn.net/Articles/940115/ https://lwn.net/Articles/940115/ Wol <div class="FormattedComment"> Thanks. I think you're pretty spot on.<br> <p> I believe I've tried "forking = yes".<br> <p> You do start and stop it with special command line arguments (--start and --stop would you believe :-), and yes with --start it does go into the background.<br> <p> Beyond that, I need to investigate what's going on. I suspect the fact that it's backgrounding makes systemd think it's stopped and triggers the exec stop. And when it gets that, I suspect it gets confused as to what services are its own and what are not, and sends kills to the wrong processes. But that's a debugging session I need to get into when I have time. At present I just don't use exec stop.<br> <p> Because if exec stop is enabled, I can guarantee a bunch of random services will fail to start, with systemd reporting they've been killed on startup :-(<br> <p> Cheers,<br> Wol<br> </div> Wed, 02 Aug 2023 14:37:30 +0000 Systemd 254 released https://lwn.net/Articles/940112/ https://lwn.net/Articles/940112/ Wol <div class="FormattedComment"> "not easy", or "hard".<br> <p> Not necessarily the same thing.<br> <p> But you can't expect a complete novice at writing them, to churn out several in the first hour, as the OP implied. My first attempt did nothing. I scrabbled around in the documentation, emailed the mailing list, and got exec start to work. It wasn't hard, but it was quite of lot of frustration trying to find out information.<br> <p> Then as I say someone else added the exec stop and all hell broke loose.<br> <p> It probably is true that writing unit files is pretty easy. But not to a novice. If I stuck TCL in front of you, even with excellent documentation you'd struggle, and it really is easy. <br> <p> And it may also seem odd for someone on LWN so much, but I'm not that familiar with (or a fan of) "the Unix way". What little I know is what I've had to learn (and no, I wouldn't put Windows in my "favourite OS" list, either).<br> <p> If you're a Unix fan, unit files probably felt familiar to you, even when meeting them for the first time. They still feel alien to me.<br> <p> Cheers,<br> Wol<br> </div> Wed, 02 Aug 2023 14:21:13 +0000 Systemd 254 released https://lwn.net/Articles/940032/ https://lwn.net/Articles/940032/ jem <div class="FormattedComment"> We need more details of what the program does. Does it daemonise? If it does, you need to add Type=forking to the unit file, if not, don't add a Type= line. (What happens if the program is started from an interactive shell? Does it go into the background?)<br> <p> If the program daemonises, it probably writes its PID to a file. From man systemd.service: "If this setting is used, it is recommended to also use the PIDFile= option, so that systemd can reliably identify the main process of the service." <br> <p> If the program expects to shut down in some special way, like running the program binary with a special command line parameter, add this to the ExecStop= option. The ExecStop= option is not mandatory; the default is for systemd to send a SIGTERM signal to the process, followed by a SIGTERM (if needed), with the assumption that the program catches one of these signals and does a graceful shutdown.<br> <p> </div> Wed, 02 Aug 2023 12:28:49 +0000 Systemd 254 released https://lwn.net/Articles/940028/ https://lwn.net/Articles/940028/ anselm <blockquote><em>I am merely observing that THAT IS WHAT HAPPENS.</em></blockquote> <p> To be precise, this is what happens <em>to you</em>, or at any rate what seems to have happened to you in one particular instance. It is certainly not the norm. </p> <p> As I said, the usual way for systemd to support services which only have SysV init scripts is to construct basic systemd service units on the fly that essentially use <tt>ExecStart=</tt> and <tt>ExecStop=</tt> to invoke the init script, and that seems to work without a hitch in the vast majority of cases. Taking such an init script as a first approximation to/starting point for a free-standing service unit file would not be the dumbest of ideas (even though systemd prefers services that don't double-fork). </p> Wed, 02 Aug 2023 11:46:28 +0000 Systemd 254 released https://lwn.net/Articles/940025/ https://lwn.net/Articles/940025/ mb <div class="FormattedComment"> <span class="QuotedText">&gt; "Because writing a trivial systemd unit file is not, in fact, trivial?"</span><br> <span class="QuotedText">&gt; Which it isn't.</span><br> <p> Well, it actually is trivial for many many cases.<br> <p> I really think you are hitting a corner case here and your application is doing something absolutely crazy.<br> We obviously can't debug that here on LWN.<br> But please stop saying that writing systemd unit files was hard, just because you have *one* case that might be a bit harder. In general it is easy.<br> </div> Wed, 02 Aug 2023 11:37:34 +0000 Systemd 254 released https://lwn.net/Articles/940021/ https://lwn.net/Articles/940021/ Wol <div class="FormattedComment"> I'm not blaming systemd at all. I am merely observing that THAT IS WHAT HAPPENS. Why people can't tell the difference between an objective description of reality and a subjective allocation of blame I really don't understand! Sadly the latter seems to be the norm.<br> <p> Which can make fixing problems EXTREMELY difficult - one only has to look at society to see the trouble this causes :-(<br> <p> Cheers,<br> Wol<br> </div> Wed, 02 Aug 2023 10:43:01 +0000 Systemd 254 released https://lwn.net/Articles/940019/ https://lwn.net/Articles/940019/ Wol <div class="FormattedComment"> <span class="QuotedText">&gt; The suggestion was that you write a systemd unit that runs the old sysv script, not that the program you were trying to run was a script.</span><br> <p> And where did that come from? Not from me. Yes I think I can see the confusion, but at no point did *I* mention scripts at all. My comment was<br> <p> "Because writing a trivial systemd unit file is not, in fact, trivial?"<br> <p> Which it isn't. Writing my first unit file, and getting it to work with a simple ExecStart, wasn't easy. Then someone else added that ExecStop and the killing sprees started.<br> <p> At some point I need to dig into the code to find out why this perfectly functional daemon does not function correctly with a very simple unit file :-(<br> <p> Too many people seem to think that *their* normal applies to everyone else ...<br> <p> Cheers,<br> Wol<br> </div> Wed, 02 Aug 2023 10:39:10 +0000