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
dropbear@1-192.168.0.43: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/dropbear@.service

[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

  • That's not the service. It's a socket unit. A service will be named dropbear@0-127.0.0.1:22-127.0.0.1:37855.service or similar and is one of a set of services generated from the service template dropbear@.service. 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 '14 at 21:34
  • @JdeBP Thanks for the clarification. Does my edit to the question help – Mark Lakata Feb 8 '14 at 1:22
  • What is the error message which follows the Restart=Always statement? – MariusMatutiae Feb 8 '14 at 10:37
  • It will, and has. It helped me to eliminate one answer. (-: – JdeBP Feb 10 '14 at 2:09
  • I've created an upstream issue: github.com/systemd/systemd/issues/11553 – Jakub Klinkovský Jan 25 '19 at 10:11
0

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
| improve this answer | |
  • OnFailure did not work for me. systemd says "foo.socket: Dependency OnFailure=foo.socket dropped" – DrP3pp3r Jan 31 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.