Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#843778: needrestart: restart systemd user daemons and user services

176 views
Skip to first unread message

Paul Wise

unread,
Nov 9, 2016, 9:30:03 AM11/9/16
to
Package: needrestart
Severity: wishlist

systemd can run its daemon as a user and manage services for that user.
The user services can be restarted in much the same way as system services.
It would be great that instead of listing these daemons in the outdated
binaries section, needrestart would list the commands to restart them:

sudo -u uid systemctl --user daemon-reexec
sudo -u uid systemctl --user restart name.service other.service

# systemctl status
● chianamo
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: ...
   CGroup: /
...
           └─user.slice
             ├─user-1000.slice
             │ ├─us...@1000.service
             │ │ ├─gpg-agent.service
             │ │ │ └─1931 /usr/bin/gpg-agent --supervised
             │ │ ├─dirmngr.service
             │ │ │ └─20314 /usr/bin/dirmngr --daemon --homedir /home/pabs/.gnupg
             │ │ └─init.scope
             │ │   ├─1927 /lib/systemd/systemd --user
             │ │   └─1929 (sd-pam)
...
# needrestart
Scanning processes...
Scanning candidates...
Scanning linux images...
...
Services to be restarted:
...
Services being skipped:
...
No containers need to be restarted.
User sessions running outdated binaries:
Debian-gdm @ user manager service: systemd[1527]
pabs @ session #2: ...
pabs @ user manager service: systemd[1927]
root @ session #306: gpg-agent[14884]
root @ user manager service: systemd[16906]

--
bye,
pabs

https://wiki.debian.org/PaulWise

signature.asc

Paul Wise

unread,
Jan 15, 2018, 7:30:03 PM1/15/18
to
On Wed, 09 Nov 2016 22:25:25 +0800 Paul Wise wrote:

> systemd can run its daemon as a user and manage services for that user.
> The user services can be restarted in much the same way as system services.

Turns out you cannot restart user services via sudo.

> It would be great that instead of listing these daemons in the outdated
> binaries section, needrestart would list the commands to restart them:

So I think the way it should work is for needrestart to signal every
needrestart-session process to do the supervisor and service restarting,
wait for the completion of these restarts, update the list of processes
needing restarting and then print any that are still needing restarting.
signature.asc

Jörg Sommer

unread,
Jan 22, 2019, 4:40:02 AM1/22/19
to
Hello,

I've seen that needrestart reports the user processes when run as
user. Could you extend needrestart to show the dialogue and restart the
systemd units:

```
% id -u
1000

% needrestart
Prüfe Prozesse...
Veraltete Prozesse:
dbus-daemon[885], emacs[12635], firefox[30570], firefox-bin[20556], Privileged Cont[26250], pulseaudio[29837], Web Content[21597], WebExtensions[20752],
Xorg[12276]

% systemctl --user status -n0 29837 30570 2>/dev/null |grep '^●' |sed 's/ -.*//; s/.* //' |uniq
pulseaudio.service
ff.service

% systemctl --user restart pulseaudio.service
```

Regards Jörg

--
Die Erde ist das einzigste Irrenhaus, das von seinen eigenen Insassen
verwaltet wird.
(U. Schmidt)
signature.asc

Marco Steinacher

unread,
Apr 9, 2019, 5:40:03 AM4/9/19
to
On Debian 9.8 restarting the systemd user services as root with
"systemctl restart user@<UID>.service" works for me:

# needrestart
[...]
User sessions running outdated binaries:
root @ user manager service: systemd[6372]
admin @ user manager service: systemd[2398]

# systemctl | grep user@
us...@0.service loaded active running User Manager for UID 0

us...@1000.service loaded active running User Manager for UID 1000

# systemctl restart us...@0.service
# systemctl restart us...@1000.service

# needrestart
[...]
No user sessions are running outdated binaries.


I hope this helps,
Marco

--
OpenPGP Key ID: 0x62937F7F
0 new messages