News for hackers. Stuff that matters.
Re:A Thank-You Note to the Hacker News Community from Ubuntu by tie_ on Thursday April 06, 2017 @05:30PM (#14054818)
I don't like systemd for a bit more practical reasons.

For example, how do you like the fact that init now comes with "hidden" timers ? After you've scoured every place that a "traditional" Linux might put scheduled tasks, you've come to the realization "Ooooh, now my init has its own cron!". Because obviously an init system needs its own cron!

Or the subtle way it breaks existing SysV compatibility. An RPM/Deb package drops its SysV init file at /etc/init.d, and the next thing your ConfigManagement system does is try to start the service - quite standard. Bang - "Unit not found"! Why? Now on systemd-enabled flavors, you need to reload the mofo after dropping in your files. Of course Systemd could hook into dbus and run crons, but it can't be bothered to inotify or even jit-check-upon-request /etc/init.d. Because subtle breakages are cool!

How about the systemd-hostnamed service? Why on earth would we need a service to change the hostname? And why should it care about the "chasis type" of the machine?

These are just some of my own WTFs encountered during my admittedly short but language-colorful interaction with systemd. I have nothing against the Systemd unit files, but the functionality/bug scope of the whole thing is way bigger than I'd feel comfortable with!

P.S. Poettering is reportedly a townie, so I'd love to buy him a beer someday and berate him over it.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by AsyncAwait on Thursday April 06, 2017 @05:47PM (#14054957)
> For example, how do you like the fact that init now comes with "hidden" timers ? After you've scoured every place that a "traditional" Linux might put scheduled tasks, you've come to the realization "Ooooh, now my init has its own cron!"

They're not "hidden", just managed with systemctl like other services, you can still use regular cron if you'd like.

As to the rationale of including timers, it is for stuff like mounting and unmounting remote disks etc, at boot, which I personally would include under the responsibilites of a modern init system and 'system manager' in general, same with taking care of TRIM every so often etc., but I appreciate that it isn't for everyone.

> Or the subtle way it breaks existing SysV compatibility.

The SysV init scripts would regurarly break in subtle ways by themselves to be honest, I find systemd a much saner option.

> How about the systemd-hostnamed service? Why on earth would we need a service to change the hostname? And why should it care about the "chasis type" of the machine?

The systemd network stack is entirely optional and intended for scenario where you can't afford/don't need the 'fatness' of NetworkManager, just because it's there, doesn't mean you have to use it.

> P.S. berate him over it.

Plenty of people already did so, over and over, but have fun, considering you'd be buying him a beer...

Re:A Thank-You Note to the Hacker News Community from Ubuntu by tie_ on Friday April 07, 2017 @02:35PM (#14062335)
> They're not "hidden", just managed with systemctl like other services.

So far in the history of nix, services have never equaled periodic tasks, to my knowledge. In that sense, it's a hidden surprise that would sooner or later bite everybody that has not been initiated in systemd. It makes things harder to debug.

> As to the rationale of including timers, it is for stuff like mounting and unmounting remote disks etc, at boot

Now do you go from that need to "and that requires an internal crond implementation in your init system". Why not atd, or regular cron, or sleeping processes? I'm genuinely curious, so if you're aware of public discussion of it, please point me in that direction.

> The SysV init scripts would regurarly break in subtle ways by themselves to be honest, I find systemd a much saner option.

I appreciate that the chaining and dependencies of SysV init were horrible. That doesn't make it OK for systemd to introduce more subtle breakages in even a very basic* usecase.

> The systemd network stack is entirely optional and intended for scenario where you can't afford/don't need the 'fatness' of NetworkManager

In the scenario where you do not need NetworkManager/GUI hostnamed would be quite worthless as well. /etc/hostname and the `hostname` command are more than enough to handle that case, thank you.

I guess my main issue with systemd is that it introduces (mostly?) unnecessary complexity, which makes me waste more time debugging problems. Of course it is better than SysV init, and I'm very happy with the syntax of system files. Yet, upstart showed that you can have those niceties without an excess of complexity.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by mdekkers on Friday April 07, 2017 @11:52AM (#14060697)
As to the rationale of including timers, it is for stuff like mounting and unmounting remote disks etc

The implementation is retarded. Last week my providers' iSCSI fabric suffered a glitch, which hosed a whole bunch of servers for hours because systemd refused to boot when it found the volumes not present. These were in no way critical to the operation of the stack. However, some moron somewhere decided that locking the system for 5 minutes on boot, and then simply refusing to boot properly, when everything required to boot is actually in place and OK is the correct course of action. I have enough of that kind of deranged thinking to deal with coming from Windows, I don't need it from my Linux machines.

Systemd sucks for servers. It might do a lot of nice fancy tech stuff, but it is extremely poorly thought out for use on the server.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by AsyncAwait on Friday April 07, 2017 @12:22PM (#14061019)
> systemd refused to boot when it found the volumes not present

This is not normal systemd behaviour, it waits for the resource, but only 1min 30s by default and then continues booting, (unless the services are considered critical for reaching certain target), logging a failed service, someone must have therefore explicitly configured a custom behaviour in your situation.

> The implementation is retarded.

May be, or may be whoever configured the server this way is, who knows?

> I have enough of that kind of deranged thinking to deal with coming from Windows

As I said above, this is not standard systemd behaviour.

I am not saying that systemd is perfect, but your case seems like misconfiguration, rather than "deranged thinking" from the systemd devs.

I'l encarouge you to read more on its configuration, it's actually fairly flexible, this[1] is a solid starting point.

1 - https://wiki.archlinux.org/index.php/systemd

Re:A Thank-You Note to the Hacker News Community from Ubuntu by kasabali on Wednesday April 19, 2017 @05:35AM (#14146546)
Bailing out and dropping to the rescue shell when a mount point in /etc/fstab failed is DEFINITELY the normal systemd behavior.One has to mark it as nofail otherwise systemd will assume it is required for boring the system.

(this was originally meant as a reply to above comment was mistakenly posted to grandparent.)

Re:A Thank-You Note to the Hacker News Community from Ubuntu by mdekkers on Friday April 07, 2017 @02:12PM (#14062136)
Standard Ubuntu 16.04. From my reading, it waits 90 seconds, then some more, and then even more.
Re:A Thank-You Note to the Hacker News Community from Ubuntu by AsyncAwait on Friday April 07, 2017 @02:34PM (#14062330)
Not the case on Arch, but you can customize timeout anyway[1], using TimeoutSec, TimeoutStartSec and TimeoutStoptSec, or even the global setting[2].

1 - https://www.freedesktop.org/software/systemd/man/systemd.ser...

2 - http://stackoverflow.com/questions/33776937/how-to-change-th...

Re:A Thank-You Note to the Hacker News Community from Ubuntu by kasabali on Friday April 07, 2017 @04:05PM (#14063091)
Bailing out and dropping to the rescue shell when a mount point in /etc/fstab failed is FOR SURE the standard systemd behavior.One has to mark it as nofail otherwise systemd will assume it is required for boring the system.
Re:A Thank-You Note to the Hacker News Community from Ubuntu by interestingemu on Friday April 07, 2017 @07:36AM (#14058838)
> The systemd network stack is entirely optional and intended for scenario where you can't afford/don't need the 'fatness' of NetworkManager, just because it's there, doesn't mean you have to use it.

Currently.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by tetromino_ on Thursday April 06, 2017 @06:46PM (#14055415)
> How about the systemd-hostnamed service? Why on earth would we need a service to change the hostname?

If you want the hostname to be preserved across reboots, you need to save it on disk - canonically, in the /etc/hostname config file.

Since /etc/hostname is an important per-machine config file, you probably want it owned by root.

Since you may want to edit this config file from a GUI control panel of some sort that you launch from a desktop environment running under a non-root user, you need a mechanism for the control panel process to be able to change the config file.

There are several ways to accomplish this:

* run the control panel process under root (for example, using sudo). This is not a good idea, especially under X11, since GUI toolkit libraries are not security hardened, have a large attack surface thanks to various GUI IPC mechanisms, and your control panel process could be subverted by hostile processes that have been waiting in the background for just such an occasion to arise.

* put your non-root user in a group which has write access to /etc/hostname. This is the traditional Unix solution, but it's not very flexible. If your user was not in the hostname-writer group, you will have to log out and back in for the change to take effect. And you can't create policies like requiring entering a password before performing administrative-type actions (unless the password is for sudo - and that is dangerous, see above).

* run a daemon under root that allows making edits to /etc/hostname. Provide an IPC interface to request a change to /etc/hostname; have the daemon check, via a call to a flexible, configurable authorization service, that the caller process has the right to perform a "change /etc/hostname" action (the authorization service might reply yes if, for example, the caller's user belongs to a specific group and verified his password within the last N minutes); and only then make the change on behalf of the unprivileged caller.

The latter seems like a better solution. Maybe over-engineered for managing a one-line config file, but definitely the solution to go with for more complex situations; so we might as well use the general solution in this case too.

The daemon is hostnamed; the flexible authorization service is polkit. See https://www.freedesktop.org/wiki/Software/systemd/hostnamed/ for more details.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by wruza on Friday April 07, 2017 @05:52AM (#14058430)
Honestly, all these points make me feel sick from an architecture point of view. Why cannot groups be applied to the user instantly? Why doesn't system have regular ways to change 'registry' values (sorry for analogy, but /etc is a standard-defined setting storage; I'm a unix guy, ftr). If the kernel team has good arguments against that, why hostnamed is not named privilege-d and not using some system bus to change anything beyond hostname? Is hostname the only thing with such problem, the only gui-configurable system-wide setting?

While being a formally valid solution, it all seems like waste of simplicity and totally uncontrolled design process.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by tetromino_ on Friday April 07, 2017 @09:51AM (#14059596)
> Why cannot groups be applied to the user instantly?

Good question! I've wondered about this before too, ought to research it.

> Is hostname the only thing with such problem, the only gui-configurable system-wide setting?

Of course not :) Systemd provides a half-dozen similar daemons for configuring things; hostnamed is probably the simplest one of them, so I was trying to justify why so much engineering went into something that looks so trivial: it's because the approach is generic.

The idea is that a non-systemd system could reimplement some of these daemons (or rather, their dbus interface; you could implement them in one executable if you want) - and the parts of a standard control panel application relevant to your system would just work.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by supergreg on Thursday April 06, 2017 @08:49PM (#14056121)
Wait, since when is sudo considered dangerous? Forget the GUI for editing the hostname file, we have much more important things to worry about if that's the case.
Re:A Thank-You Note to the Hacker News Community from Ubuntu by simcop2387 on Thursday April 06, 2017 @09:10PM (#14056225)
He's not saying that sudo is dangerous but that a GUI program running in X11 as root is dangerous. This is because most GUI toolkits aren't hardened against attackes (buffer overflows, badly formed events, etc.) that can all be sent as a non-privileged user/program under X11 to one that's running as root. This means that if someone had an exploit in your browser that let them see X11 events or send them to another window then they could potentially use that to gain root access the moment you went into ANYTHING that ran as root under you X session.
Re:A Thank-You Note to the Hacker News Community from Ubuntu by tetromino_ on Friday April 07, 2017 @10:04AM (#14059688)
Yes, exactly. I should have been more clear.

"sudo vim /etc/whatever.conf" is perfectly fine.

"sudo gedit /etc/whatever.conf" might give an attacker already on your system a way to gain root.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by supergreg on Thursday April 06, 2017 @09:13PM (#14056240)
Then why use a GUI to edit the hostname in the first place? Either use sudo or fix the security issues with Xorg.
Re:A Thank-You Note to the Hacker News Community from Ubuntu by btschaegg on Friday April 07, 2017 @03:43AM (#14057877)
> Either use sudo

Yes, just keep doing that. I run several Linux boxes with systemd, all of them without hostnamed.

Forcing all your users to use the One True Way on a complicated system usually just means you're ignoring many legitimate use cases. Microsoft still does that on Windows (APIs and ugly registry entries over everything) - and while I cringe everytime I see it, I still recognize that the approach has value for some situations.

Many of the daemons for systemd on the other hand are optional, which I personally find to be great. I can use the ones I need and leave the ones I don't.

As for the GUI: Why use a text file? That might be a good use case for you and me, but a terrible one for someone not used to administrate *NIX systems. Why not allow both? As long as the file-based approach is not neglected, I'm perfectly fine with that.

Re:A Thank-You Note to the Hacker News Community from Ubuntu by qznc on Friday April 07, 2017 @03:39AM (#14057860)
If you tell users to edit the file, they will do something stupid like using LibreOffice. Ubuntu wants to be useable without using a terminal.
Re:A Thank-You Note to the Hacker News Community from Ubuntu by kazinator on Friday April 07, 2017 @01:38AM (#14057404)
Device drivers have timers.