3

On my BeagleBone Black Angstrom system, the dropbear.socket UNIT seems to spontaneously die after a while. The effect is that I can not ssh into the machine without restarting the dropbear.socket UNIT. This fixes the problem in the short term:

systemctl restart dropbear.socket

I tried adding Restart=always to the /lib/systemd/system/dropbear.socket file, but that is not allowed (I get an error in the system log).

[Unit]
Conflicts=dropbear.service

[Socket]
ListenStream=22
Accept=yes
Restart=always

[Install]
WantedBy=sockets.target
Also=dropbearkey.service

What's the correct way of getting dropbear.socket to restart automatically? It would be nice to fix the root cause, but this seems like an easy workaround and will make the system more robust.

Update

Here is the list of failed units (I didn't filter it, in case the music service (which I am not using) is a suspect).

% systemctl list-units --failed --full
UNIT                                                  LOAD   ACTIVE SUB    DESCRIPTION
[email protected]:22-192.168.0.40:55370.service loaded failed failed SSH Per-Connection Server
mpd.service                                           loaded failed failed Music Player Daemon

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Also here is /lib/systemd/system/[email protected]

[Unit]
Description=SSH Per-Connection Server
Requires=dropbearkey.service
After=syslog.target dropbearkey.service

[Service]
ExecStart=-/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -p 22
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process

5
  • That's not the service. It's a socket unit. A service will be named [email protected]:22-127.0.0.1:37855.service or similar and is one of a set of services generated from the service template [email protected]. You can help answerers by putting the output of systemctl list-units --failed --full|fgrep dropbear@ into your question, or somewhere that they can read it.
    – JdeBP
    Feb 7, 2014 at 21:34
  • @JdeBP Thanks for the clarification. Does my edit to the question help Feb 8, 2014 at 1:22
  • What is the error message which follows the Restart=Always statement? Feb 8, 2014 at 10:37
  • It will, and has. It helped me to eliminate one answer. (-:
    – JdeBP
    Feb 10, 2014 at 2:09
  • I've created an upstream issue: github.com/systemd/systemd/issues/11553 Jan 25, 2019 at 10:11

1 Answer 1

-1

Have you tried setting the OnFailure flag? Example:

[Unit]
Conflicts=dropbear.service
OnFailure=dropbear.socket

[Socket]
ListenStream=22
Accept=yes
Restart=always

[Install]
WantedBy=sockets.target
Also=dropbearkey.service
1
  • 1
    OnFailure did not work for me. systemd says "foo.socket: Dependency OnFailure=foo.socket dropped"
    – DrP3pp3r
    Jan 31, 2020 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .