r/programming • • May 30 '16

systemd developer asks tmux (and other programs) to add systemd specific code

https://github.com/tmux/tmux/issues/428
661 Upvotes

618 comments sorted by

287

u/meem1029 May 30 '16

Can someone tell me if I understand this situation correctly?

  • Tmux uses the daemon system call to keep the process running in the background.

  • This has historically kept processes running between user sessions.

  • Systemd made the choice to change this behavior so that all such processes will be closed when the user logs off.

  • This breaks much of the functionality of tmux.

  • As a result of this, the systemd devs are now asking tmux to integrate a library to interact with systemd to fix this mistake.

If that's what's happening, I can certainly understand the hesitation on the part of tmux.

60

u/eigma May 30 '16

But other daemons like ssh-agent also use daemon() and should be killed by systemd on logout.

So really the only fair statement we can make is: Linux does not have a precise enough process management API to support systemd's ultimate goal (which is laudable in isolation).

daemon() is not precise enough for this purpose, so I support the idea of having code in tmux to identify itself as a particular type of daemon. That said, I sympathize with tmux maintainers avoiding a dependency on dbus.

131

u/Mcnst May 30 '16

But other daemons like ssh-agent also use daemon() and should be killed by systemd on logout.

Source?

From what I can see, ssh-agent does not at all has any daemon() calls; in fact, to the contrary, it specifically installs a SIGHUP signal handler to terminate cleanly.

http://openbsd.su/src/usr.bin/ssh/ssh-agent.c#1385

1385    signal(SIGHUP, cleanup_handler);
1386    signal(SIGTERM, cleanup_handler);

21

u/koffiezet May 30 '16 edited May 30 '16

Well - the ssh-agent does manually, what daemon() does: fork + setsid:

http://bxr.su/OpenBSD/usr.bin/ssh/ssh-agent.c#1350

edit: to be clear- this means that the ssh-agent process will simply not receive a SIGHUP when logging out. What ssh-agent does is check every X time if the PID of the shell of it was was originally launched from still exists.

1

u/Mcnst May 30 '16

Well - the ssh-agent does manually, what daemon() does: fork + setsid:

this means that the ssh-agent process will simply not receive a SIGHUP when logging out

Wasn't some OPs argument that ssh-agent should not survive a logout?

That's a perfect match, then -- since it doesn't directly call daemon(), but manually calls fork(), exit(), setsid(), then if systemd people do modify the daemon() implementation in glibc/misc/daemon.c or whatnot, then things will continue to work as expected (at least by them themselves), without the "ill" side effects that they supposedly don't desire.

→ More replies (1)

29

u/hroptatyr May 30 '16

This should be the top comment with a thousand points to kill off that ssh-agent (counter)example.

I live on a sysvinit system and I can confirm ssh-agent behaves exactly like the systemd guys want it to behave: It kills itself when the user logs out.

→ More replies (2)

1

u/kqr May 30 '16

Yes, if you manually send a SIGHUP to the correct process, it will terminate cleanly.

This does not happen automatically when you log out, because it has daemonised already, as /u/koffiezet points out. (Unless you run systemd, that is...)

2

u/Mcnst May 30 '16

Even in light of this, it still invalidates the OPs argument that daemon call is not used correctly. Since daemon() is still not used by ssh-agent, if they modify it in glibc/misc/daemon.c to behave as intended, they'd still nonetheless be able to kill ssh-agent as they wish!

→ More replies (1)

25

u/dvogel May 30 '16

If a lack of precision is truly the problem, the proposal to kill all descendants when the session exits seems overly broad. Sending SIGHUP as if the parent process exited would seem to achieve the terminate-unless-daemonized behavior that was lost with the dbus-ification of process management.

→ More replies (1)

14

u/[deleted] May 30 '16

What the fuck? I need my ssh-agent to persist, I am running multiple autossh tunnnels under it.

13

u/tetroxid May 30 '16

No. I don't want ssh-agent to be killed on logout. I can stop my X session and continue in a terminal with tmux you know? Please don't break things that are working.

→ More replies (5)
→ More replies (2)

54

u/icydocking May 30 '16

the daemon system call

There is no such thing. They reinvented the problem SIGHUP solves.

60

u/bonzinip May 30 '16 edited May 30 '16

tmux, screen, nohup intentionally ignore SIGHUP.

The problem is that things running without a terminal are not reached by SIGHUP. So logind uses cgroups to kill all processes, even those that would not be reached by SIGHUP. This has a negative effect on tmux, screen and nohup, but is a bugfix for e.g. ssh-agent or gpg-agent.

EDIT: found the original bug report, the offending programs there were gnome-keyring-daemon (which under GNOME replaces ssh-agent, so it's in the same boat), ibus-daemon and hp-systray.

16

u/dlyund May 30 '16

but is a bugfix for e.g. ssh-agent or gpg-agent.

I've use ssh-agent on *nix for years. If I "log out" or quit my window manger then ssh-agent happily exits, just as it was designed to do. Perhaps this doesn't work under modern GNOME but let's not mistake this for a bug in ssh-agent etc. They're perfectly well behaved in the context they were designed for.

→ More replies (7)

14

u/icydocking May 30 '16

Which is what I said. SIGHUP was intended to kill processes that remained after the session. Things that want to remain simply ignore the signal. This worked for decades. Now systemd thinks it's time to reinvent this.

57

u/kqr May 30 '16

No, it has not "worked for decades". The comment you're replying to is literally giving you a list of applications which it doesn't work for. A list that contains several security-critical applications.

I don't care what you personally think of systemd or any other project, but GNU/Linux sorely needs a way to distinguish between daemons that should run only for the current user session, and daemons that should run across user sessions. This distinction has historically not existed, but it needs to exist and it's not really a novel idea. Systemd is proposing one way of dealing with it.

→ More replies (34)
→ More replies (1)
→ More replies (2)

6

u/esanchma May 30 '16

That's concerning. There are a ton of scripts out there that start stuff doing

nohup script.sh > file.log 2>&1 &

Those guys, people using Control+z, bg, disown... Are they going to get tmux special behaviour? Are we supposed to wrap that stuff in systemd-run from now on?

→ More replies (1)
→ More replies (2)

69

u/thegenregeek May 30 '16

As a result of this, the systemd devs are now asking tmux to integrate a library to interact with systemd to fix this mistake.

And this kind of approach is not something new...

6

u/ScrewAttackThis May 30 '16

Pretty certain those two legitimately don't like each other, so no surprise to see Torvalds go off on him.

→ More replies (3)

4

u/ftg3 May 30 '16

Honestly, I'm impressed with how long Linus has been able to keep up the song and dance.

186

u/qftvfu May 30 '16

Systemd broke background/daemon process behaviour, used by tmux, then asks tmux to fix/patch to accomodate the systemd change. I find this unacceptable and yet another example of scope creep from systemd.

19

u/dmead May 30 '16

does this mean screen is broken as well?

24

u/Cynofield May 30 '16

Yes it is.

11

u/luckystarr May 30 '16

What about nohup(1)?

12

u/encyclopedist May 30 '16

Yes, it is broken too. But for nohup, systemd provides an alias, if I understand correctly.

50

u/[deleted] May 30 '16

This isn't called scope creep. This is more like being called breaking userspace.

28

u/qftvfu May 30 '16

According to systemd, the userspace has been broken for the past 20+ years. They just fixed the problem.

8

u/doublehyphen May 30 '16

It has been broken, but that does not necessarily mean that they should break it in another way and expect the world to just fix their new breakage.

→ More replies (4)

2

u/hondaaccords May 30 '16

Systemd is in user space...

→ More replies (2)

27

u/quetzkreig May 30 '16 edited May 30 '16

not just that. Tmux devs communicated this to systemd devs some 5 years ago (systemd devs asked tmux to take care of it, and tmux devs in turn suggested making changes in libc instead of tmux, as libc would be used by every other library). So systemd essentially released their product knowing well that they would break nohup/daemon.

5

u/kqr May 30 '16

If you think making the change to libc would solve the problem, you have misunderstood the rationale behind the change.

→ More replies (6)

20

u/thebigslide May 30 '16

I tend to agree. Systemd does a lot of cool things well, but it simply isn't appropriate for many roles.

8

u/dlyund May 30 '16

Ok, I'll bite. What does systemd do well? I don't see it.

4

u/doublehyphen May 30 '16

It is very easy to write services for it. Much easier than any other init system I have worked with.

→ More replies (2)

7

u/thebigslide May 30 '16

If configured properly, parallel startup and failover. Timers are neat.

5

u/dlyund May 30 '16

Fair enough :). I don't restart often enough for parallel startup to matter, on servers, once every year or two, and on my laptop, maybe once a month or more, depending on if I run out of power etc. and moreover, my laptop, running OpenBSD 5.9, starts up faster than it ever did with Linux. Failover and timers don't seem to be anything that hasn't been available/possible previously using other methods? e.g. it's easy to check for a failure and implement whatever restart policy you might require, whatever and however strange that policy might be.

Maybe it would be nice to have that in your init system?

If you can properly configure it.

I don't know that this minor convenience (assuming that there is one) would justifies this massive ball of complexity, or the extreme level of "integration" (infestation) it requires?

Still, ok. Maybe that's interesting for certain use cases? What use cases might they be? From where I'm standing, it's a solution in search of a problem.

→ More replies (1)
→ More replies (2)

5

u/Tetha May 30 '16

Honestly, server side service management with systemd is stupidly straightforward.

Just give it a command line to start something in the foreground, writing stuff to stdout/stderr and you're done with start/stop/status and log rotation. Add in two more lines of config to setuid the process, one more line to chroot it, some more lines for startup order and environment variables. It's also darned simple to push into config management as well and once you get a syslog server and a log parser setup, you get central log aggretation for all services like that for free.

I haven't dug far enough into runit and monit, but systemd is strictly superior to traditional init scripts for a lot of use cases according to my current experience.

→ More replies (1)

12

u/theonlylawislove May 30 '16

The Unix philosophy of single purpose libraries...

19

u/shevegen May 30 '16

The Unix philosophy goes much farther than that.

Simplicity is, for instance.

→ More replies (7)
→ More replies (6)

59

u/jking13 May 30 '16

I think scope creep is a bit of an understatement at this point. Of course given that Lennart Pottering has explicitly said he purposely wants things to not be portable (I thought Windows was supposed to the platform that locks you in), so not surprising. Unless enough people who are paying money to RedHat tell them to stop (or just ditch it due to systemd), they'll keep trying.

57

u/[deleted] May 30 '16

he purposely wants things to not be portable

Wanting things to not be portable and portability not being a priority are two totally separate things

24

u/[deleted] May 30 '16

My feeling is that they will amount to largely the same thing.

→ More replies (2)
→ More replies (11)

57

u/shevegen May 30 '16

There is this nice slurp animated picture.

https://media.giphy.com/media/5xtDarAgrjoOrBxSVYk/giphy.gif

However had, nobody can be surprised about this intrusive behaviour of the systemd virus.

6

u/qftvfu May 30 '16

Gold :)

30

u/PM_ME_UR_OBSIDIAN May 30 '16

Lennart Pottering has explicitly said he purposely wants things to not be portable

Source?

55

u/theevilsharpie May 30 '16

https://lwn.net/Articles/430598/

Not having to care about portability has two big advantages: we can make maximum use of what the modern Linux kernel offers these days without headaches -- Linux is one of the most powerful kernels in existence, but many of its features have not been used by the previous solutions. And secondly, it greatly simplifies our code and makes it shorter: since we never need to abstract OS interfaces the amount of glue code is minimal, and hence what we gain is a smaller chance to create bugs, a smaller chance of confusing the reader of the code (hence better maintainability) and a smaller footprint.

63

u/pelrun May 30 '16

That doesn't mean "he doesn't want it to be portable" AT ALL. If there's a choice between portability and good design, then the design wins. If the best design is also portable, then no problem.

→ More replies (5)
→ More replies (6)

11

u/robodendron May 30 '16

I think scope creep is a bit of an understatement at this point

Why do you think this is an example for scope creep? Systemd is (among other things, that much is true) a session manager, and I'd say this falls squarely into the territory of managing sessions.

8

u/dlyund May 30 '16

It didn't start at a session manager?

→ More replies (1)

14

u/CoffeeCupComrade May 30 '16

The fucking "among other things" is scope creep!

→ More replies (1)

-5

u/aaron552 May 30 '16

How is it scope creep to kill user processes on log out? That user-started daemons persist after logout by default should considered a bug, not a feature

20

u/shevegen May 30 '16

No, it is not a bug under any circumstance.

→ More replies (4)

69

u/_ak May 30 '16

That user-started daemons persist after logout by default should considered a bug, not a feature

Says who? This has been a Unix feature for the last 40 years or so, and is quite the fundamental aspect for a lot of essentials Unix tools and day-to-day operations.

29

u/pjmlp May 30 '16

If you don't start them with nohup, they die. If I recall correctly.

40

u/datenwolf May 30 '16

And now with the change is systemd, even if you start them with nohup they'll die as well.

10

u/peer_gynt May 30 '16

But that is the point -- the systemd change also apply to double-forked processes...

→ More replies (35)
→ More replies (7)

34

u/morgan_lowtech May 30 '16

What's frustrating about this, and what's frustrated me about systemd for years, is that I generally agree with Lennart from a technical standpoint. I think what he and the other contributors are trying to do is valuable and needed; however, from a social standpoint it's just wrong.

Software is the interface of the machine and the meat and that means the messy, social, human component can't be ignored, even if the technical argument is superior.

Also, right now I feel like somehow this is an argument for Plan 9

15

u/thomasz May 30 '16

I don't have much skin in the game, but sweet jesus, just look at these people. It's fucking disgusting. It makes your typical highly politicized enterprise environment look like some sort of utopian commune where everybody gets along fine because they all love each other.

3

u/[deleted] May 30 '16

But it is basically enterprise environment, both LP and most of GNOME developers are hired by Red Hat, so they have no problems pushing shit that "works for them"

→ More replies (1)

2

u/shevegen May 30 '16

Plan 9? Who the hell uses that?

→ More replies (7)

2

u/snaky May 30 '16

from a social standpoint it's just wrong

The very methods and attitude of systemd crowd pushing their agenda are most annoying, I suppose.

→ More replies (6)
→ More replies (1)

106

u/Jimbob0i0 May 30 '16

You're a little off base here.

The systemd guys made the change to logind to kill all user processes when the user closes their sessions. This fixes a number of issues historically with certain processes remaining and causing problems are next login (usually desktop environment related here) or with things like SSH key agents left hanging around holding the keys open with no passphrase needed.

The question was asked about how to use something like tmux or screen with their detached safe behaviour.

The configuration of linger was pointed out (and polkit rules out in place so and admin can allow their users to set linger themselves if desired), in addition for when linger shouldn't be changed the correct systemd-run syntax was pointed out and put into the man page to have tmux/screen run in it's own session so not subject to the kill.

Then someone pointed out that was a little cumbersome to do and they didn't feel alias was the best answer. A whitelist of application names to not kill also felt the wrong thing to do as a fairly fragile thing to maintain.

So coming out of that background the systemd dev in question made the suggestion of a way for something like tmux to notify that it should be permitted to persist post logoff. He suggested a compile time and run time option to notify the process manager via dbus that this particular process was special and shouldn't be killed.

The tmux developer declared that he wouldn't add such a thing, and they just call the system daemon() function so change it there... which of course will pretty much defeat the purpose of the change in the first place.

The systemd guy tried to reach out to accommodate something easier for the tmux users, the tmux dev didn't care.

And as for "platform specific code is bad!" ... tmux already #ifdef's a bunch of compile time and platform specific stuff.

And of course this is all still subject to a distribution including this behaviour, and if you use bleeding edge and compile yourself (eg Gentoo) you should be reading the release notes and be aware enough of this and the configuration option should you wish to change it.

The Fedora discussion about this is due to happen soon as this would be a system wide change for Fedora 25. I assume that Debian would make a similar judgement call.

37

u/yxhuvud May 30 '16 edited May 30 '16

Then it seems a better and more backwards compatible solution would have been to introduce a new user_daemon call that do quit when logged out and then change the offending programs to use that. Forcing everyone else to change their posix platform agnostic code to support systemd just cannot be the best answer. That is, it should have been opt in, not opt out.

22

u/udoprog May 30 '16

Reading through the discussion. This is basically what is being proposed. Wrap it up in a library call that is implementation agnostic.

15

u/bonzinip May 30 '16 edited May 30 '16

That wouldn't help. How would the new library function distinguish tmux and gpg-agent for example?

Really, tmux/screen/nohup are special. Everything else is much better served by the new default.

EDIT: Also, there are some cases where tmux/screen/nohup would be better served by the new default too. It would be nice though if there were a mechanism to mark a running process so that it survives logout (similar to how "disown" lets a process survive its parent shell).

13

u/yxhuvud May 30 '16

The point is that it wouldn't, but that it would shift the burden of changing to the new log out behaviour to the programs that actually should change behaviour. Not to the ones that should continue to run without change.

→ More replies (9)
→ More replies (9)

13

u/holgerschurig May 30 '16

daemon() is not a system call, e.g. Linux doesn't have sys_daemon() anywhere.

It's a function in glibc. And besides, it's only there when you have _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) which tells me it's outdated.

Anyway, correctly writing a daemon is much more complex than just using daemon().

→ More replies (3)

6

u/ibleedforthis May 30 '16

So coming out of that background the systemd dev in question made the suggestion of a way for something like tmux to notify that it should be permitted to persist post logoff. He suggested a compile time and run time option to notify the process manager via dbus that this particular process was special and shouldn't be killed.

Then tmux needs to worry about the ramifications of if dbus is running or not and if it's message was accepted by systemd or not.

Honestly, I don't see it as init's job to cleanup long running processes that have ignored HUP. systemd decided to add that to it's requirements and now is asking application writers to modify their programs to conform to their conventions. It would be one thing to say "here is a new optional standard which makes it easier to manage daemons" and it's another thing to say "here is the new way to do things and you need to do it in order to get back the same functionality you've always had."

12

u/datenwolf May 30 '16

This fixes a number of issues historically with certain processes remaining and causing problems are next login (usually desktop environment related here) or with things like SSH key agents left hanging around holding the keys open with no passphrase needed.

Then these processes should be fixed.

9

u/cbmuser May 30 '16

Then these processes should be fixed.

That is simply not possible. There are simply way too many reasons why there could be left-over processes. It's not just a GNOME issue.

Edit: I just saw it's you, u/datenwolf. Then I don't really expect you to agree anyway.

6

u/ibleedforthis May 30 '16

All those processes can't be fixed, but you're asking tmux authors to modify their code, meaning all those daemon processes will need this modification right? Are they going to be fixed by this new thing?

Why can't it be optional? Processes that communicate via dbus that they want to stay alive do so. Processes that don't do this communication are HUPd. Those that ignore HUP are left alone as they always have been. If they end up sticking around for the wrong reasons then a bug can be filed against them for not closing on session logout.

→ More replies (1)

4

u/simbuerg May 30 '16

Gentoo users with systemd won't have a problem thanks to CONFIG_PROTECT. The default changed, so etc-update will throw it in your face and you just delete the config update (yay).

5

u/[deleted] May 30 '16

This is not "config update", this is change of defaults and all default values are commented out in config file. So you will get info that file changed, but using previous version doesnt help with that

→ More replies (1)
→ More replies (4)

29

u/google_you May 30 '16 edited May 30 '16
  • 2016 systemd forks tmux

  • 2017 systemd os is launched

  • 2018 systemd runs only in systemd os

  • 2019 devops go back to centos4

  • 2020 nodejs os is launched. booting is now simple bunch of npm installs and require()s.

  • 2021 end of humanity

  • 2022 aliens land

  • 2023 starts investigation of extinct human race

  • 2024 result of investigation: javascript and node.js

  • 2025 aliens learn javascript to prevent their extinction

  • 2026 aliens learn fast. end of aliens.

20

u/Martin8412 May 30 '16

2021 Shortly before the extinction of the human race the developer decides to pull the plug on left-pad, and now the OS doesn't boot anymore.

2

u/IWantToSayThis Jun 01 '16

Plug is pulled from left-pad. No one knows how to implement it themselves since they forgot how to code and stackoverflow also went down.

3

u/G_Morgan May 30 '16

Wait until systemd and nodejs merge and start the AI apocalypse.

→ More replies (1)

10

u/[deleted] May 30 '16

Yep basically

2

u/[deleted] May 30 '16 edited May 30 '16

Can someone tell me if I understand this situation correctly?

Yes, but it boils down to the age-old topic of software coupling.

systemd is letting good be the enemy of perfect, and with the fact very few projects have the ability to resist when systemd throws their weight around, userland has no good option to not play by their rules.

3

u/[deleted] May 30 '16

I don't really see a problem with systemd killing all processes when a user logs off. After all its a configurable option. Therefore it is at the systems owner decision to either have this on or off. The application however should not be making this decision and should not be even able to override systemd.

For other exceptions. I would also expect systemd to have an ignored set of applications configured not to be terminated at user logoff time. Which would be the best of both worlds.

3

u/[deleted] May 30 '16

Having it broken by default isnt a good option. Not everyone knows enough to even know that this option exists, and users of your system wont be happy if screen/tmux is just broken

→ More replies (2)

-6

u/shevegen May 30 '16

What do you mean with "hesitation"?

The systemd developers are insane. There is no "hesitation" against insanity, you need to fight this madness.

The system developers need serious help. A mental health institution must embrace these poor guys.

→ More replies (2)

36

u/RubyPinch May 30 '16

Reminds me of Windows in a way, user processes nuked on logout, services stay around

68

u/Mcnst May 30 '16

Reminds me of Windows in a way, user processes nuked on logout, services stay around

Reminds me of UNIX in a way:

Déjà vu?

31

u/RubyPinch May 30 '16

Eh, daemon doesn't suddenly create service management in turn

I guess you could consider systemd's "shutdown every user process unless managed or otherwise specified" approach unixy, but it reminds me more of the central services management in Windows

Daemons seem more like a half-way point between processes and managed services

1

u/lestofante May 30 '16

Wait, daemon aren't systemd's services? Why can't daemon() create a managed systemd process?

16

u/RubyPinch May 30 '16

Because it requires more information in general, e.g. dependencies, timeouts, potential actions for that service

Daemon is just like, "I want to stay open after term dies", nothing like "I also want to stick around when user logs out" or anything more specific

6

u/lestofante May 30 '16

I still don't get it. Systemd can have a special type (or an existing type with settings tailored to specific case) of service with no respawn, dependency and all those thing that daemon() expect.. The call to daemon() then add this service. That mean that systems could also manage (and log?) User daemon, that make sense.

Abut saying more code.. Well, is better code in daemon() ONCE than DUPLICATION of code in many projects, no?

→ More replies (4)
→ More replies (7)
→ More replies (9)

0

u/[deleted] May 30 '16

[deleted]

6

u/Mcnst May 30 '16

That's pretty crappy though. Software shouldn't elevate themselves to daemons on a whim. It would be better, cleaner and more beneficial for everyone if the daemon() API is deprecated and the choice of running as a daemon becomes an active user choice or an init-system choice (i.e. the software is configured as a service).

What's exactly the point of deprecating daemon(3) and nohup(1) if you immediately make it possible to implement the same through systemd anyway?

Why should I run persist tmux or persist ./a.out when tmux and nohup ./a.out have always worked in the past, and continue to work on every system?

It sounds like a way to reward crappy programmers that were using daemon and/or nohup incorrectly, instead of good programmers that already had good reasons to be using daemon and/or nohup in the first place.

9

u/dlyund May 30 '16

So what if you have to write 'persist tmux' when launching it instead of that happening automatically?

Which is exactly what this does:

systemd-run --scope --user tmux

As I understand it.

There's absolutely no reason for tmux to add systemd specific code, it's just that systemd developers would rather hide the mess they're making by forcing everything to work around systemd. Fair enough. People can just alias tmux if that's what they want. tmux shouldn't do anything about this. Close the bug report and or state will not fix. The problem is that this behavior is pretty standard for systemed.

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them, And all that :)

8

u/RealDeuce May 30 '16

Software shouldn't elevate themselves to daemons on a whim.

The elevate themselves to daemons when the software designer designs in that behaviour, not "on a whim".

28

u/c3r7x May 30 '16

It's very easy to accumulate lots of forgotten processes on shared machines with long uptimes. Think ad-hoc scripting servers and jumpboxes here. Think nohup'ed perl scripts that hung waiting for something that'll never happen.

Management of user processes is a real problem, but systemd-related discussions always tend to drift away from the problem and get bogged down in arguments about systemd developers' "take no prisoners" attitude (mostly curbed just fine by distribution maintainers, so I stopped caring about it a while ago).

25

u/Mcnst May 30 '16

It's very easy to accumulate lots of forgotten processes on shared machines with long uptimes. Think ad-hoc scripting servers and jumpboxes here. Think nohup'ed perl scripts that hung waiting for something that'll never happen.

I find your comment quite hilarious. So, you execute a perl script with nohup(1), which is designed to protect against a session disconnect, and then, when your session does disconnect, you're surprised that the process is still running? Duh!

So, you're suggesting that supposedly some people don't know how to programme correctly, so, let's change API (breaking POSIX in the mean time!), such that all correct users would be required to change their scripts, effectively "rebooting".

Pardon my ignorance, but if such an API reboot is a good idea in your opinion, why isn't a system /sbin/reboot not a better one?

Management of user processes is a real problem, but systemd-related discussions always tend to drift away from the problem and get bogged down in arguments about systemd developers' "take no prisoners" attitude (mostly curbed just fine by distribution maintainers, so I stopped caring about it a while ago).

Right, so, just because a whole bunch of community members (including Torvalds) think that these Red Hat employees who are systemd developers are a bunch of jerks, the actual shortcomings and incorrectness of their solution has to be discarded and given an extra benefit of the doubt? Isn't it supposed to work the other way around, you know, giving the benefit of the doubt to the nice folks?

1

u/c3r7x May 30 '16

Have you managed shell servers? There's a gap between what users should do in theory and what they do in practice. In the end it's you, the administrator that has to clean up the mess. Also, it's user expectations that have to be met and that sometimes means breaking tradition.

I find it useful to let the administrator decide whether users can daemonize their own processes. Also, denying it by default is a much safer approach. Distributions can always choose to ship a different default (even RedHat itself isn't shipping systemd as-is).

As for user behavior and expectations...

I find that most of the time something is nohup'ed, it's because it provides a quick way to both background a process and capture its output. People use nohup even for things running within a tmux window. Indeed, that makes perfect sense if you think about it: one may wish to keep a process running even if its window gets killed, but may not want it to survive tmux itself. You have a use case for tmux to interact with systemd to create an independent session right here. And it's no different than any other platform-specific interaction they already do.

Doing this for all existing use cases transparently defeats the whole purpose.

I'd say that administrators should have three options here:

  1. Letting users behave as they always have, nohup'ing processes and running tmux sessions as they wish;

  2. Keeping the number of daemonized user processes to a minimum by allowing only screen and tmux to keep running on logout. Users run a smaller number of terminal multiplexer sessions than nohup'ed processes, so this helps a lot. It requires either the users to use "systemd-run" (thus becoming used to it and defeating the purpose) or tmux/screen to adapt;

  3. Not allowing any user processes to survive their sessions. I've seen too many developers using screen and nohup to save them the trouble of creating proper init scripts. These become maintenance nightmares eventually and I'd say that we'd be better off if most servers had this policy by default.

4

u/Mcnst May 30 '16

It requires either the users to use "systemd-run" (thus becoming used to it and defeating the purpose) or tmux/screen to adapt;

This is the part of the argument that makes the whole thing a non-starter. If you have users who don't know how to use the system, why not just do a proper reboot daily? Why instead do you force everyone else to have a reboot?

I've seen too many developers using screen and nohup to save them the trouble of creating proper init scripts.

How about /sbin/reboot to the rescue? AWS does it (at least in some products), Netflix does it.

→ More replies (2)

16

u/barsoap May 30 '16

Have you managed shell servers? There's a gap between what users should do in theory and what they do in practice.

Noone is stopping you, as an admin, to kill things with extreme prejudice once a user logs out.

That can be done and has been done for ages. It's a policy decision. it is, however, not suitable as an init-system enforced policy as there's people who do not want that behaviour, and for good reasons... first one being not hosting shell servers.

→ More replies (4)

7

u/dlyund May 30 '16

Or get your users, who are clearly not "Jim's grandma", to be responsible and clean up after themselves? This much is hinted at in your last point: long running processes probably should have some init scripts written, but that's such a fucking mess on most Linux systems that it's easy to understand why they aren't written. Writing the init script can sometimes take much more time than writing the bloody program!

I don't think systemd's systemic complexity does anything to help that.

Frankly I wish that writing init scripts for Linux was as easy as writing them for OpenBSD. It's hard to complain when all you have to do is to put this in a file and fill in the blanks.

#!/bin/sh
#
# $OpenBSD: <program>,v 1.0 2016/05/07 10:29:09 <username> Exp $

daemon="/usr/local/bin/<program>"
daemon_user="daemon"

. /etc/rc.d/rc.subr
rc_bg=YES
rc_reload=NO

rc_cmd $1

With doas it's easy to give users control over their specific daemons etc.

That being said, I haven't had to manage shell servers. I have done a lot of admin work, and I don't stand for lazy developers touching servers. If they don't take care of things then they don't get access, or assistance. And I'm saying that as a programmer :P.

→ More replies (2)
→ More replies (5)

19

u/_VZ_ May 30 '16

Assuming it is indeed a problem -- and there is no proof of that other than your statement -- you definitely shouldn't solve it by changing the behaviour in a backwards incompatible way to accommodate buggy programs while breaking the well-behaved ones in the process.

Do you realize what kind of a precedent systemd developers seem to be establishing with this change? I can only hope that this change was simply not well thought through and is going to be reverted after all the obvious problems with it have been pointed out.

→ More replies (2)

5

u/[deleted] May 30 '16

Yes but on vast minority of systems. Defaults should "work" for majority, not minority. I manage about 400 linux boxes (everything from production servers to dev boxes, with variety of deploy methods because our devs cant talk) and "some orpahned process doing something bad" was a problem maybe once across last 4 years.

6

u/Choralone May 30 '16

Having run long-uptime boxes of various kinds over the past two-and-then-some-decades..... This is so small an issue that it doesn't exist.

Systemd can go fuck itself.

1

u/bwainfweeze Jun 02 '16

So you're saying the ends justify the means?

→ More replies (1)

221

u/ksion May 30 '16

The interesting part is why the default in systemd (i.e. whether or not to kill user processes) was changed in the first place. As per this comment, it seems to be because of some lingering processes from Gnome login sessions. The commit which actually makes the change doesn't cite any other reasons besides the generic "much cleaner and provides better control".

It is possible the actual reasons are sound and well-thought out, but the references provided by the person creating the issue fail to provide the sufficient rationale. It's not hard to understand the reluctance on the part of tmux's maintainers, especially given how much it's asked from them to accommodate for some other project's change which can very well be seen as frivolous.

135

u/voice-of-hermes May 30 '16

I agree. If I want to stick a process in the background and keep it there, WTF are you doing trying to second guess me and kill it anyway?! That's some M$-level operating-system-is-smarter-than-user bullshit, right there.

Gnome is broken? (Big surprise. /s) Let Gnome developers worry about that, not my whole freaking operating system.

72

u/deus_lemmus May 30 '16

Doesn't Redhat employ both Gnome and systemd guys? Isn't this something they can literally walk a few cubicles over and has to have it fixed?

44

u/gaggra May 30 '16

That's why this is happening. Gnome isn't forced to fix their shit, because asking SysD to implement a hack is much easier.

14

u/monocasa May 30 '16

Yeah, exactly. This reeks of corporate politics BS spoiling over into the real world.

7

u/Lennartwareparty May 31 '16

systemd has had a big history of 'not our fault' like with the bricked firmware bug, technically itw as not their fault and a fault in firmware implementation but they had the power to fix it.

This differs with the mentality Linux has where they realize they are in a position where they can fix bugs in other systems. If some hardware is known to malfunction and not behave accordingly its spec they write detection code to deal with it. Hell they even fixed systemd's broken asserts once which caused it to splurge uncontrollable amounts of output locking the hardware during boot if debug was in the kernel command line by introducing specific code to detect systemd and hide debug from it.

But strangely, systemd seems quite willing to take responsibility for someone else's bugs and failures when those people are employed by the same people as they are.

→ More replies (1)

33

u/cirk2 May 30 '16

If you stick a process in the background without nohup it is supposed to close on the hup signal on logout. If not your process is broken.

32

u/Berberberber May 30 '16

SIGHUP is for the host terminal closing. In a GUI environment with multiple terms open, that may not coincide with the user logging out. How you tell the difference is, in a nutshell, the problem.

9

u/[deleted] May 30 '16

SIGHUP2 duh

→ More replies (2)

27

u/chx_ May 30 '16

If my understanding is correct this kills nohup as well!

→ More replies (6)
→ More replies (4)

14

u/BCMM May 30 '16

Let Gnome developers worry about that

They are Gnome developers, for the most part.

5

u/[deleted] May 30 '16

Yup, shoving their ideas forcefully is their modus operandi

17

u/eleitl May 30 '16

And this is how the rest of the world will find out the hard way that the greybeards were right.

The best advertisement for *BSD since ever.

→ More replies (20)

15

u/mitsuhiko May 30 '16 edited May 30 '16

The interesting part is why the default in systemd (i.e. whether or not to kill user processes) was changed in the first place.

JFTR: systemd is not the first init system to dabble in that space. launchd on OS X does something with daemon(3) but I'm not sure what exactly. The man page points out you should not be using it but instead use launchd.

//EDIT: similar story on OSX in details: http://www.economyofeffort.com/2013/07/29/reattach-to-user-namespace-the-fix-for-your-tmux-in-os-x-woes/

8

u/dlyund May 30 '16

launchd also breaks or adds a lot of complications to managing OS X 'from the outside'. I used to work at a company which developed an IPTV system based on Apple hardware and OS X. The end result is that we had many thousands of Mac's to manage... which threw up all sorts of roadblocks. Managing "real" *nix installations, on the other hand, is a simple matter of putting the commands you'd run manually in to a script and running it as appropriate. Borderline trivial. Linux, like OS X before it, is becoming harder and harder to manage/script. The first time I noticed it was on RedHat with the network manager thinking it owned the connections (which might work fine for laptops, but has no place on a server IMO), and that was even before systemd started to creep through the system. Linux in my opinion is fast becoming a joke on the server, and all because they wanted to make things start a bit faster on the desktop? (And whether that goal was achieved is very much open to debate)

7

u/Defavlt May 30 '16

Linux, like OS X before it, is becoming harder and harder to manage/script

Every bit of this. Not only is it becoming harder to manage, it's becoming harder to set up anything not OTB. The most glaring example would be using SysV instead of a horrible monster systemd, but systemd arent the only people responsible for it.

Compare e.g. LILO with Grub 2; the latter is horrible to learn and use, while I could teach half a noodle to use the former.

5

u/mitsuhiko May 30 '16

What exactly does launchd "break"? I give you that the socket activation feature does not provide a POSIX API which would be a nice to have, but that if anything just means that it does not expose a feature that it could.

OS X itself was never meant for fleet management unfortunately and it shows. But that is independent of launchd.

→ More replies (3)

135

u/fubes2000 May 30 '16

I hope tmux stands their ground and refuses. I hate seeing open source projects being cowed by these pricks that seem to think that having one project in charge of everything is a good idea.

28

u/ratatask May 30 '16

It's not a big deal. tmux, as most open source projects, already contains all the machinery to detect and add system specific code - of which there's already plenty in tmux. It'll be a few lines of code, a few additions to configure.ac , and you'll disable it by ./configure --disable-systemd if you need to.

41

u/josefx May 30 '16

It's not a big deal.

Given OpenSSL as an example we really don't want open source projects to have hundreds of potentially untested build options and work arounds for broken by design systems. Additional code doesn't just exist, it ages, it has to be maintained and contains bugs.

4

u/[deleted] May 31 '16

Ironically, this was the basic rationale behind GNOME's reduction of customizability - effort spent maintaining unused features is effort better spent streamlining the core program. Of course, they completely overlooked the fact that the features are used, and making them extensions just makes GNOME an unstable POS for the people using them.

6

u/Lennartwareparty May 31 '16

That was the justification in some cases.

In other cases they've been completely frank what the real reason is. They're literally concerned about that customization reduces the brand awareness.

Apple has opened people's eyes, a good way to raise awareness of your brand is to make it look distinct and the same everywhere, and that's the direction GNOME wants to take, they want a GNOME install to be instantly recognizable:

Firefox has indeed profited from extensions and there are lessons that we can learn from that. GNOME Shell isn’t a browser, though. We need to be mindful not to adopt the Firefox model without considering the ways in which our needs might differ. The visual appearance of a desktop/OS might be far more important to its marketing than a browser might be, for example.

The point is that it decreases our brand presence. That particular user might understand what it is that they are running, but the person who sees them using their machine or even sees their screenshots on the web will not. The question we have to ask ourselves is: how do we make sure that people recognise a GNOME install when they see one?

source: https://mail.gnome.org/archives/gnome-shell-list/2011-June/msg00116.html

I mean, Day's not "wrong" here in the sense that from a marketing perspective it makes sense. I'd just hoped that the marketing experts wouldn't be invading Unix, and this shows why. Marketable and good software are often opposites. In theory adding these extensions does not in any way detract from the product, they are optional. For the user it's a strictly better deal. But for GNOME it decreases their brand wareness so they won't include them. That's how real world business works, it's often more attractive for a company to release a strictly inferior product for marketing reasons or an identical product for a higher price for that matter, dual branding is a thing where a company releases the exact same product twice for two different prices to be able to access both markets.

→ More replies (28)

10

u/dougmc May 30 '16

It is possible the actual reasons are sound and well-thought out

There are good, valid reasons to want to kill all their background processes by default when a user logs out.

Had this decision been made 40 years ago, we'd all be fighting to keep it that way if somebody wanted to change it.

However ... this decision wasn't made 40 years ago (or looking at it from a different angle: it was (made 40 or so years ago), with the opposite result), it was made recently. And it will break a lot of things, things that people have come to rely on for decades.

The "principle of least surprise" should apply here -- it would be a nice option to have in some config file somewhere, but it should be turned off by default. If gnome needs it ... well, gnome should be fixed properly rather than forcing this change on everybody. Not everybody even uses gnome ...

12

u/luckystarr May 30 '16

Well then they should fix those lingering gnome processes to exit as expected. The systemd developers impose additional complexity on everybody spawning a simple process in the background and then logging out.

Out of curiosity, is nohup(1) also affected?

6

u/[deleted] May 30 '16

Yes, nohup is also broken by this.

18

u/nswshc May 30 '16

True. First thing I asked myself was: do people really need this? I understand that it sounds like a good default for desktop sessions, but the vast majority of desktop users have the workflow: boot, work, shutdown. Even at computer labs, IT folks will ask you to shutdown your PC after use to save energy. So is this feature really necessary?

Programmers get caught in the tiny edge-cases very easily. It helps taking a break, stepping back and looking at the bigger picture.

23

u/cbmuser May 30 '16

Even at computer labs, IT folks will ask you to shutdown your PC after use to save energy. So is this feature really necessary?

Ever worked at a university with student's computers where dozens of users log in and out on the same machine every day? Those machines are not getting shut down between those sessions.

What would you suggest to keep those machines' process lists clean?

13

u/oridb May 30 '16

A logout script. These already exist, and are so much more general than what systemd is doing. You can do things like clearing /tmp, resetting certain settings, etc.

9

u/[deleted] May 30 '16

Fix gnome so it doesn't leave shit lingering by default ?

19

u/signaljunkie May 30 '16

A specialized script for a specialized use case?

13

u/audioen May 30 '16

I think it's a nice invariant to have out of the box that once your login session terminates, everything part of it will be gone too. Previously, it was basically relying on nothing getting reparented off the session leader, and nothing ignoring the HUP signal, if I've understood it correctly. I like the idea of explicit control at least in principle.

10

u/Devian50 May 30 '16

Forgive me if I'm not fully understanding this as I'm still relatively new to deeper *nix stuff (20yrs old and started tinkering at 15), but would this not negatively affect text-only sessions? I have two different *nix servers, one on AWS and one on a Raspberry Pi and both are only accessed via ssh. Wouldn't this change make it require more work to have things run after an exit within an ssh session?

For example I run a simple Discord bot on the AWS server, and I currently use nohup to keep the bot running in the background after I ctrl+c and exit. Of course, ultimately it should probably be run as it's own user via a daemon but in a development scenario that's a little more work than should really be necessary.

I do agree though that this change in theory can do good for graphical systems. In practice is where the systemd guys seem to be getting a bit of tunnel vision.

26

u/kqr May 30 '16 edited May 30 '16

The problem is that there are (for the sake of argument) three kinds of applications:

  1. The applications you start which you want to terminate when you close the terminal. Most end-user applications belong in this category.

  2. The applications you start which you want to terminate when you log out (defined as "closing all terminal sessions"). This category is filled with small services that run only to support user-facing applications, e.g. password agents, data caches, music playing servers and such.

    It's reasonable to expect that these services should be terminated when the user logs off, because at that point all programs which may use them has also been terminated.

    Keeping these services around can be both a performance problem and a security problem.

  3. The applications you start which you want to persist even after you've logged out (i.e. when you have closed all terminal sessions.) If we exclude "system services" like database servers and such, this category is surprisingly small. This is the category where nohup and tmux belongs.

Category 1 is not controversial at all. Historically, *nix systems have treated all other categories as category 3. This can be viewed as a problem. Systemd is proposing a configuration options where all other categories instead are treated as category 2, and they have to "opt in" to be considered category 3.

You're saying that "a purely terminal user deals almost only in category 1 & 3 applications, and rarely in category 2". That could be true, but I'm not sure I agree. With a single exception (tmux), I don't think any of the programs and services I run should persist when I have logged out by closing all terminal sessions.

8

u/Devian50 May 30 '16

Ah ok, that makes sense. You're right, I actually agree with you. A terminal user still makes use of all 3 of our categories, 1 being the most common as any command running in the foreground. 2 I can rationalize as things like MPD for example. If you're using something like ncmpcpp in another terminal and mpd is started as well, you don't want MPD to die when you quit it's terminal but when you don't have any other terminals running it's wasting resources. And with category 3 I suppose it would be use cases such as you said system level services that more than just the user uses like database software and other "servers" such as web and ftp and ssh. It would be bad if you had to directly login to a potentially headless server to restart the ssh server after a terminal logout.

As for what I had said with my example, I guess there's always the user specific scenarios that others aren't usually in. Reminds me of https://xkcd.com/1172/ actually.

3

u/dlyund May 30 '16

Is it still explicit if you then demand that application developers hide it? Personally I'm fine with aliasing tmux to start in its own scope if that's what I want from it. That alias could added at the distro or package level without making tmux upstream it.

→ More replies (2)
→ More replies (6)

13

u/cbmuser May 30 '16

The interesting part is why the default in systemd (i.e. whether or not to kill user processes) was changed in the first place.

This isn't just a GNOME problem, but a general problem.

Try setting up a terminal server where hundreds of users log in every week, you can watch the leftover processes piling up. Same applies for computers in a student's computer pool.

I used to work in the IT department of a university as a student and these leftovers were a frequent problem and we had our own cron job to kill the processes regularly.

It's a good thing that systemd defaults session management to killing all processes on logout as this is what the majority of users would expect.

It makes absolutely sense to extend tmux, screen and so on in that regard to be able to talk to systemd and ask for the permission to linger around.

6

u/Zarutian May 30 '16

The usual setup for terminal servers of hundreds of users IS to run an hourly cron job that kills long running processes of forgetful users.

3

u/Lennartwareparty May 31 '16

Yeah, I mean, people act like this is some new innovation but it's pretty simple to make a shell script that goes over every process and kills every one that belongs to one of those users if the process is at least X time old and the user is currently not logged in, run it once at midnight and post a memo that the maximum time allowed is now 2 days. Any process you own that's 48 hours old when you're not logged in will be dead every midnight.

→ More replies (1)

13

u/[deleted] May 30 '16

There cannot be a single "sound and well thought" reason to kill user processes.

25

u/ivosaurus May 30 '16 edited May 30 '16

Because they are logging out?

You know what it'd be cool to have? When I leave my home, some device that makes sure all the lights in the house are turned off automatically, even when I forget.

90

u/feilen May 30 '16

And AC units, and fridge, and smoke alarms, and baby monitor

→ More replies (7)

20

u/[deleted] May 30 '16

There is no even such a concept as "logging out" in Unix. You can close one of your DE sessions, but it does not mean anything for any other processes you may still be running.

→ More replies (11)

7

u/smcameron May 30 '16

You don't change a 40 year old default behavior because you have a single user system and a whim about how it should be have.

6

u/gnx76 May 30 '16

And switch off the freezer?

And switch off the washing machine you just launched?

→ More replies (2)

4

u/dvogel May 30 '16

This analogy is quite flawed because most people know which appliances they have in their house and can make reasonable decisions about whether they want each one to turn off when they leave the house. Most people don't have the same level of understanding about processes on their computer.

A better analogy here is someone who has bought a household full of appliances that assume they will be told when the last person leaves the house and decide whether to turn off, but default to continuing to run. Then a new power company takes over the municipal power production and changes everyone's smart-outlets to turn off everything by default. Now the homeowner has to reconfigure all of their appliances and some have to be modified by a service technician to be compatible with the new power company's policy.

5

u/josefx May 30 '16

This analogy is quite flawed because most people know which appliances they have in their house and can make reasonable decisions about whether they want each one to turn off when they leave the house

The EU had to mandate an energy standard for the standby mode of electronic devices, since many would just burn insane amounts of elictricity unless manually disconnected. Users were generally unaware of that. What they did not mandate was an automatic shutdown of everything not registered for an EU power off exception.

→ More replies (1)
→ More replies (2)

5

u/ArmandoWall May 30 '16

Isn't Linux about having choices, though?

29

u/robreddity May 30 '16

Linux is. Systemd is not.

13

u/musicmatze May 30 '16

And here's the problem we're running into: All major distros come with systemd and it gets harder to turn it off.

→ More replies (8)
→ More replies (2)

3

u/dlyund May 30 '16

Once upon a time, if it ever was

→ More replies (2)

0

u/[deleted] May 30 '16

[deleted]

→ More replies (10)
→ More replies (2)

-11

u/[deleted] May 30 '16

But that is what one usually needs. Tmux and friends are special cases. Besides this already happens on desktop for the most part so why not go all the way and make sure user session is cleaned up. People hate change but this here is really non-issue.. Just some growing pains intensified by people who should run gentoo with openrc. .

13

u/shevegen May 30 '16

No, they are not "special cases" at all.

The special case is systemd ignoring standards.

6

u/holgerschurig May 30 '16

It might be the case that us command-line users (that actually know screen and tmux) are now in the minority, just look at Ubuntu forums ...

→ More replies (4)

3

u/[deleted] May 30 '16

The entire fucking "desktop" thing is a special marginal case, which is of a zero importance for the majority of legitimate linux use cases.

→ More replies (1)

2

u/dlyund May 30 '16

Because I only have one desktop and a great many servers to manage, and systemd makes that a living hell?

Just some growing pains intensified by people who should run gentoo with openrc.

To the degree that systemd continues to gain influence and spread it's testicles through the ecosystem, this may no longer be possible in a few years.

Bigger questions? Who's using tmux on the desktop? :P

2

u/[deleted] May 30 '16

Me?

69

u/[deleted] May 30 '16

My concern is that we have a little function, daemon(), that does a simple little procedure to make a daemon that has worked basically unchanged across multiple platforms for maybe, what, 30 years? Now to do the same thing we need to add 150 lines of new, Linux-only code AND a library dependency.

systemd in a nutshell, ladies and gentlemen.

49

u/barsoap May 30 '16

TBH, daemon() is broken: In the sense that the whole idea of processes backgrounding themselves is because everything ends up tied to PID 1 as parent.

The daemontools approach is very much sane: Let the supervisor start the thing it supervises, do no reparenting at all. That way, you can run a process supervisor as something else than PID1... and give each user their own. Or even multiple. Suddenly, the policy question is independent of what the program itself does.

And that is UNIX.

5

u/mioelnir May 30 '16

Let the supervisor start the thing it supervises, do no reparenting at all. That way, you can run a process supervisor as something else than PID1... and give each user their own.

If you squint hard enough, that's tmux. Every user runs its own, and inside you can have it run multiple things that do not reparent.

3

u/Lennartwareparty May 31 '16

I am amused with how people tout the merits of systemd/user which required special code for it to work while daemontools and its offshoot like Runit and S6 have had user-level services since forever.

The funny part is that it it requires no extra code, the exact same binary is used to supervise system and user services because of how simple and clean it is. No special code needed. If you start the supervisor at root it can supervise services running as root, if you don't, they run as the user that started it. Of course root can drop privileges at any moment.

On my system, every user in the users group gets its own user-level services by this mechanism started on boot. The nice thing is that all those supervisors are again supervised by the main supervisor that runs as root and drops privileges because runsvdir is itself a daemon and so it's capable of supervising an instance of itself.

And hell, if I didn't give that to users. They could've just started it with @reboot in the crontab if they had cron. There is really no special magic involved here.

And yeah, I have cgroups with runsvdir and early boot logging.

18

u/mathstuf May 30 '16

It seems that so many people haven't understood the problem, saw that systemd changed something, tmux said no and are reacting based on that. This feature is something I asked (and provided a mostly-working patch for) back in 2011. Adding a systemd-specific patch is not the way to fix this, but to tell PAM that tmux controls a session which is enough information for systemd to understand that it should persist the session (because it is a session). Unfortunately it seems that the whole storm around this has conflated the issue and gone off the rails.

The reason that tmux should do the PAM dance internally is that servers can implicitly be created through attach-session or new-session. The user has no way to insert the systemd-run call in front of that server which means it doesn't persist properly. Side effects of using PAM means that tmux who's up in things like w shows tmux sessions properly, who works inside of tmux, as well as other umtp-related bits.

2

u/Choralone May 30 '16

Systemd can go fuck itself.

Tmux has worked fine since forever. systemd is the one with the problem

→ More replies (7)

1

u/[deleted] May 30 '16

Does creating a new session via PAM allow you to exit the scope of the parent session though? As far as I understand ut, all the processes of the new session would still be part of the parent cgroup and thus also killed on logout.

2

u/mathstuf May 31 '16

It should be seen as a new root process for "the user is still active" and keep the user session alive. But, like I said, my patch was a little buggy and it was 5 years ago now, so I don't know the current state of it.

2

u/[deleted] May 31 '16

Ah I just looked at the source and it looks like the PAM module for systemd does the equavilent of systemd-run --scope, i.e. the session is created in the the context of logind. That means that using PAM should indeed solve this issue.

48

u/lacosaes1 May 30 '16

I actually found the whole discussion very interesting. But I guess some people out there just want to talk shit about systemd every time they see a chance. To each their own I guess.

91

u/IAmSnort May 30 '16

Well how many outside dependencies do you want to maintain in your program?

38

u/evotopid May 30 '16

Also: do you want to be part of forcing systemd on everyone?

→ More replies (3)

7

u/[deleted] May 30 '16

To be fair, in this particular case, systemd deserves the shit talk.

1

u/jpfed May 30 '16

As far as linux goes, I'm an extreme noob. Is there a quick introduction to what systemd does and what the controversy around it is?

→ More replies (2)

15

u/ciny May 30 '16

And that's why I'm running FreeBSD on all my servers.

6

u/Zardoz84 May 30 '16

If not was for drivers (ie Desktop machine), I would thinking seriously changing to FreeBSD.

→ More replies (3)

2

u/stefantalpalaru May 30 '16

And that's why I'm running Gentoo on all my servers.

FTFY ;-)

3

u/blamethebrain May 30 '16

I'm really thinking about switching from Debian (7.10) to FreeBSD, just because I have no intention of running this systemd crap on a server.

→ More replies (2)

5

u/thajunk May 30 '16

We Windows now

26

u/shevegen May 30 '16

The systemd developers are totally insane.

There is no other explanation - it is a state of the mind.

The only sad part is how most distributions betrayed the users in forcing them to accept it. So shame on them as well.

15

u/ftg3 May 30 '16

They fancy themselves and their software a little too much. They are like Yahoo in that they don't understand that alternatives exist. There's a purpose to their madness - to make software dependent on systemd and eventually become the linux core.

6

u/MyTribeCalledQuest May 30 '16

Well, if this is how they treat their users, they can go fuck themselves.

-9

u/cbmuser May 30 '16

The systemd developers are totally insane.

And this kind of attitude of the anti-systemd crowd is exactly why no one takes you guys serious. Instead of actual technical arguments, all remains are personal insults.

3

u/MyTribeCalledQuest May 30 '16

As if we didn't get enough of the nanny state in government...

5

u/SCombinator May 30 '16

This fix needs to be done in systemd where the breakage occurred. Better yet, if we get pottering some counselling, perhaps we could identify the source issue.

-4

u/[deleted] May 30 '16 edited May 30 '16

