Re: [systemd-devel] ExecStop upon un-expected but clean shutdown
Hi, While trying to make progress on this issue, I found this: https://lists.freedesktop.org/archives/systemd-devel/2015-February/028058.html which appears to be a similar problem. I eventually identified changeset d54ddab8cbad46290306fc6e3346089fe3772d5c as the relevant change by Lennart. A quick check in my server's distribution source package shows that this change is already included in my server's systemd yet, I can still observe the infinite loop described in my first email when someone kills my service without systemctl: ExecStop is executed and blocks forever because it attempts to connect to the service's activation socket which is under the control of systemd itself. Am I supposed to re-implement my ExecStop command to not use the activation socket ? Mathieu On Mon, Mar 21, 2016 at 10:44 AM, Mathieu Lacage wrote: > Hi, > > I have a daemon that is socket-activated through a systemd-managed > localhost TCP socket. The daemon is normally shutdown by a simple systemctl > stop with ExecStop=curl -X POST on the right HTTP endpoint which makes it > easy to cleanup resources and make sure my data hits the hard disk. > > Now, it just so happens that sometimes my users and myself screw up and we > actually invoke the stop HTTP endpoint by hand because we are dumb. When > this happens, systemd detects that the daemon dies peacefully (status = 0) > and then proceeds to invoke ExecStop=curl -X POST (service_enter_running > calls service_enter_stop). The latter never completes because systemd still > has the activation socket open so curl waits forever for the TCP connection > to be accepted (modulo timeout). When the timeout expires, systemd tries to > re-run ExecStop. When I "kill -9" the command by hand, systemd tries to > re-run ExecStop. > > voila, deadlock: systemd waits for ExecStop to finish, ExecStop waits for > systemd to start daemon to be able to stop it. > > Now, I am sure that what I did (use the activation socket as the channel > over which stop commands are safely sent) is not right but I wonder if > there is a way to make systemd actually deal with the situation better and > if not, what I should do instead to deal with someone trying to shutdown > the daemon without "systemctl stop". > > I would be happy to file a bug if needed but I am not really sure the > problem lies in systemd. Or maybe it is a documentation problem: it would > help quite a bit if the activation state machine/transitions was documented > in a human-readable way beyond what can be found by reading the source code. > > any help would be welcome, > Mathieu > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Shutdown root fs on loop device
Hi, I have some PCs where I have to store the Linux root file system as a large file in Window's NTFS file system. Everything boots fine. The NTFS file system is mounted as ntfs-3g in the initial ramfs as /host, the loopback device is created (using /host/Linux/image.img) and used as root. However, the system doesn't shut down cleanly, usually it simply hangs. I admit that it isn't easy to solve this situation on shutdown. When executing findmnt in the running Linux system, the only "hint" is /dev/loop0 being mounted as root. The NTFS mount doesn't appear at all. It only shows in systemctl status, which starts with init.scope |. 1 /sbin/init |- 155 mount.ntfs-3g -o permissions /dev/sda2 /host Is it possible to configure systemd-shutdown somehow (e.g. hook scripts)? Or do I have to write my own systemd-shutdown? - Michael ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Shutdown root fs on loop device
On Fri, Apr 22, 2016 at 11:49:09AM +0200, Michael Lipp wrote: > Hi, > > I have some PCs where I have to store the Linux root file system as a > large file in Window's NTFS file system. Everything boots fine. The NTFS > file system is mounted as ntfs-3g in the initial ramfs as /host, the > loopback device is created (using /host/Linux/image.img) and used as root. > > However, the system doesn't shut down cleanly, usually it simply hangs. > I admit that it isn't easy to solve this situation on shutdown. When > executing findmnt in the running Linux system, the only "hint" is > /dev/loop0 being mounted as root. The NTFS mount doesn't appear at all. > It only shows in systemctl status, which starts with > > init.scope > |. 1 /sbin/init > |- 155 mount.ntfs-3g -o permissions /dev/sda2 /host > > Is it possible to configure systemd-shutdown somehow (e.g. hook > scripts)? Or do I have to write my own systemd-shutdown? You have to patch ntfs-3g to marks itself as non-killable root storage provider (with '@'): https://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons/ -- Tomasz Torcz ,,(...) today's high-end is tomorrow's embedded processor.'' xmpp: zdzich...@chrome.pl -- Mitchell Blank on LKML ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Shutdown root fs on loop device
Or use a wrapper. #include #include int main(int argc, char *argv[]) { argv[0] = "@ntfs-3g"; execv("/usr/bin/ntfs-3g", argv); perror("ntfs-3g-wrapper"); return 1; 2016-04-22 13:02 GMT+02:00 Tomasz Torcz : > On Fri, Apr 22, 2016 at 11:49:09AM +0200, Michael Lipp wrote: > > You have to patch ntfs-3g to marks itself as non-killable > root storage provider (with '@'): > https://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd hibernator generator does not function on default Fedora install
On Thu, 21.04.16 12:00, Chris Murphy (li...@colorremedies.com) wrote: > On Wed, Apr 20, 2016 at 3:14 AM, Lennart Poettering > wrote: > > On Tue, 19.04.16 22:47, Chris Murphy (li...@colorremedies.com) wrote: > > > >> In some ancient bug or lkml I'd read a kernel maintainer say that the > >> hibernation image size isn't fixed, and might be less than RAM size > >> but could be a little more than RAM size, especially if some swap is > >> being used. So what should swap partition size be to support > >> hibernation? 1x RAM? 1.5x? 2x? Other? > > > > Here's the heuristics code logind uses to check whether hibernation > > shall be considered available or not: > > > > https://github.com/systemd/systemd/blob/master/src/shared/sleep-config.c#L229 > > > > i.e. it checks that the RAM size is smaller than 0.98 times the > > currently unused swap space. > > Default Fedora 24 installation, 'free' shows > > Mem: 2048524 > Swap: 2098172 > > Mem is 0.976 times unused swap, on a clean boot where no swap at all > is being used. If as little as 8MiB swap were used, sounds like > hibernation would fail? How does it fail if mem > 0.98 * swap? I think > this swap is too small to rely upon, but my main concern is how the > hibernation fails, if it's fail safe, and if there's some way for user > space to predict it will fail so it doesn't even attempt it? The Hibernate() bus call will immediately return an error indicating that hibernation is not possible if the check fails. It's up to the client code to then retry Suspend() or so, depending on what policy it tries to follow there. Also note that there's a CanHibernate() bus call that just executes the check, and returns the result. The idea is that DEs use that to gray out/make unavailable any hibernation UI if the system isn't set up for that. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Shutdown root fs on loop device
On Fri, 22.04.16 11:49, Michael Lipp (m...@mnl.de) wrote: > Hi, > > I have some PCs where I have to store the Linux root file system as a > large file in Window's NTFS file system. Everything boots fine. The NTFS > file system is mounted as ntfs-3g in the initial ramfs as /host, the > loopback device is created (using /host/Linux/image.img) and used as root. > > However, the system doesn't shut down cleanly, usually it simply hangs. > I admit that it isn't easy to solve this situation on shutdown. When > executing findmnt in the running Linux system, the only "hint" is > /dev/loop0 being mounted as root. The NTFS mount doesn't appear at all. > It only shows in systemctl status, which starts with > > init.scope > |. 1 /sbin/init > |- 155 mount.ntfs-3g -o permissions /dev/sda2 /host > > Is it possible to configure systemd-shutdown somehow (e.g. hook > scripts)? Or do I have to write my own systemd-shutdown? If marking your fuse process with "@" doesn't suffice (as suggested in the other mails in this thread), you can always define an initrd shutdown script: https://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/ i.e. the /run/initramfs/shutdown stuff discussed there. But note that this is invoked after the built-in shutdown logic has run, and thus you probably want to combine it with the "@" logic. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] [RFC] ProfileName match constraint and profile selection via networkctl
On Thu, 21.04.16 17:49, Clemens Gruber (clemens.gru...@pqgruber.com) wrote: > Hi, > > I have the following problem: I use systemd-networkd on an embedded ARM > board but we have several different network usecases (with or without > VLAN trunking, etc.) which need to be configurable. > > Until now, I tried to create a KernelCommandLine Match constraint to > control which .network and .netdev files are used for an interface, but > it's obviously not a good solution as a change requires a reboot. > > What do you think about creating a Profile= or ProfileName= match > constraint for .net* files and let the user switch between profiles > through networkctl ? Well, currently networkctl is fully passive, and networkd provides exactly zero calls for changing its state. To add APIs like this is high on our TODO list however. I personally cannot say I am a fan of the "profile" concept in general, even though it has been requested a number of times before. However, I think that shouldn't stop you from implementing something like this, and I think you can do this relatively easily without direct support in networkd. For example, you could place your choice of .network files somewhere, and then write a short script that symlinks them depending on the profile to use in /run/systemd/network/, and restart networkd. That script could even use /dev/null masking to mask out some default config in some profiles, so that you can relatively easily build something that comes up with some default config, but by running that script disables some .network files and adds in others instead. I hope this makes sense? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Fwd: Stopping a service at a specific time or after a specific duration
On Wed, 20.04.16 16:29, Jamie Kitson (ja...@kitten-x.com) wrote: > > For stopping after a duration you can use RuntimeMaxSec=, introduced in > > v229. > > Thanks. The man page says: > > > If this is used and the service has been active for longer than the > > specified > > time it is terminated and put into a failure state. > > Do you know what terminate signal is used, or if the failure state has > any adverse/side effects? SIGABRT. A service in the failure state will show up as that in "systemctl list-services", and will not be GC'ed away, until the failure state is reset with "systemctl reset-failed". Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Fwd: Stopping a service at a specific time or after a specific duration
On Thu, 21.04.16 10:32, Reindl Harald (h.rei...@thelounge.net) wrote: > >Thanks. The man page says: > > > >>If this is used and the service has been active for longer than the > >>specified > >>time it is terminated and put into a failure state > > and i call that a design bug - why does it go into failure state? No need to warm up this discussion. And I think I said already that I'd be happy to merge a patch that allows making the MaxRuntimeSec= effect configurable, and optionally clean. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Fwd: Stopping a service at a specific time or after a specific duration
Am 22.04.2016 um 17:03 schrieb Lennart Poettering: On Thu, 21.04.16 10:32, Reindl Harald (h.rei...@thelounge.net) wrote: Thanks. The man page says: If this is used and the service has been active for longer than the specified time it is terminated and put into a failure state and i call that a design bug - why does it go into failure state? No need to warm up this discussion. And I think I said already that I'd be happy to merge a patch that allows making the MaxRuntimeSec= effect configurable, and optionally clean sorry for not beeing able to fix and change C/C++ code and only can state when things are not finally designed from start. signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd hibernator generator does not function on default Fedora install
On Thu, Apr 21, 2016 at 6:11 AM, Harald Hoyer wrote: > Yeah, I think dm-crypt/luks does not change metadata on disk while opening > it, so no problems here. What metadata change happens with linear logical volumes? I'd expect LVM or dm metadata changes if thin provisioning is being used, but as far as I know thinp can't support swap. Hibernation images have been dumped onto linear LV's for a long time, is there a recent discovery that this is a problem or a non-trivial concern? -- Chris Murphy ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [networkd] [RFC] ProfileName match constraint and profile selection via networkctl
On Fri, Apr 22, 2016 at 04:48:02PM +0200, Lennart Poettering wrote: > However, I think that shouldn't stop you from implementing > something like this, and I think you can do this relatively easily > without direct support in networkd. For example, you could place your > choice of .network files somewhere, and then write a short script that > symlinks them depending on the profile to use in > /run/systemd/network/, and restart networkd. That script could even > use /dev/null masking to mask out some default config in some > profiles, so that you can relatively easily build something that comes > up with some default config, but by running that script disables some > .network files and adds in others instead. > > I hope this makes sense? Yes, thank you. Sounds like a good solution for my use case! Clemens ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel