Re: [systemd-devel] How to automount
> I don't think there's any way to have something auto-unmount There certainly is – udev has been unmounting unplugged drives for many years. It's done by default. On Mon, Sep 21, 2015, 23:10 Paul D. DeRoccowrote: > > From: Umut Tezduyar Lindskog [mailto:u...@tezduyar.com] > > > > I am not sure if automount is really the right way to go. In the end, > > your automount path will fail if your device is not plugged in. > > A little experimenting showed you're right. > > > You could always use udev rules (ENV{SYSTEMD_WANTS}='media-ext.mount') > > to mount the volume. > > http://www.freedesktop.org/software/systemd/man/systemd.device.html > > I was thinking about udev, too, but I don't think there's any way to have > something auto-unmount. But I'm overcomplicating things. In my system, the > only accesses made to this external flash drive are in response to a user > command. So the simpler solution is just to have my application mount and > unmount the drive, instead of trying to get the operating system to do it. > > -- > > Ciao, Paul D. DeRocco > Paulmailto:pdero...@ix.netcom.com > > ___ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/systemd-devel > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to automount
> From: Mantas Mikulenas [mailto:graw...@gmail.com] > > > I don't think there's any way to have something auto-unmount > > There certainly is - udev has been unmounting unplugged > drives for many years. It's done by default. Sure, you can get it to unmount after you've removed it, but that's too late if you haven't synced it. You have to do an explicit sync in advance to avoid data loss. The only alternative is to disable write buffering, which makes things slow, and stresses the drive. In my case, it's better to mount and unmount explicitly around each user-requested operation. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] RFC: removing initctl support
Heya! Since a long time systemd has been shipping with two-way compat support for /dev/initctl, and I am tempted to remove it. Before I do so, I'd like some input on the relevance of this interface: a) there's support in systemctl to reboot the system by sending the right bytes to /dev/initctl as fallback, so that you can reboot a sysvinit system with "systemctl reboot". b) There's a mini-daemon "systemd-initctl.service" that is fifo-activated on /dev/initctl, and forwards reboot requests from old sysvinit clients to systemd. Both of this was supposed to help transition between sysvinit and systemd systems: if you mix sysvinit clients with a systemd init system and vice versa, you can still use the the tools to reboot the other system. I'd claim the interface is borderline useless: the only operation you can actually readlly properly dispatch with it is rebooting, and reloading PID1. And that's pretty much it. We never even really used this stuff on Fedora properly (since we actually transitioned from Upstart, not sysvinit, and we never had the same level of compat for that...). This code has been bitrotting for a while, and nobody really cared. And most importantly: the entire protocol use by sysvinit via /dev/initctl is deeply flawed, since it sends messages over /dev/initctl that are not a divisor of PIPE_SIZE in length. Thus, if PID 1 didn't read messages quick enough the messages queued could be half-written and be partially interleaved with another client's messages, and there is no way the system can ever recover from that. Thus, I'd really like to kill this. Does anybody care about it, and can give me a strong enough reason to keep this anyway? (Note that this is not about removing support for any other sysvinit compat, only really about /dev/initctl. Specifically, support for commands like "init q" is completely independent of this, and is supported fine inside of systemctl, and requires no /dev/initctl or anything). Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to automount
On Tue, Sep 22, 2015 at 7:38 AM, Paul D. DeRoccowrote: > > From: Mantas Mikulenas [mailto:graw...@gmail.com] > > > > > I don't think there's any way to have something auto-unmount > > > > There certainly is - udev has been unmounting unplugged > > drives for many years. It's done by default. > > Sure, you can get it to unmount after you've removed it, but that's too > late if you haven't synced it. You have to do an explicit sync in advance > Well you said: > and unmounted when I unplug it. Are you asking the OS to be prescient? > to avoid data loss. The only alternative is to disable write buffering, > which makes things slow, and stresses the drive. > No, that's not the only alternative – making the OS flush data more often is another, e.g. as Windows does (every 2s), and AFAIK Linux has also started doing so somewhere in the 3.x series. -- Mantas Mikulėnas ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Implicit unit dependency on slice might be too weak ?
Hi, If a unit depends on a slice, a Wants=machine.slice is automatically added to the unit constraints. Why is "Requires=machine.slice" not prefered instead ? Thanks. -- Francis ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Fix: Cannot call sd_pid_notify_with_fds with valid pid
On Sat, 19.09.15 18:54, Benjamin Robin (d...@benjarobin.fr) wrote: > The tool called this way: "systemd-notify --pid=$$" is not working > > When calling sd_pid_notify* functions with a valid pid (pid != 0), > the sendmsg failed. > The msg_controllen is invalid, because CMSG_SPACE(0) is not equal to > 0. This already has been fixed in git a few days ago: a5bd3c32abb00ad945282568fd1a97c180b68047 > if (n_fds > 0 || have_pid) { > -msghdr.msg_controllen = CMSG_SPACE(sizeof(int) * n_fds) + > -CMSG_SPACE(sizeof(struct ucred) * > have_pid); > +if (n_fds > 0) { > +msghdr.msg_controllen += CMSG_SPACE(sizeof(int) * > n_fds); > +} > +if (have_pid) { > +msghdr.msg_controllen += CMSG_SPACE(sizeof(struct > ucred)); > +} Just for the sake of review: one-line if blocks without the brackets please, see CODING_STYLE. Thanks, Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to turn off some network interface?
Hi On Sun, Sep 13, 2015 at 1:40 PM, Reindl Haraldwrote: > > > Am 13.09.2015 um 13:28 schrieb Rosen, Rami: >> >> What do you mean by stopping networkd, can you elaborate a bit about what >> you want to achieve? >> >> If you want to stop the service, simply run >> "systemctl stop systemd-networkd". >> >> The after that ifconfig command, it won't start. >> >> If you want to disable one network interface (let's say eth0), >> then go to the proper configuration file under >> /etc/systemd/networkd and comment/disable it, and >> restart the networkd service by: >> >> systemctl restart systemd-networkd > > > well, that's a little unfortune compared to a setup not using > systemd-networkd where you can *temporary* disable interfaces just with > "ifdown lan4" without changing a configuration > > the point is *temporary*, changing the config means it would be disabled at > the next boot too, on a machine acting as router/switch temporary disable > interfaces makes a lot of sense to disconnect a client from the network Just modify your .network files and restart networkd. It will adapt to the new configurations at runtime. Proper runtime-management via networkctl is planned, but no-one implemented it yet. Thanks David ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Implicit unit dependency on slice might be too weak ?
Hi On Mon, Sep 21, 2015 at 4:50 PM, Francis Moreauwrote: > Hi, > > If a unit depends on a slice, a Wants=machine.slice is automatically > added to the unit constraints. > > Why is "Requires=machine.slice" not prefered instead ? Usually "Wants=" is preferred as it makes the units more fail-safe. Especially for slices, I cannot see why "Requires=" would be beneficial. If a specific unit needs this, a simple "Requires=foobar.slice" gets you what you want. Thanks David ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] "StopWhenUnneeded"-like option for socket-activated services?
Hi On Thu, Sep 17, 2015 at 1:02 PM, Laércio de Sousawrote: > Hi there! > > I have a curiosity: is there some way to systemd to detect when all > connections to a given socket are closed, so that the service assigned to > that socket unit can be automatically stopped (but the socket unit itself > keeps listening)? Something similar to StopWhenUnneeded option, which makes > a service stop automatically when its dependants have stopped. If your service is socket-activated, you should be able to shutdown via sd_notify(false, "STOPPING=1") on idle. This way, systemd will restart your unit on the next incoming connection. Thanks David > My practical example: I'm trying new possibilities with my single-GPU > multi-seat setup (a bare Xorg server spanning all video outputs, on top of > which a Xephyr instance is started for each output/seat). My current system > starts a socket-activated systemd service for the bare Xorg when my LightDM > starts its first Xephyr instance. I would like to stop the bare Xorg service > when all Xephyr-based seats are removed (e.g. their master devices are > unplugged or LightDM service is stopped). > > Thanks in advance! ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to turn off some network interface?
Hi On Sun, Sep 13, 2015 at 10:55 AM, Manuel Reimerwrote: > Hello, > > it seems to be impossible to just stop networkd (keeps starting itself > again). > > If I use "ifconfig" to turn off one NIC, then networkd immediately restarts > it. > > What do I have to do to gain back control over my network interfaces? I want > to be able to turn off one interface. Why do you use networkd at all? Just disable it via `systemctl disable systemd-networkd`. Thanks David ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how-to run instantiated units from templates one after the other
Hi On Fri, Sep 18, 2015 at 8:34 PM, Dmitry Karpovwrote: > I have a template for creating the backup: > > backup@.service > > [Unit] > > Description=Instance %i > > [Service] > > ExecStart=/bin/sh -c "echo do backup job for %i" > > [Install] > > WantedBy=maintenance.target > > and some target: > > maintenance.target > > [Unit] > > Description=target for maintenance > > StopWhenUnneeded=yes > > As can be seen, instances from backup@ start with maintenance.target. But > they run in parallel. > > There is some way to run them one after the other? > > I thought that specifying Conflicts=backup@*.service in the template should > lead to this, but it is not. Wildmasks are not supported. Furthermore, your logic would make the unit conflict with itself, which I doubt is what you want. You should implement such logic in your own tool instead of pushing it into unit-files. For instance, if you don't need parallelism, why use multiple units at all? Just make a single unit iterate over all devices. Thanks David ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to turn off some network interface?
Am 21.09.2015 um 19:40 schrieb David Herrmann: On Sun, Sep 13, 2015 at 1:40 PM, Reindl Haraldwrote: Am 13.09.2015 um 13:28 schrieb Rosen, Rami: What do you mean by stopping networkd, can you elaborate a bit about what you want to achieve? If you want to stop the service, simply run "systemctl stop systemd-networkd". The after that ifconfig command, it won't start. If you want to disable one network interface (let's say eth0), then go to the proper configuration file under /etc/systemd/networkd and comment/disable it, and restart the networkd service by: systemctl restart systemd-networkd well, that's a little unfortune compared to a setup not using systemd-networkd where you can *temporary* disable interfaces just with "ifdown lan4" without changing a configuration the point is *temporary*, changing the config means it would be disabled at the next boot too, on a machine acting as router/switch temporary disable interfaces makes a lot of sense to disconnect a client from the network Just modify your .network files and restart networkd. It will adapt to the new configurations at runtime. that response makes no sense when we talk about *temporary* without touch configuration files Proper runtime-management via networkctl is planned, but no-one implemented it yet hence the response above makes no sense signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to turn off some network interface?
Am 21.09.2015 um 19:39 schrieb David Herrmann: On Sun, Sep 13, 2015 at 10:55 AM, Manuel Reimerwrote: Hello, it seems to be impossible to just stop networkd (keeps starting itself again). If I use "ifconfig" to turn off one NIC, then networkd immediately restarts it. What do I have to do to gain back control over my network interfaces? I want to be able to turn off one interface. Why do you use networkd at all? Just disable it via `systemctl disable systemd-networkd` in the systemd-world you need to *mask* stuff instead just disable, i had networkd also running on machines nobody asked for it and the OP said already "keeps starting itself again" after you mask stuff you need to find a way to silent logging about things which are unneded, unwanted and hence masked signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] systemd-notify: Always pass a valid pid to sd_pid_notify
On Sat, 19.09.15 23:46, Benjamin Robin (d...@benjarobin.fr) wrote: > If the option --pid was used, take the pid from this option, unless take > the parend pid. Using 0 as pid (ucred of systemd-notify) will result 99% of > the > time in a failure with this error: "Cannot find unit for notify message of > PID" > > Shouldn't we use always the ppid, since the MAINPID is something > else ? Unless the user specifies --pid= we should not declare anything the main PID, hence we should not implicilty add MAINPID=. > > Signed-off-by: Benjamin RobinMerged via github: https://github.com/systemd/systemd/pull/1315 BTW: we do not user S-o-b, that's a kernel thing. Merged anyway with this, but please do not add this in future patches. > --- > src/notify/notify.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/notify/notify.c b/src/notify/notify.c > index c920b29..ff8fa03 100644 > --- a/src/notify/notify.c > +++ b/src/notify/notify.c > @@ -191,7 +191,7 @@ int main(int argc, char* argv[]) { > goto finish; > } > > -r = sd_pid_notify(arg_pid, false, n); > +r = sd_pid_notify(arg_pid ? arg_pid : getppid(), false, n); > if (r < 0) { > log_error_errno(r, "Failed to notify init system: %m"); > goto finish; > -- > 2.5.3 > > ___ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/systemd-devel Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how-to run instantiated units from templates one after the other
I have a similar problem, but from what I can tell with the current templates this is not possible. I ended up using an internal script that would loop over the process. On 09/18/2015 02:34 PM, Dmitry Karpov wrote: I have a template for creating the backup: backup@.service [Unit] Description=Instance %i [Service] ExecStart=/bin/sh -c "echo do backup job for %i" [Install] WantedBy=maintenance.target and some target: maintenance.target [Unit] Description=target for maintenance StopWhenUnneeded=yes As can be seen, instances from backup@ start with maintenance.target. But they run in parallel. There is some way to run them one after the other? I thought that specifying Conflicts=backup@*.service in the template should lead to this, but it is not. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to automount
> From: Umut Tezduyar Lindskog [mailto:u...@tezduyar.com] > > I am not sure if automount is really the right way to go. In the end, > your automount path will fail if your device is not plugged in. A little experimenting showed you're right. > You could always use udev rules (ENV{SYSTEMD_WANTS}='media-ext.mount') > to mount the volume. > http://www.freedesktop.org/software/systemd/man/systemd.device.html I was thinking about udev, too, but I don't think there's any way to have something auto-unmount. But I'm overcomplicating things. In my system, the only accesses made to this external flash drive are in response to a user command. So the simpler solution is just to have my application mount and unmount the drive, instead of trying to get the operating system to do it. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to turn off some network interface?
Hi On Mon, Sep 21, 2015 at 7:52 PM, Reindl Haraldwrote: > > Am 21.09.2015 um 19:39 schrieb David Herrmann: >> >> On Sun, Sep 13, 2015 at 10:55 AM, Manuel Reimer >> wrote: >>> >>> Hello, >>> >>> it seems to be impossible to just stop networkd (keeps starting itself >>> again). >>> >>> If I use "ifconfig" to turn off one NIC, then networkd immediately >>> restarts >>> it. >>> >>> What do I have to do to gain back control over my network interfaces? I >>> want >>> to be able to turn off one interface. >> >> >> Why do you use networkd at all? Just disable it via `systemctl disable >> systemd-networkd` > > > in the systemd-world you need to *mask* stuff instead just disable, i had > networkd also running on machines nobody asked for it and the OP said > already "keeps starting itself again" Figure out what's pulling it in and disable it. Thanks David ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Incorrect use return value of mount_one in mount_setup_early/mount_setup?
Hi On Tue, Sep 15, 2015 at 3:37 AM, cee1wrote: > Hi all, > > mount_one will return 1 if a mount action is performed; 0 for no mount > performed; and <0 for an error occurred. Right? > > In mount_setup, we have the following logic: > """ > for (i = 0; i < ELEMENTSOF(mount_table); i ++) { > int j; > > j = mount_one(mount_table + i, loaded_policy); > > if (r == 0) > r = j; > > } > > if (r < 0) > return r; > """ > > That means the first non-zero return value determines the return value > of mount_setup - If a mount is performed successfully in > mount_one(which set r to 1), an error in next call of mount_one will > *NOT* be detected(since r == 1). Is this the expected behavior? Looks wrong, indeed. But note that if one of those mounts fails, something is seriously wrong (and already logged earlier). It sounds unlikely this ever happens. Anyway, I wrote a short patch for this: https://github.com/systemd/systemd/pull/1323 (Please continue discussion on github) Thanks David ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to turn off some network interface?
Am 21.09.2015 um 20:23 schrieb David Herrmann: On Mon, Sep 21, 2015 at 7:52 PM, Reindl Haraldwrote: Why do you use networkd at all? Just disable it via `systemctl disable systemd-networkd` in the systemd-world you need to *mask* stuff instead just disable, i had networkd also running on machines nobody asked for it and the OP said already "keeps starting itself again" Figure out what's pulling it in and disable it then figure out what is pulling "udisks", "networkmanager", "colord" and disable it on a ordianry, stripped down Fedora 22 setup with KDE i tell you something to save your time: you can't signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel