Boot
由於網路尚不可用,sshd 失敗
我正在執行 Arch Linux。重新啟動後,由於網路尚未啟動,sshd.service 無法啟動。我必須手動執行:
sudo systemctl restart sshd
一旦我這樣做了,sshd 服務就會啟動而沒有任何錯誤,並且它執行正常。我該如何解決這個問題,以便 systemd sshd.service 自動啟動?
以下是日誌:
May 06 15:47:23 server2 nm-dispatcher[471]: req:3 'connectivity-change': completed: no scripts May 06 15:47:23 server2 nm-dispatcher[471]: req:3 'connectivity-change': new request (0 scripts) May 06 15:47:23 server2 NetworkManager[440]: <info> [1525636043.9284] manager: NetworkManager state is now CONNECTED_GLOBAL May 06 15:47:22 server2 nm-dispatcher[471]: req:2 'up' [eth0]: completed: no scripts May 06 15:47:22 server2 nm-dispatcher[471]: req:2 'up' [eth0]: new request (0 scripts) May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6632] manager: startup complete May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6626] device (eth0): Activation: successful, device activated. May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6566] policy: set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6565] manager: NetworkManager state is now CONNECTED_SITE May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6558] manager: NetworkManager state is now CONNECTED_LOCAL May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6557] device (eth0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'manag> May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6555] device (eth0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'manage> May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6549] device (eth0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed') May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6541] dhcp4 (eth0): state changed unknown -> bound May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6536] dhcp4 (eth0): gateway 10.10.0.1 May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6536] dhcp4 (eth0): hostname 'server2' May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6536] dhcp4 (eth0): domain name 'oaks' May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6536] dhcp4 (eth0): nameserver '10.10.0.1' May 06 15:47:22 server2 dbus-daemon[439]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.Avahi.service': Unit dbus-org.freedesktop.Avahi.serv> May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6535] dhcp4 (eth0): expires in 648000 seconds May 06 15:47:22 server2 dbus-daemon[439]: [system] Activating via systemd: service name='org.freedesktop.Avahi' unit='dbus-org.freedesktop.Avahi.service' requested > May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6535] dhcp4 (eth0): plen 24 May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6535] dhcp4 (eth0): address 10.10.1.12 May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6293] dhcp4 (eth0): activation: beginning transaction (timeout in 45 seconds) May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6284] device (eth0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed') May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6275] device (eth0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed') May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6262] manager: NetworkManager state is now CONNECTING May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6258] device (eth0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'manage> May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6251] device (eth0): Activation: starting connection 'Wired connection 1' (5b9f0bf9-ed10-31e5-bcad-> May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6224] policy: auto-activating connection 'Wired connection 1' May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6206] device (eth0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface> May 06 15:47:22 server2 NetworkManager[440]: <info> [1525636042.6196] device (eth0): carrier: link connected May 06 15:47:22 server2 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready May 06 15:47:22 server2 kernel: e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx May 06 15:47:22 server2 udisksd[598]: udisks daemon version 2.7.6 starting May 06 15:47:22 server2 systemd[1]: Starting Disk Manager... May 06 15:47:20 server2 systemd[1]: sshd.service: Failed with result 'exit-code'. May 06 15:47:20 server2 systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a May 06 15:47:20 server2 sshd[564]: fatal: Cannot bind any address. May 06 15:47:20 server2 sshd[564]: error: Bind to port 22 on 10.10.1.12 failed: Cannot assign requested address. May 06 15:47:20 server2 systemd[1]: Started OpenSSH Daemon. May 06 15:47:20 server2 systemd[1]: Stopped OpenSSH Daemon. May 06 15:47:20 server2 systemd[1]: sshd.service: Scheduled restart job, restart counter is at 3. May 06 15:47:20 server2 systemd[1]: sshd.service: Service hold-off time over, scheduling restart. May 06 15:47:19 server2 systemd[1]: Startup finished in 12.430s (firmware) + 6.006s (loader) + 8.847s (kernel) + 2.106s (userspace) = 29.391s. May 06 15:47:19 server2 polkitd[543]: Acquired the name org.freedesktop.PolicyKit1 on the system bus May 06 15:47:19 server2 systemd[1]: Started Authorization Manager. May 06 15:47:19 server2 dbus-daemon[439]: [system] Successfully activated service 'org.freedesktop.PolicyKit1' May 06 15:47:19 server2 polkitd[543]: Finished loading, compiling and executing 2 rules May 06 15:47:19 server2 polkitd[543]: Error compiling script /etc/polkit-1/rules.d/40-allow-passwordless-printer-admin.rules May 06 15:47:19 server2 polkitd[543]: Loading rules from directory /usr/share/polkit-1/rules.d May 06 15:47:19 server2 polkitd[543]: Loading rules from directory /etc/polkit-1/rules.d May 06 15:47:19 server2 polkitd[543]: Started polkitd version 0.114 May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.9110] supplicant: wpa_supplicant running May 06 15:47:19 server2 wpa_supplicant[546]: Successfully initialized wpa_supplicant May 06 15:47:19 server2 systemd[1]: Started WPA supplicant. May 06 15:47:19 server2 dbus-daemon[439]: [system] Successfully activated service 'fi.w1.wpa_supplicant1' May 06 15:47:19 server2 systemd[1]: Started CUPS Scheduler. May 06 15:47:19 server2 colord[526]: failed to get session [pid 465]: No data available May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8565] device (wlan0): set-hw-addr: set MAC address to 02:6B:94:A4:D1:08 (scanning) May 06 15:47:19 server2 kernel: IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8563] device (wlan0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'e> May 06 15:47:19 server2 systemd[1]: sshd.service: Failed with result 'exit-code'. May 06 15:47:19 server2 sshd[540]: fatal: Cannot bind any address. May 06 15:47:19 server2 systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a May 06 15:47:19 server2 sshd[540]: error: Bind to port 22 on 10.10.1.12 failed: Cannot assign requested address. May 06 15:47:19 server2 systemd[1]: Starting WPA supplicant... May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8527] manager: (wlan0): new 802.11 WiFi device (/org/freedesktop/NetworkManager/Devices/3) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8521] device (wlan0): driver supports Access Point (AP) mode May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8519] wifi-nl80211: (wlan0): using nl80211 for WiFi device control May 06 15:47:19 server2 dbus-daemon[439]: [system] Activating via systemd: service name='fi.w1.wpa_supplicant1' unit='wpa_supplicant.service' requested by ':1.1' (u> May 06 15:47:19 server2 systemd[1]: Starting Authorization Manager... May 06 15:47:19 server2 systemd[1]: Started OpenSSH Daemon. May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8493] manager: rfkill: WiFi now disabled by radio killswitch May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8492] rfkill1: found WiFi radio killswitch (at /sys/devices/pci0000:00/0000:00:1d.1/0000:05:00.0/ie> May 06 15:47:19 server2 systemd[1]: Stopped OpenSSH Daemon. May 06 15:47:19 server2 systemd[1]: sshd.service: Scheduled restart job, restart counter is at 2. May 06 15:47:19 server2 systemd[1]: sshd.service: Service hold-off time over, scheduling restart. May 06 15:47:19 server2 dbus-daemon[439]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service' requested by ':1.1' (uid=> May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.8479] ovsdb: Could not connect: No such file or directory May 06 15:47:19 server2 kernel: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready May 06 15:47:19 server2 systemd[1]: sshd.service: Failed with result 'exit-code'. May 06 15:47:19 server2 systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a May 06 15:47:19 server2 sshd[525]: fatal: Cannot bind any address. May 06 15:47:19 server2 sshd[525]: error: Bind to port 22 on 10.10.1.12 failed: Cannot assign requested address. May 06 15:47:19 server2 systemd[1]: Starting Manage, Install and Generate Color Profiles... May 06 15:47:19 server2 systemd[1]: Started OpenSSH Daemon. May 06 15:47:19 server2 systemd[1]: Stopped OpenSSH Daemon. May 06 15:47:19 server2 systemd[1]: sshd.service: Scheduled restart job, restart counter is at 1. May 06 15:47:19 server2 systemd[1]: sshd.service: Service hold-off time over, scheduling restart. May 06 15:47:19 server2 dbus-daemon[439]: [system] Activating via systemd: service name='org.freedesktop.ColorManager' unit='colord.service' requested by ':1.9' (ui> May 06 15:47:19 server2 kernel: ath: Regpair used: 0x69 May 06 15:47:19 server2 kernel: ath: Country alpha2 being used: 00 May 06 15:47:19 server2 kernel: ath: EEPROM indicates we should expect a direct regpair map May 06 15:47:19 server2 kernel: ath: EEPROM regdomain: 0x69 May 06 15:47:19 server2 kernel: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6322] device (eth0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'ex> May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6298] settings: (eth0): created default wired connection 'Wired connection 1' May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6283] keyfile: add connection in-memory (5b9f0bf9-ed10-31e5-bcad-42dadabdcdad,"Wired connection 1") May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6253] manager: (eth0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/2) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6223] manager: (lo): new Generic device (/org/freedesktop/NetworkManager/Devices/1) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6207] device (lo): carrier: link connected May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6185] Loaded device plugin: NMOvsFactory (/usr/lib/NetworkManager/libnm-device-plugin-ovs.so) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.6170] Loaded device plugin: NMTeamFactory (/usr/lib/NetworkManager/libnm-device-plugin-team.so) May 06 15:47:19 server2 kernel: ath10k_pci 0000:05:00.0: htt-ver 3.47 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1 May 06 15:47:19 server2 kernel: ath10k_pci 0000:05:00.0: Unknown eventid: 90118 May 06 15:47:19 server2 kernel: ath10k_pci 0000:05:00.0: Unknown eventid: 118809 May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5679] Loaded device plugin: NMWifiFactory (/usr/lib/NetworkManager/libnm-device-plugin-wifi.so) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5647] Loaded device plugin: NMBluezManager (/usr/lib/NetworkManager/libnm-device-plugin-bluetooth.s> May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5550] Loaded device plugin: NMWwanFactory (/usr/lib/NetworkManager/libnm-device-plugin-wwan.so) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5299] Loaded device plugin: NMAtmManager (/usr/lib/NetworkManager/libnm-device-plugin-adsl.so) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5276] Loaded device plugin: NMVxlanDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5276] Loaded device plugin: NMVlanDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5276] Loaded device plugin: NMVethDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5276] Loaded device plugin: NMTunDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5276] Loaded device plugin: NMPppDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5276] Loaded device plugin: NMMacvlanDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] Loaded device plugin: NMMacsecDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] Loaded device plugin: NMIPTunnelDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] Loaded device plugin: NMInfinibandDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] Loaded device plugin: NMEthernetDeviceFactory (internal) May 06 15:47:19 server2 nm-dispatcher[471]: req:1 'hostname': completed: no scripts May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] Loaded device plugin: NMDummyDeviceFactory (internal) May 06 15:47:19 server2 nm-dispatcher[471]: req:1 'hostname': new request (0 scripts) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] Loaded device plugin: NMBridgeDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] Loaded device plugin: NMBondDeviceFactory (internal) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5275] dhcp-init: Using DHCP client 'internal' May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5274] manager: Networking is enabled by state file May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5274] manager: rfkill: WWAN enabled by radio killswitch; enabled by state file May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5273] manager: rfkill: WiFi enabled by radio killswitch; disabled by state file May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.5267] settings: loaded plugin iBFT: (c) 2014 Red Hat, Inc. To report bugs please use the NetworkMa> May 06 15:47:19 server2 ntpd[458]: Command line: /usr/bin/ntpd -g -u ntp:ntp May 06 15:47:19 server2 ntpd[458]: ntpd 4.2.8p11@1.3728-o Wed Mar 7 18:48:03 UTC 2018 (1): Starting May 06 15:47:19 server2 systemd[1]: Started Network Manager Script Dispatcher Service. May 06 15:47:19 server2 dbus-daemon[439]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher' May 06 15:47:19 server2 systemd[1]: sshd.service: Failed with result 'exit-code'. May 06 15:47:19 server2 systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a May 06 15:47:19 server2 sshd[463]: fatal: Cannot bind any address. May 06 15:47:19 server2 sshd[463]: error: Bind to port 22 on 10.10.1.12 failed: Cannot assign requested address. May 06 15:47:19 server2 systemd[1]: Started Simple Desktop Display Manager. May 06 15:47:19 server2 autossh[462]: ssh child pid is 476 May 06 15:47:19 server2 systemd[1]: Started Permit User Sessions. May 06 15:47:19 server2 autossh[462]: starting ssh (count 1) May 06 15:47:19 server2 autossh[462]: port set to 0, monitoring disabled May 06 15:47:19 server2 autossh[468]: ssh child pid is 475 May 06 15:47:19 server2 autossh[468]: starting ssh (count 1) May 06 15:47:19 server2 autossh[461]: ssh child pid is 474 May 06 15:47:19 server2 autossh[459]: ssh child pid is 473 May 06 15:47:19 server2 autossh[461]: starting ssh (count 1) May 06 15:47:19 server2 autossh[460]: ssh child pid is 472 May 06 15:47:19 server2 autossh[459]: starting ssh (count 1) May 06 15:47:19 server2 autossh[460]: starting ssh (count 1) May 06 15:47:19 server2 systemd[1]: Starting Network Manager Script Dispatcher Service... May 06 15:47:19 server2 autossh[466]: ssh child pid is 470 May 06 15:47:19 server2 autossh[466]: starting ssh (count 1) May 06 15:47:19 server2 autossh[468]: port set to 0, monitoring disabled May 06 15:47:19 server2 autossh[461]: port set to 0, monitoring disabled May 06 15:47:19 server2 autossh[459]: port set to 0, monitoring disabled May 06 15:47:19 server2 autossh[460]: port set to 0, monitoring disabled May 06 15:47:19 server2 autossh[466]: port set to 0, monitoring disabled May 06 15:47:19 server2 systemd[1]: Starting Permit User Sessions... May 06 15:47:19 server2 systemd[1]: Starting CUPS Scheduler... May 06 15:47:19 server2 systemd[1]: Started OpenSSH Daemon. May 06 15:47:19 server2 dbus-daemon[439]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.ser> May 06 15:47:19 server2 systemd[1]: Starting Network Time Service... May 06 15:47:19 server2 systemd[1]: Reached target Network. May 06 15:47:19 server2 systemd[1]: Started Network Manager. May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.4679] manager[0x5631afba8080]: rfkill: WWAN hardware radio set enabled May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.4678] manager[0x5631afba8080]: rfkill: WiFi hardware radio set disabled May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.4674] dns-mgr[0x5631afbc3130]: init: dns=default, rc-manager=symlink May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.4672] hostname: hostname changed from (none) to "server2" May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.4672] hostname: hostname: using hostnamed May 06 15:47:19 server2 systemd[1]: Started Hostname Service. May 06 15:47:19 server2 dbus-daemon[439]: [system] Successfully activated service 'org.freedesktop.hostname1' May 06 15:47:19 server2 kernel: input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input19 May 06 15:47:19 server2 kernel: input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input18 May 06 15:47:19 server2 kernel: input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input17 May 06 15:47:19 server2 kernel: input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input16 May 06 15:47:19 server2 systemd[1]: Starting Hostname Service... May 06 15:47:19 server2 dbus-daemon[439]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' re> May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.1725] manager[0x5631afba8080]: monitoring kernel firmware directory '/usr/lib/firmware'. May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.1684] Read config: /etc/NetworkManager/NetworkManager.conf (lib: 20-connectivity.conf) May 06 15:47:19 server2 NetworkManager[440]: <info> [1525636039.1683] NetworkManager (version 1.10.6-3, Arch Linux) is starting... (for the first time) May 06 15:47:19 server2 systemd-logind[441]: Watching system buttons on /dev/input/event4 ( USB Keyboard) May 06 15:47:19 server2 systemd-logind[441]: Watching system buttons on /dev/input/event3 ( USB Keyboard) May 06 15:47:19 server2 systemd-logind[441]: Watching system buttons on /dev/input/event0 (Sleep Button) May 06 15:47:19 server2 systemd-logind[441]: Watching system buttons on /dev/input/event1 (Power Button) May 06 15:47:19 server2 systemd-logind[441]: Watching system buttons on /dev/input/event2 (Power Button) May 06 15:47:19 server2 systemd-logind[441]: New seat seat0. May 06 15:47:19 server2 systemd[1]: Reached target Timers. May 06 15:47:19 server2 systemd[1]: Started Daily man-db cache update. May 06 15:47:19 server2 systemd[1]: Started Daily verification of password and group files. May 06 15:47:19 server2 systemd[1]: Started Daily Cleanup of Snapper Snapshots. May 06 15:47:19 server2 systemd[1]: Started Daily autocommit of changes in /etc directory. May 06 15:47:19 server2 systemd[1]: Starting Login Service... May 06 15:47:19 server2 systemd[1]: Starting Network Manager... May 06 15:47:19 server2 systemd[1]: Started D-Bus System Message Bus. May 06 15:47:19 server2 systemd[1]: Reached target Basic System. May 06 15:47:19 server2 systemd[1]: Reached target Sockets. May 06 15:47:19 server2 systemd[1]: Listening on CUPS Scheduler. May 06 15:47:19 server2 systemd[1]: Listening on D-Bus System Message Bus Socket. May 06 15:47:19 server2 systemd[1]: Started Daily Cleanup of Temporary Directories. May 06 15:47:19 server2 systemd[1]: Started Timeline of Snapper Snapshots. May 06 15:47:19 server2 systemd[1]: Reached target Paths. May 06 15:47:19 server2 systemd[1]: Started CUPS Scheduler. May 06 15:47:19 server2 systemd[1]: Started Daily rotation of log files. May 06 15:47:19 server2 systemd[1]: Reached target System Initialization. May 06 15:47:19 server2 systemd[1]: Started Update UTMP about System Boot/Shutdown. May 06 15:47:19 server2 systemd[1]: Starting Update UTMP about System Boot/Shutdown... May 06 15:47:19 server2 systemd[1]: Started Create Volatile Files and Directories. May 06 15:47:19 server2 systemd[1]: Starting Create Volatile Files and Directories... May 06 15:47:19 server2 systemd[1]: Started Flush Journal to Persistent Storage. May 06 15:47:18 server2 systemd[1]: Reached target Sound Card.
/usr/lib/systemd/system/sshd.service:
[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 # This service file runs an SSH daemon that forks for each incoming connection. # If you prefer to spawn on-demand daemons, use sshd.socket and sshd@.service.
/etc/NetworkManager/NetworkManager.conf 為空,/etc/NetworkManager/conf.d/ 為空。
值得注意的日誌條目:
- 5 月 6 日 15:47:22 server2 kernel: e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
- 5 月 6 日 15:47:19 server2 systemd$$ 1 $$:sshd.service:失敗,結果為“退出程式碼”。
- 5 月 6 日 15:47:19 server2 systemd$$ 1 $$:到達目標網路。
在實際介面啟動之前,系統似乎已到達目標網路。這是如何解決的?
如 AB 所示,您的 ssh 配置可能已調整為偵聽特定 IP 地址。如果 sshd 啟動時該 IP 地址不可用,則服務將失敗。
預設情況下, sshd 配置為 liste on
0.0.0.0
,這意味著任何地址,因此不依賴於可用的特定 IP。有兩種方法可以解決這個問題:
之後開始
network-online.target
systemd 為
network-online.target
需要網路完全啟動的服務提供了一個單元(所有介面都已配置)。這樣你就可以讓 sshd start after this unit 在介面配置好後啟動mkdir /etc/systemd/system/sshd.service.d cat > /etc/systemd/system/sshd.service.d/network-online.conf <<EOF [Unit] After=network-online.target EOF systemctl daemon-reload
允許綁定到非本地地址
另一個選項是允許監聽主機上不存在的地址。
此解決方案是系統範圍的,因此將適用於任何服務,而不僅僅是 sshd。
echo 'net.ipv4.ip_nonlocal_bind = 1' > /etc/sysctl.d/99-nonlocal_bind.conf systemctl restart systemd-sysctl.service