当我尝试修复没有互联网的 ubuntu 服务器时,收到很多错误消息。最后,我发现这是由于网关指向错误的 IP。必须在 /etc/network/interfaces 中将网关切换为 xxx.xxx.x.193
但在此之前,我正在阅读这里的答案并按照它的命令来查看它是否能解决我服务器上的互联网问题。
https://askubuntu.com/questions/767574/no-network-after-upgrade-to-16-04/767944#767944
$ sudo systemctl enable systemd-networkd
$ sudo systemctl enable systemd-resolved
$ sudo systemctl start systemd-resolved
$ sudo rm /etc/resolv.conf
$ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
$ sudo vi /etc/systemd/network/20-dhcp.network
在我完成上述操作并重新启动后,出现了各种错误消息。我想这可能与 DHCP 设置为自动有关。但不确定。有什么修复建议吗?以下是我在启动消息中收到的错误。
Mar 22 20:04:42 ubuntu sshd[1413]: Missing privilege separation directory: /var/run/sshd
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Control process exited, code=exited status=255
Mar 22 20:04:42 ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Unit entered failed state.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Failed with result 'exit-code'.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:42 ubuntu systemd[1]: Stopped OpenBSD Secure Shell server.
Mar 22 20:04:42 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Mar 22 20:04:42 ubuntu sshd[1528]: Missing privilege separation directory: /var/run/sshd
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Control process exited, code=exited status=255
Mar 22 20:04:42 ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Unit entered failed state.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Failed with result 'exit-code'.
Mar 22 20:04:42 ubuntu dovecot: master: Dovecot v2.2.22 (fe789d2) starting up for imap, pop3 (core dumps disabled)
Mar 22 20:04:42 ubuntu systemd[1]: dovecot.service: PID file /var/run/dovecot/master.pid not readable (yet?) after start: No such file or directory
Mar 22 20:04:42 ubuntu systemd[1]: Started Dovecot IMAP/POP3 email server.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:42 ubuntu systemd[1]: Stopped OpenBSD Secure Shell server.
Mar 22 20:04:42 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Mar 22 20:04:42 ubuntu sshd[1533]: Missing privilege separation directory: /var/run/sshd
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Control process exited, code=exited status=255
Mar 22 20:04:42 ubuntu sshd[1533]: Missing privilege separation directory: /var/run/sshd
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Control process exited, code=exited status=255
Mar 22 20:04:42 ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Unit entered failed state.
Mar 22 20:04:42 ubuntu systemd[1]: ssh.service: Failed with result 'exit-code'.
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:43 ubuntu systemd[1]: Stopped OpenBSD Secure Shell server.
Mar 22 20:04:43 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Mar 22 20:04:43 ubuntu sshd[1537]: Missing privilege separation directory: /var/run/sshd
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Control process exited, code=exited status=255
Mar 22 20:04:43 ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Unit entered failed state.
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Failed with result 'exit-code'.
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:43 ubuntu systemd[1]: Stopped OpenBSD Secure Shell server.
Mar 22 20:04:43 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Mar 22 20:04:43 ubuntu sshd[1541]: Missing privilege separation directory: /var/run/sshd
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Control process exited, code=exited status=255
Mar 22 20:04:43 ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Unit entered failed state.
Mar 22 20:04:43 ubuntu systemd[1]: ssh.service: Failed with result 'exit-code'.
Mar 22 20:04:44 ubuntu systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:44 ubuntu systemd[1]: Stopped OpenBSD Secure Shell server.
Mar 22 20:04:44 ubuntu systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:44 ubuntu systemd[1]: Stopped OpenBSD Secure Shell server.
Mar 22 20:04:44 ubuntu systemd[1]: ssh.service: Start request repeated too quickly.
Mar 22 20:04:44 ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
Mar 22 20:04:44 ubuntu systemd[1]: ssh.service: Unit entered failed state.
Mar 22 20:04:44 ubuntu systemd[1]: ssh.service: Failed with result 'start-limit-hit'.
Mar 22 20:04:45 ubuntu fail2ban-client[1415]: ERROR Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 146]: option 'port' $
Mar 22 20:04:45 ubuntu named[1441]: using built-in root key for view _default
Mar 22 20:04:45 ubuntu named[1441]: set up managed keys zone for view _default, file 'managed-keys.bind'
Mar 22 20:04:45 ubuntu named[1441]: configuring command channel from '/etc/bind/rndc.key'
Mar 22 20:04:45 ubuntu named[1441]: command channel listening on 127.0.0.1#953
Mar 22 20:04:45 ubuntu named[1441]: configuring command channel from '/etc/bind/rndc.key'
Mar 22 20:04:45 ubuntu named[1441]: command channel listening on ::1#953
Mar 22 20:04:45 ubuntu named[1441]: the working directory is not writable
Mar 22 20:04:45 ubuntu systemd[1]: fail2ban.service: Unit entered failed state.
Mar 22 20:04:45 ubuntu systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Mar 22 20:04:45 ubuntu named[1441]: managed-keys-zone: journal file is out of date: removing journal file
Mar 22 20:04:45 ubuntu named[1441]: unable to remove journal 'managed-keys.bind.jnl': 'Permission denied'
Mar 22 20:04:45 ubuntu named[1441]: managed-keys-zone: loaded serial 5
Mar 22 20:04:45 ubuntu named[1441]: zone 0.in-addr.arpa/IN: loaded serial 1
Mar 22 20:04:45 ubuntu named[1441]: zone localhost/IN: loaded serial 2
Mar 22 20:04:45 ubuntu named[1441]: zone 127.in-addr.arpa/IN: loaded serial 1
Mar 22 20:04:45 ubuntu named[1441]: zone 255.in-addr.arpa/IN: loaded serial 1
Mar 22 20:04:45 ubuntu named[1441]: all zones loaded
Mar 22 20:04:45 ubuntu named[1441]: running
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving './DNSKEY/IN': 2001:500:84::b#53
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving './NS/IN': 2001:500:84::b#53
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving './DNSKEY/IN': 2001:500:84::b#53
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving './NS/IN': 2001:500:84::b#53
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving 'G.ROOT-SERVERS.NET/AAAA/IN': 2001:503:ba3e::2:30#53
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving './DNSKEY/IN': 2001:503:ba3e::2:30#53
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving 'E.ROOT-SERVERS.NET/AAAA/IN': 2001:503:ba3e::2:30#53
Mar 22 20:04:45 ubuntu named[1441]: network unreachable resolving './NS/IN': 2001:503:ba3e::2:30#53
Mar 22 20:04:45 ubuntu systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:45 ubuntu systemd[1]: Stopped Fail2Ban Service.
Mar 22 20:04:45 ubuntu systemd[1]: Starting Fail2Ban Service...
Mar 22 20:04:45 ubuntu fail2ban-client[1551]: ERROR Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 146]: option 'port' $
Mar 22 20:04:45 ubuntu systemd[1]: fail2ban.service: Control process exited, code=exited status=255
Mar 22 20:04:45 ubuntu systemd[1]: Failed to start Fail2Ban Service.
Mar 22 20:04:45 ubuntu kernel: [ 23.839071] audit: type=1400 audit(1553310285.596:10): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" nam$
Mar 22 20:04:45 ubuntu systemd[1]: fail2ban.service: Unit entered failed state.
Mar 22 20:04:45 ubuntu systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Mar 22 20:04:45 ubuntu systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:45 ubuntu systemd[1]: Stopped Fail2Ban Service.
Mar 22 20:04:45 ubuntu systemd[1]: Starting Fail2Ban Service...
Mar 22 20:04:46 ubuntu systemd[1]: Started A high performance web server and a reverse proxy server.
Mar 22 20:04:46 ubuntu named[1441]: network unreachable resolving 'G.ROOT-SERVERS.NET/AAAA/IN': 2001:dc3::35#53
Mar 22 20:04:46 ubuntu fail2ban-client[1559]: ERROR Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 146]: option 'port' $
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Control process exited, code=exited status=255
Mar 22 20:04:46 ubuntu systemd[1]: Failed to start Fail2Ban Service.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Control process exited, code=exited status=255
Mar 22 20:04:46 ubuntu systemd[1]: Failed to start Fail2Ban Service.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Unit entered failed state.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Mar 22 20:04:46 ubuntu php-fpm7.2[1435]: [22-Mar-2019 20:04:46] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'php_com_do$
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:46 ubuntu systemd[1]: Stopped Fail2Ban Service.
Mar 22 20:04:46 ubuntu systemd[1]: Starting Fail2Ban Service...
Mar 22 20:04:46 ubuntu mysql[1446]: * Starting MySQL (Percona Server) database server mysqld
Mar 22 20:04:46 ubuntu fail2ban-client[1569]: ERROR Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 146]: option 'port' $
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Control process exited, code=exited status=255
Mar 22 20:04:46 ubuntu systemd[1]: Failed to start Fail2Ban Service.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Unit entered failed state.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Mar 22 20:04:46 ubuntu kernel: [ 24.800151] audit: type=1400 audit(1553310286.560:11): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" nam$
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:46 ubuntu systemd[1]: Stopped Fail2Ban Service.
Mar 22 20:04:46 ubuntu systemd[1]: Starting Fail2Ban Service...
Mar 22 20:04:46 ubuntu fail2ban-client[1880]: ERROR Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 146]: option 'port' $
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Control process exited, code=exited status=255
Mar 22 20:04:46 ubuntu systemd[1]: Failed to start Fail2Ban Service.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Unit entered failed state.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Unit entered failed state.
Mar 22 20:04:46 ubuntu systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Mar 22 20:04:47 ubuntu kernel: [ 25.398516] audit: type=1400 audit(1553310287.156:12): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" nam$
Mar 22 20:04:47 ubuntu systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Mar 22 20:04:47 ubuntu systemd[1]: Stopped Fail2Ban Service.
Mar 22 20:04:47 ubuntu systemd[1]: fail2ban.service: Start request repeated too quickly.
Mar 22 20:04:47 ubuntu systemd[1]: Failed to start Fail2Ban Service.
Mar 22 20:04:47 ubuntu systemd[1]: fail2ban.service: Unit entered failed state.
Mar 22 20:04:47 ubuntu systemd[1]: fail2ban.service: Failed with result 'start-limit-hit'.
答案1
我有同样的问题。解决方案是创建文件夹/var/运行/sshd以 root 身份