在ubuntu core 14上面安装openssh报错,之前是可以用的,我重新卸载后重装报各种错误,最后按照网上很多办法进行了尝试都无解。
重新安装报错
(正在读取数据库 ... 系统当前共安装有 107977 个文件和目录。)
正准备解包 .../openssh-client_1%3a7.2p2-4ubuntu2.10_armhf.deb ...
正在解包 openssh-client (1:7.2p2-4ubuntu2.10) ...
正在选中未选择的软件包 ncurses-term。
正准备解包 .../ncurses-term_6.0+20160213-1ubuntu1_all.deb ...
正在解包 ncurses-term (6.0+20160213-1ubuntu1) ...
正在选中未选择的软件包 openssh-sftp-server。
正准备解包 .../openssh-sftp-server_1%3a7.2p2-4ubuntu2.10_armhf.deb ...
正在解包 openssh-sftp-server (1:7.2p2-4ubuntu2.10) ...
正在选中未选择的软件包 openssh-server。
正准备解包 .../openssh-server_1%3a7.2p2-4ubuntu2.10_armhf.deb ...
正在解包 openssh-server (1:7.2p2-4ubuntu2.10) ...
正在选中未选择的软件包 python3-urllib3。
正准备解包 .../python3-urllib3_1.13.1-2ubuntu0.16.04.3_all.deb ...
正在解包 python3-urllib3 (1.13.1-2ubuntu0.16.04.3) ...
正在选中未选择的软件包 python3-requests。
正准备解包 .../python3-requests_2.9.1-3ubuntu0.1_all.deb ...
正在解包 python3-requests (2.9.1-3ubuntu0.1) ...
正在选中未选择的软件包 ssh-import-id。
正准备解包 .../ssh-import-id_5.5-0ubuntu1_all.deb ...
正在解包 ssh-import-id (5.5-0ubuntu1) ...
正在处理用于 man-db (2.7.5-1) 的触发器 ...
正在处理用于 systemd (229-4ubuntu21.28) 的触发器 ...
正在设置 openssh-client (1:7.2p2-4ubuntu2.10) ...
正在设置 ncurses-term (6.0+20160213-1ubuntu1) ...
正在设置 openssh-sftp-server (1:7.2p2-4ubuntu2.10) ...
正在设置 openssh-server (1:7.2p2-4ubuntu2.10) ...
Failed to validate path /var/run/sshd: Bad file descriptor 此处报错,发现是sshd文件目录没有创建成功
Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details.
invoke-rc.d: initscript ssh, action "start" failed.
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2020-07-22 06:27:36 UTC; 65ms ago
Process: 6925 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255)
Jul 22 06:27:36 OrangePI systemd[1]: Failed to start OpenBSD Secure Shell s...r.
Jul 22 06:27:36 OrangePI systemd[1]: ssh.service: Unit entered failed state.
Jul 22 06:27:36 OrangePI systemd[1]: ssh.service: Failed with result 'exit-...'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: 处理软件包 openssh-server (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 1
正在设置 python3-urllib3 (1.13.1-2ubuntu0.16.04.3) ...
正在设置 python3-requests (2.9.1-3ubuntu0.1) ...
正在设置 ssh-import-id (5.5-0ubuntu1) ...
在处理时有错误发生:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
orangepi@OrangePI:/etc/init.d$ cd /var/run
orangepi@OrangePI:/var/run$ ls ---目录里面没有sshd目录
agetty.reload dhclient-eth0.pid log rsyslogd.pid udev
alsa initctl motd.dynamic samba udisks2
apache2 initramfs mount shm user
crond.pid lightdm network sudo
crond.reboot lightdm.pid NetworkManager systemd
dbus lock ntpd.pid tmpfiles.d
orangepi@OrangePI:/var/run$ ^C
orangepi@OrangePI:/var/run$ sudo mkdir -p /var/run/sshd 创建了sshd目录
orangepi@OrangePI:/var/run$ ls
agetty.reload dhclient-eth0.pid log rsyslogd.pid tmpfiles.d
alsa initctl motd.dynamic samba udev
apache2 initramfs mount shm udisks2
crond.pid lightdm network sshd user
crond.reboot lightdm.pid NetworkManager sudo
dbus lock ntpd.pid systemd
orangepi@OrangePI:/var/run$ service sshd start 重新启动sshd,成功了!
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'ssh.service'.
Authenticating as: orangepi
Password:
==== AUTHENTICATION COMPLETE ===
orangepi@OrangePI:/var/run$
仔细看了一下错误,Failed to validate path /var/run/sshd: Bad file descriptor 此处报错,发现是sshd文件目录没有创建成功
orangepi@OrangePI:/etc/init.d$ cd /var/run
orangepi@OrangePI:/var/run$ ls ---目录里面没有sshd目录
agetty.reload dhclient-eth0.pid log rsyslogd.pid udev
alsa initctl motd.dynamic samba udisks2
apache2 initramfs mount shm user
crond.pid lightdm network sudo
crond.reboot lightdm.pid NetworkManager systemd
dbus lock ntpd.pid tmpfiles.d
orangepi@OrangePI:/var/run$ ^C
orangepi@OrangePI:/var/run$ sudo mkdir -p /var/run/sshd 创建了sshd目录
orangepi@OrangePI:/var/run$ ls
agetty.reload dhclient-eth0.pid log rsyslogd.pid tmpfiles.d
alsa initctl motd.dynamic samba udev
apache2 initramfs mount shm udisks2
crond.pid lightdm network sshd user
crond.reboot lightdm.pid NetworkManager sudo
dbus lock ntpd.pid systemd
orangepi@OrangePI:/var/run$ service sshd start 重新启动sshd,成功了!
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'ssh.service'.
Authenticating as: orangepi
Password:
==== AUTHENTICATION COMPLETE ===
orangepi@OrangePI:/var/run$
解决办法:就是在 /var/run/目录下创建 sshd目录
sudo mkdir -p /var/run/sshd
service sshd start