Re: #yocto systemd not able to start sshd after a reboot #yocto


Khem Raj
 

does something like this work?

[Unit]
Description=OpenSSH Daemon
Wants=sshdgenkeys.service
After=sshdgenkeys.service
After=network.target

[Service]
ExecStart=/usr/bin/sshd -D
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always

[Install]
WantedBy=multi-user.target

On Fri, Sep 18, 2020 at 8:29 AM <srijan.nandi@gmail.com> wrote:

I am facing a peculiar problem with openssh. I have built openssh_8.0p1on zeus.

The sshd.service file is as follows:
[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=sshdgenkeys.service
Wants=sshdgenkeys.service

[Service]
Type=simple
PIDFile=/var/run/sshd.pid
EnvironmentFile=-/etc/default/sshd
ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill $MAINPID
PermissionsStartOnly=true
KillMode=process
Restart=on-failure
StandardError=syslog

[Install]
WantedBy=multi-user.target

It starts without issues, if i do a systemctl start sshd.service. If I do a test of the config file it does not come up with any errors:

genericx86-64:~$ sudo /usr/sbin/sshd -t
genericx86-64:~$

Problem:
If I reboot the server, sshd does not start. There is no error on syslog. I have enabled debug logging, still no logs in syslog.

# Logging
SyslogFacility DAEMON
LogLevel DEBUG3

Even systemctl is-enabled sshd shows as enabled.

After a reboot, if I do a systemctl status sshd it shows:
Loaded: loaded (/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: inactive (dead)

If I manually run systemctl start sshd.service, everything works perfectly well without issues. sshd start on 0.0.0.0:2224 and I am able to ssh in as well.

It's just that systemctl is not able to start sshd after a reboot and there is no error that i can find or debug. Absolutely run out of ideas to resolve this. Any help will be greatly appreciated.

Thanks and Regards,
-=Srijan Nandi


Join yocto@lists.yoctoproject.org to automatically receive all group messages.