Bug 99162 - [PATCH] systemd syusers.d support
Summary: [PATCH] systemd syusers.d support
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: D-Bus Maintainers
QA Contact: D-Bus Maintainers
URL:
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-12-20 17:19 UTC by Lennart Poettering
Modified: 2017-02-13 16:00 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
the patch (1.62 KB, patch)
2016-12-20 17:19 UTC, Lennart Poettering
Details | Splinter Review
new patch, this time honours the user name configured at configure time (2.16 KB, patch)
2016-12-22 23:30 UTC, Lennart Poettering
Details | Splinter Review
third version of this patch (1.94 KB, patch)
2017-01-10 09:51 UTC, Lennart Poettering
Details | Splinter Review
fourth version of the patch (2.05 KB, patch)
2017-02-09 14:48 UTC, Lennart Poettering
Details | Splinter Review

Description Lennart Poettering 2016-12-20 17:19:20 UTC
Created attachment 128595 [details] [review]
the patch

With the attached patch dbus can boot up without any support in /etc or /var correctly, on systemd-based systems. The patch adds a small "sysusers.d" snippet that creates the "dbus" system user early at boot if the system boots up with an empty /etc directory.

This only has an effect on systemd-based systems (and the snippet is only installed on them), and improves stateless system support of dbus.
Comment 1 Philip Withnall 2016-12-22 15:17:25 UTC
Comment on attachment 128595 [details] [review]
the patch

Review of attachment 128595 [details] [review]:
-----------------------------------------------------------------

::: bus/dbus.conf
@@ +1,5 @@
> +# sysusers.d snippet for creating the D-Bus system user automatically
> +# at boot on systemd-based systems that ship with an unpopulated
> +# /etc. See sysusers.d(5) for details.
> +
> +u dbus - "System Message Bus"

Instead of hardcoding `dbus`, this needs to use the value from configure’s --with-dbus-user.
Comment 2 Lennart Poettering 2016-12-22 23:29:33 UTC
ah, indeed. I wasn't aware this was configurable.
Comment 3 Lennart Poettering 2016-12-22 23:30:08 UTC
Created attachment 128641 [details] [review]
new patch, this time honours the user name configured at configure time
Comment 4 Philip Withnall 2016-12-26 12:32:48 UTC
Comment on attachment 128641 [details] [review]
new patch, this time honours the user name configured at configure time

Review of attachment 128641 [details] [review]:
-----------------------------------------------------------------

Looks like it distributes dbus.conf and dbus.conf.in?

::: bus/Makefile.am
@@ +318,4 @@
>  	dbus.socket.in \
>  	systemd-user/dbus.service.in \
>  	systemd-user/dbus.socket.in \
> +	dbus.conf \

I think this should probably be `dbus.conf.in`?
Comment 5 Lennart Poettering 2017-01-10 09:50:33 UTC
(In reply to Philip Withnall from comment #4)
> Comment on attachment 128641 [details] [review] [review]
> new patch, this time honours the user name configured at configure time
> 
> Review of attachment 128641 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> Looks like it distributes dbus.conf and dbus.conf.in?
> 
> ::: bus/Makefile.am
> @@ +318,4 @@
> >  	dbus.socket.in \
> >  	systemd-user/dbus.service.in \
> >  	systemd-user/dbus.socket.in \
> > +	dbus.conf \
> 
> I think this should probably be `dbus.conf.in`?

True. And worse: the dbus.conf.in shouldn't have been listed in CONFIG_IN_FILES=!
Comment 6 Lennart Poettering 2017-01-10 09:51:40 UTC
Created attachment 128846 [details] [review]
third version of this patch

fix the .in confusion
Comment 7 Philip Withnall 2017-01-10 11:22:26 UTC
Comment on attachment 128846 [details] [review]
third version of this patch

Review of attachment 128846 [details] [review]:
-----------------------------------------------------------------

Looks good to me, thanks!

Not sure I can push it, so this might have to wait for smcv to ack it, but from my pov this is review+.
Comment 8 Simon McVittie 2017-01-16 11:43:28 UTC
Comment on attachment 128846 [details] [review]
third version of this patch

Review of attachment 128846 [details] [review]:
-----------------------------------------------------------------

::: bus/Makefile.am
@@ +1,4 @@
>  dbusdatadir=$(datadir)/dbus-1
>  legacydbusdatadir=$(sysconfdir)/dbus-1
>  dbus_daemon_execdir = $(DBUS_DAEMONDIR)
> +systemdsysusersdir = $(libdir)/sysusers.d

On multilib systems (those with lib64) and Debian-style multiarch systems (those with lib/x86_64-linux-gnu or whatever) this is not going to be where systemd looks for the files, I don't think?

Shouldn't it be more like this?

# Always "lib", even on systems with lib64 or multiarch
systemdsysusersdir = $(prefix)/lib/sysusers.d

@@ +324,5 @@
>  	dbus.service \
>  	dbus.socket
> +
> +nodist_systemdsysusers_DATA = \
> +	dbus.conf

I'd slightly prefer to use bus/sysusers.d/dbus.conf{,.in}. Otherwise this file would collide with any other configuration drop-in that is owned by dbus and happens to also use the ".conf" extension.
Comment 9 Lennart Poettering 2017-02-09 14:47:45 UTC
(In reply to Simon McVittie from comment #8)

> @@ +1,4 @@
> >  dbusdatadir=$(datadir)/dbus-1
> >  legacydbusdatadir=$(sysconfdir)/dbus-1
> >  dbus_daemon_execdir = $(DBUS_DAEMONDIR)
> > +systemdsysusersdir = $(libdir)/sysusers.d
> 
> On multilib systems (those with lib64) and Debian-style multiarch systems
> (those with lib/x86_64-linux-gnu or whatever) this is not going to be where
> systemd looks for the files, I don't think?

Indeed, of course!

> I'd slightly prefer to use bus/sysusers.d/dbus.conf{,.in}. Otherwise this
> file would collide with any other configuration drop-in that is owned by
> dbus and happens to also use the ".conf" extension.

OK, will fix.
Comment 10 Lennart Poettering 2017-02-09 14:48:32 UTC
Created attachment 129439 [details] [review]
fourth version of the patch

This time with the path, and moved down one dir
Comment 11 Simon McVittie 2017-02-09 17:43:57 UTC
Comment on attachment 129439 [details] [review]
fourth version of the patch

Review of attachment 129439 [details] [review]:
-----------------------------------------------------------------

::: bus/Makefile.am
@@ +1,4 @@
>  dbusdatadir=$(datadir)/dbus-1
>  legacydbusdatadir=$(sysconfdir)/dbus-1
>  dbus_daemon_execdir = $(DBUS_DAEMONDIR)
> +systemdsysusersdir = $(prefix)/lib/sysusers.d

I'd like a comment above this so that future maintainers don't "correct" this to what you initially said:

# Always .../lib, even on systems where ${libdir} is .../lib64 or .../lib/x86_64-linux-gnu

or something like that.
Comment 12 Simon McVittie 2017-02-09 17:44:38 UTC
Looks good to merge. I'd prefer it with that comment but it isn't required.

(If you don't get there first, I'll add the suggested comment and apply this at some point.)
Comment 13 Simon McVittie 2017-02-13 15:58:43 UTC
Fixed in git for 1.11.10, thanks
Comment 14 Lennart Poettering 2017-02-13 16:00:43 UTC
Excellent! Thanks for merging!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.