User avatar
uk_baz
Posts: 6
Joined: Thu Oct 22, 2015 9:22 pm

Jessie Lite: how to start "systemd --user"?

Wed Dec 30, 2015 11:22 am

I'm trying to use Bluetooth with Jessie Lite and need to run it as root rather than as a user which is undesirable. It is also different to how it works in the full Jessie release.
I seem to have tracked this down to systemd is not starting a user session. However I don't know how to fix this and would appreciate some pointers. Below is some more backgroud...

I can use bluetoothctl if I run it with sudo

Code: Select all

[email protected]:/etc $ sudo bluetoothctl
[NEW] Controller 00:02:5B:03:E3:E3 raspberrypi [default]
[bluetooth]# version
Version 5.37
[bluetooth]# exit
[DEL] Controller 00:02:5B:03:E3:E3 raspberrypi [default]
However if I start bluetoothctl as a user then it just hangs and I have to do a ctrl-C to exit.

A bit of searching around seems to point at the problem being that there isn't a "systemd --user" running.
On full Jessie:

Code: Select all

[email protected] ~ $ ps aux | grep systemd
root        92  0.0  0.7   8088  3432 ?        Ss   Dec27   0:07 /lib/systemd/systemd-journald
root        94  0.0  0.6  11828  3068 ?        Ss   Dec27   0:00 /lib/systemd/systemd-udevd
root       394  0.0  0.5   3824  2432 ?        Ss   Dec27   0:04 /lib/systemd/systemd-logind
message+   402  0.0  0.7   5628  3140 ?        Ss   Dec27   0:03 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
pi         480  0.0  0.7   5044  3324 ?        Ss   Dec27   0:00 /lib/systemd/systemd --user
pi        4309  0.0  0.4   4256  1988 pts/0    S+   11:17   0:00 grep --color=auto systemd
On Jessie Lite I get

Code: Select all

[email protected]:~ $ ps aux | grep systemd
root        88  0.0  0.6   8088  2756 ?        Ss   08:43   0:01 /lib/systemd/systemd-journald
root        90  0.0  0.6  11316  2812 ?        Ss   08:43   0:00 /lib/systemd/systemd-udevd
root       352  0.0  0.4   3372  2068 ?        Ss   08:43   0:00 /lib/systemd/systemd-logind
message+   362  0.0  0.6   5568  3052 ?        Ss   08:43   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
pi        1428  0.0  0.4   4256  2020 pts/0    S+   11:17   0:00 grep --color=auto systemd
If I look at the systemctl status on a full jessie install I get:

Code: Select all

$ systemctl status 
● raspberrypi
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Thu 1970-01-01 00:00:02 UTC; 45 years 11 months ago
   CGroup: /
           ├─1 /sbin/init
           ├─system.slice
           │ ├─avahi-daemon.service
           │ │ ├─400 avahi-daemon: running [raspberrypi-2.local
           │ │ └─411 avahi-daemon: chroot helpe
           │ ├─dbus.service
           │ │ └─402 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
           │ ├─cron.service
           │ │ └─393 /usr/sbin/cron -f
           │ ├─dhcpcd.service
           │ │ └─406 /sbin/dhcpcd -q -b
           │ ├─system-serial\x2dgetty.slice
           │ │ └─[email protected]
           │ │   └─469 /sbin/agetty --keep-baud 115200 38400 9600 ttyAMA0 vt102
           │ ├─systemd-journald.service
           │ │ └─92 /lib/systemd/systemd-journald
           │ ├─ssh.service
           │ │ └─442 /usr/sbin/sshd -D
           │ ├─systemd-logind.service
           │ │ └─394 /lib/systemd/systemd-logind
           │ ├─systemd-udevd.service
           │ │ └─94 /lib/systemd/systemd-udevd
           │ ├─rsyslog.service
           │ │ └─431 /usr/sbin/rsyslogd -n
           │ ├─triggerhappy.service
           │ │ └─420 /usr/sbin/thd --daemon --triggers /etc/triggerhappy/triggers.d/ --socket /var/run/thd.socket --pidfile /var/run/thd.pid --user nobody /dev/in
           │ ├─ntp.service
           │ │ └─462 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 107:112
           │ └─bluetooth.service
           │   └─3822 /usr/libexec/bluetooth/bluetoothd
           └─user.slice
             └─user-1000.slice
               ├─[email protected]
               │ ├─480 /lib/systemd/systemd --user
               │ └─485 (sd-pam)  
               ├─session-c39.scope
               │ ├─3656 sshd: pi [priv]     
               │ ├─3666 sshd: [email protected]/0      
               │ ├─3669 -bash
               │ ├─4269 systemctl status
               │ └─4270 pager
               └─session-c1.scope
                 ├─468 /bin/login -f   
                 └─493 -bash
While on Jessie Lite there is no user.slice:

Code: Select all

$ systemctl status
● raspberrypi
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Thu 1970-01-01 00:00:02 UTC; 45 years 11 months ago
   CGroup: /
           ├─1 /sbin/init
           └─system.slice
             ├─avahi-daemon.service
             │ ├─359 avahi-daemon: running [raspberrypi.local
             │ └─370 avahi-daemon: chroot helpe
             ├─dbus.service
             │ └─362 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
             ├─ModemManager.service
             │ └─343 /usr/sbin/ModemManager
             ├─cron.service
             │ └─350 /usr/sbin/cron -f
             ├─dhcpcd.service
             │ └─624 /sbin/dhcpcd -q -w
             ├─system-serial\x2dgetty.slice
             │ └─[email protected]
             │   └─643 /sbin/agetty --keep-baud 115200 38400 9600 ttyAMA0 vt102
             ├─systemd-journald.service
             │ └─88 /lib/systemd/systemd-journald
             ├─ssh.service
             │ ├─ 625 /usr/sbin/sshd -D
             │ ├─ 653 sshd: pi [priv]     
             │ ├─ 663 sshd: [email protected]/0      
             │ ├─ 666 -bash
             │ ├─1388 systemctl status
             │ └─1389 pager
             ├─systemd-logind.service
             │ └─352 /lib/systemd/systemd-logind
             ├─system-getty.slice
             │ └─[email protected]
             │   └─642 /sbin/agetty --noclear tty1 linux
             ├─systemd-udevd.service
             │ └─90 /lib/systemd/systemd-udevd
             ├─system-ifup.slice
             │ └─[email protected]
             │   └─427 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
             ├─rsyslog.service
             │ └─408 /usr/sbin/rsyslogd -n
             ├─triggerhappy.service
             │ └─380 /usr/sbin/thd --daemon --triggers /etc/triggerhappy/triggers.d/ --socket /var/run/thd.socket --pidfile /var/run/thd.pid --user nobody /dev/in
             ├─ntp.service
             │ └─641 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 107:112
             └─bluetooth.service
               └─341 /usr/libexec/bluetooth/bluetoothd
Any help or advice would be appreciated.

Thanks in advance,
Barry

lemassykoi
Posts: 2
Joined: Fri Apr 14, 2017 9:51 am

Re: Jessie Lite: how to start "systemd --user"?

Fri Apr 14, 2017 9:53 am

You need to edit the file : /etc/dbus-1/system.d/bluetooth.conf

and copy/paste the section relative to root, and change root to pi, in the new pasted section

Return to “Raspbian”