Page MenuHomeFreeBSD

devel/dbus: Generate machine-id on install
Needs ReviewPublic

Authored by 0mp on May 6 2018, 1:55 PM.

Details

Reviewers
bapt
adridg
tobik
Group Reviewers
O5: Ports Framework(Owns No Changed Paths)
portmgr
Summary

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228001

On new systems installing any application that uses the D-Bus library will abort with

D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/etc/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.

The reason for this is that ports r347320 removed @postexec dbus-uuidgen --ensure from the plist of devel/dbus to appease Poudriere in strict mode. So the machine-id is never generated until users start the D-Bus service (which not every wants to do) or run dbus-uuidgen --ensure manually afterwards. There are many support request for this on the FreeBSD forums and FreeBSD is also unique in subjecting users to this procedure.

This reintroduces generating the machine-id on install but also whitelists /var/lib/dbus/machine-id in Mk/Scripts/check_leftovers.sh so that Poudriere does not complain about leftover files.

Note that almost any functional FreeBSD desktop must have /var/lib/dbus/machine-id and it must remain the same across package installs/deinstalls so we cannot just track it in pkg-plist via an additional @postunexec.

Test Plan

Check with poudriere testport that /var/lib/dbus/machine-id exists in the jail after install of dbus.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 34707
Build 31765: arc lint + arc unit

Event Timeline

The dbus change is approved. You still need portmgr@ for the Mk/ part as I don't have any say over that.

In D15324#327639, @kwm wrote:

The dbus change is approved. You still need portmgr@ for the Mk/ part as I don't have any say over that.

Thank you.

I'm abandoning this though because it has been open for too long and I don't care anymore.

0mp added a reviewer: tobik.

I wonder if instead of modifying Mk/Scripts/check_leftovers.sh we could run something like @postunexec rm /var/lib/dbus/machine-id.

Use @postexec and @postunexec to install the machine-id file and remove it on dbus deinstallation.

0mp planned changes to this revision.Nov 9 2020, 2:06 PM

Whoops, wait, I just realized that this way it won't work in Poudriere in strict mode. I'll investigate a bit more.

0mp retitled this revision from devel/dbus: Generate machine-id on install and whitelist it in check_leftovers.sh to devel/dbus: Generate machine-id on install.Nov 9 2020, 2:07 PM
devel/dbus/pkg-plist
62

This will break dbus, when dbus is already running on a machine.

devel/dbus/pkg-plist
62

Yes, I've just realized that a few moment ago. Thank you for confirming that it might be an issue.

The machine-id file is already being created when the dbus service starts. It makes no sense to try to create it during installation. The only potentially interesting thing could be to try to remove the file on dbus deinstallation, but I am not going to pursue this.

In D15324#606119, @0mp wrote:

The machine-id file is already being created when the dbus service starts. It makes no sense to try to create it during installation. The only potentially interesting thing could be to try to remove the file on dbus deinstallation, but I am not going to pursue this.

If I remember it correcty, this whole issue was that other programs that look for the machine-id file when dbus wasn't running (so the file wasn't created yet) where crashing.

Remove problematic @rmtry. After some disussions with bapt@ on IRC it seems like a simple post-installation script should be enough.

  • Use a pkg-install script instead of @postexec to run dbus-uuidgen. I've tried to make it rootdir compatible, but I am not sure if I got it right.
  • Ignore the machine-id file via check_leftovers.sh.
  • Introduce an option to disable automatic generation of the machine-id file.