Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 472406 - net-im/bitlbee - systemd unit starts bitlbee as root
Summary: net-im/bitlbee - systemd unit starts bitlbee as root
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Tim Harder
URL:
Whiteboard:
Keywords:
Depends on: 582658
Blocks:
  Show dependency tree
 
Reported: 2013-06-05 13:44 UTC by John Roman
Modified: 2016-09-05 03:22 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
functional bitlbee service (bitlbee.service,171 bytes, text/plain)
2013-06-05 13:45 UTC, John Roman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Roman 2013-06-05 13:44:57 UTC
the systemd service will never work as it is, the binary target is incorrect and the execution is as root.
Comment 1 John Roman 2013-06-05 13:45:26 UTC
Created attachment 350206 [details]
functional bitlbee service
Comment 2 Tim Harder gentoo-dev 2014-01-24 02:14:37 UTC
Reassigning to systemd since I don't have systems to test with.
Comment 3 Mike Gilbert gentoo-dev 2014-01-24 03:10:10 UTC
This patch probably makes more sense; no reason to run as nobody when we are creating a dedicated user/group.

John: Can you confirm this works for you? I'm not going to install/test this just for a simple user change.

--- a/init/bitlbee.service.in
+++ b/init/bitlbee.service.in
@@ -4,6 +4,7 @@
 
 [Service]
 ExecStart=@sbindir@/bitlbee -F -n
+User=bitlbee
 
 [Install]
 WantedBy=multi-user.target
Comment 4 Pacho Ramos gentoo-dev 2014-02-01 19:08:06 UTC
Also, since the unit file is provided by upstream, maybe a report to them could help to improve the unit file (and prevent us from needing to patch it forever)
Comment 5 Tim Harder gentoo-dev 2014-02-01 19:11:14 UTC
(In reply to Pacho Ramos from comment #4)
> Also, since the unit file is provided by upstream, maybe a report to them
> could help to improve the unit file (and prevent us from needing to patch it
> forever)

Unfortunately upstream isn't very responsive at times, I still have patches sitting in trac tickets from a while ago. It's probably still good to try though.
Comment 6 Pacho Ramos gentoo-dev 2014-02-01 19:29:30 UTC
Then, feel free to go ahead and commit Mike's patch :)
Comment 7 Ihar Hrachyshka 2014-02-09 21:22:15 UTC
Running bitlbee as 'bitlbee' user shows another problem in 'journalctl' though:

booxter@localhost /usr/lib/systemd/system $ sudo systemctl status bitlbee
bitlbee.service - BitlBee IRC/IM gateway
   Loaded: loaded (/usr/lib64/systemd/system/bitlbee.service; enabled)
   Active: active (running) since Sun 2014-02-09 15:25:48 CET; 3s ago
 Main PID: 20819 (bitlbee)
   CGroup: /system.slice/bitlbee.service
           └─20819 /usr/sbin//bitlbee -F -n

Feb 09 15:25:48 localhost systemd[1]: Started BitlBee IRC/IM gateway.
Feb 09 15:25:48 localhost bitlbee[20819]: Warning: Warning: Couldn't write PID to `/var/run/bitlbee.pid'
Feb 09 15:25:48 localhost bitlbee[20819]: Warning: Couldn't write PID to `/var/run/bitlbee.pid'
Comment 8 Pacho Ramos gentoo-dev 2014-02-09 22:19:25 UTC
I think it's just a warning taking care it is running in non-forking mode, maybe upstream will know more about why that warning is shown when running with foreground options
Comment 9 Mike Nerone 2014-06-05 11:19:30 UTC
Help for users:

You can make both the run-as-wrong-user and can't-write-pid problems go away for now by creating /etc/systemd/system/bitlbee.service.d/fix-exec.conf containing these lines:

[Service]
ExecStart=
ExecStart=/usr/sbin/bitlbee -F -n -P /dev/null
User=bitlbee

Various aspects of this could be used in Gentoo's ebuild fix, as well.

By way of explanation of the one strange line, "ExecStart=", it just clears the ExecStart set by the main unit file. This is necessary because more than one is allowed, so they would stack by default instead of overriding. Explicitly clearing it first prevents that.
Comment 10 Tim Harder gentoo-dev 2016-09-05 03:22:52 UTC
Should be fixed in 3.4.2-r1.