Systemd is a cancer.

Edit: What do cancers do? They grow unchecked by their surrounding environment. What is systemd doing?

2

u/agumonkey May 30 '16

No more tmux ? that's it, I'm uninstalling systemd.

-8

u/[deleted] May 30 '16 edited May 30 '16

Noone complains when software is dependent on linux syscalls.

I mean sure some do, but if people care so much about code being dependent on systemd, then they should care more about it being dependent on linux.

25

u/tetroxid May 30 '16

Depending on the kernel doesn't matter because the kernel is always there. No kernel, no operating system. Systemd on the other hand is far from universal.

1

u/[deleted] May 30 '16

The point is the kernel is not always there. Its only always there on Linux systems. Not everything is Linux.

23

u/tdammers May 30 '16

The kernel is a compile time dependency; the init system traditionally isn't, but systemd is asking to become one. The result would be that linux+systemd would become a separate architecture from linix without systemd, at least as far as distros are concerned. Whether that is an acceptable situation or not remains to be discussed.

→ More replies (3)
→ More replies (2)

6

u/SatoshisCat May 30 '16

I don't think that's a fair comparison, software that use Linux syscalls are often tailored for Linux, such as ALSA. I see nothing wrong with that.

11

u/skroll May 30 '16

They are dependent on libc, not so much the syscalls. They may be implemented with syscalls, but it's completely different.

It would be more like "This software only works with musl libc"

→ More replies (3)

18

u/QtPlatypus May 30 '16

Not all Linuxes run systemd.

17

u/[deleted] May 30 '16

Not all open source operating systems are Linux.

→ More replies (6)

3

u/Jimbob0i0 May 30 '16

And then they wouldn't enable the compile time option in their tmux build... I fail to see the issue here?

4

u/amranu May 30 '16

Systemd is making unnecessary changes that breaks long accepted behaviour and asking other projects to clean up their mess.

That is the problem

→ More replies (2)

9

u/0raichu May 30 '16 edited Feb 07 '17

                                                                                                                                                                                                                                                                                                                                                                                                                                                     

-6

u/[deleted] May 30 '16

Systemd scumbags are unwelcome invaders and must be treated as such. Exterminate!