https://bugs.launchpad.net/snappy/+bug/1662772
根据上述错误,我无法登录到正常运行的启动系统。
重要的错误是
systemd[1]: snappy-set-hostname.service: Start request repeated too quickly.
systemd[1]: Failed to start Set the hostname to the value stored on the writable partition.
如果在日志中发现以下错误
journalctl
....
Mar 30 09:05:00 aaron-ubunix systemd[1]: Started Set the hostname to the value stored on the writable partition.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Started Set the hostname to the value stored on the writable partition.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Started Set the hostname to the value stored on the writable partition.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Reached target Sound Card.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Reached target Bluetooth.
Mar 30 09:05:00 aaron-ubunix systemd[1]: snappy-set-hostname.service: Start request repeated too quickly.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Failed to start Set the hostname to the value stored on the writable partition.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for System Initialization.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for ACPID Listen Socket.
Mar 30 09:05:00 aaron-ubunix systemd[1]: acpid.socket: Job acpid.socket/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for getty on tty2-tty6 if dbus and logind are not available.
Mar 30 09:05:00 aaron-ubunix systemd[1]: getty-static.service: Job getty-static.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Basic System.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Multi-User System.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Graphical Interface.
Mar 30 09:05:00 aaron-ubunix systemd[1]: graphical.target: Job graphical.target/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: multi-user.target: Job multi-user.target/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: basic.target: Job basic.target/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Getty on tty1.
Mar 30 09:05:00 aaron-ubunix systemd[1]: [email protected]: Job [email protected]/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Snappy daemon.
Mar 30 09:05:00 aaron-ubunix systemd[1]: snapd.service: Job snapd.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for pcapdump.service.
Mar 30 09:05:00 aaron-ubunix systemd[1]: pcapdump.service: Job pcapdump.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Suspend Active Libvirt Guests.
Mar 30 09:05:00 aaron-ubunix systemd[1]: libvirt-guests.service: Job libvirt-guests.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Avahi mDNS/DNS-SD Stack Activation Socket.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Avahi mDNS/DNS-SD Stack.
Mar 30 09:05:00 aaron-ubunix systemd[1]: avahi-daemon.service: Job avahi-daemon.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: avahi-daemon.socket: Job avahi-daemon.socket/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Virtualization daemon.
Mar 30 09:05:00 aaron-ubunix systemd[1]: libvirtd.service: Job libvirtd.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Regular background program processing daemon.
Mar 30 09:05:00 aaron-ubunix systemd[1]: cron.service: Job cron.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for OpenBSD Secure Shell server.
Mar 30 09:05:00 aaron-ubunix systemd[1]: ssh.service: Job ssh.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for oFono Mobile telephony stack.
Mar 30 09:05:00 aaron-ubunix systemd[1]: ofono.service: Job ofono.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for LSB: automatic crash report generation.
Mar 30 09:05:00 aaron-ubunix systemd[1]: apport.service: Job apport.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for CUPS Scheduler.
Mar 30 09:05:00 aaron-ubunix systemd[1]: cups.path: Job cups.path/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for LSB: exim Mail Transport Agent.
Mar 30 09:05:00 aaron-ubunix systemd[1]: exim4.service: Job exim4.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for D-Bus System Message Bus.
Mar 30 09:05:00 aaron-ubunix systemd[1]: dbus.service: Job dbus.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Run anacron jobs.
Mar 30 09:05:00 aaron-ubunix systemd[1]: anacron.service: Job anacron.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for OpenVPN service.
Mar 30 09:05:00 aaron-ubunix systemd[1]: openvpn.service: Job openvpn.service/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Socket activation for snappy daemon.
Mar 30 09:05:00 aaron-ubunix systemd[1]: snapd.socket: Job snapd.socket/start failed with result 'dependency'.
Mar 30 09:05:00 aaron-ubunix systemd[1]: Dependency failed for Virtual machine log manager socket.
Mar 30 09:05:00 aaron-ubunix systemd[1]: virtlogd.socket: Job virtlogd.socket/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Set the CPU Frequency Scaling governor.
Mar 30 09:06:23 aaron-ubunix systemd[1]: ondemand.service: Job ondemand.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for crash report submission daemon.
Mar 30 09:06:23 aaron-ubunix systemd[1]: whoopsie.service: Job whoopsie.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Regular background program processing daemon.
Mar 30 09:06:23 aaron-ubunix systemd[1]: cron.service: Job cron.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for OpenBSD Secure Shell server.
Mar 30 09:06:23 aaron-ubunix systemd[1]: ssh.service: Job ssh.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: sysinit.target: Job sysinit.target/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snappy-set-hostname.service: Unit entered failed state.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snappy-set-hostname.service: Failed with result 'start-limit-hit'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snappy-set-hostname.service: Start request repeated too quickly.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Failed to start Set the hostname to the value stored on the writable partition.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for System Initialization.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Basic System.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Multi-User System.
Mar 30 09:06:23 aaron-ubunix systemd[1]: multi-user.target: Job multi-user.target/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: basic.target: Job basic.target/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for ISC DHCP IPv6 server.
Mar 30 09:06:23 aaron-ubunix systemd[1]: isc-dhcp-server6.service: Job isc-dhcp-server6.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for ACPID Listen Socket.
Mar 30 09:06:23 aaron-ubunix systemd[1]: acpid.socket: Job acpid.socket/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Virtual machine log manager socket.
Mar 30 09:06:23 aaron-ubunix systemd[1]: virtlogd.socket: Job virtlogd.socket/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Hold until boot process finishes up.
Mar 30 09:06:23 aaron-ubunix systemd[1]: plymouth-quit-wait.service: Job plymouth-quit-wait.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for ISC DHCP IPv4 server.
Mar 30 09:06:23 aaron-ubunix systemd[1]: isc-dhcp-server.service: Job isc-dhcp-server.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for LSB: Start/stop sysstat's sadc.
Mar 30 09:06:23 aaron-ubunix systemd[1]: sysstat.service: Job sysstat.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Auto import assertions from block devices.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snapd.autoimport.service: Job snapd.autoimport.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Samba SMB Daemon.
Mar 30 09:06:23 aaron-ubunix systemd[1]: smbd.service: Job smbd.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for LSB: disk temperature monitoring daemon.
Mar 30 09:06:23 aaron-ubunix systemd[1]: hddtemp.service: Job hddtemp.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for CUPS Scheduler.
Mar 30 09:06:23 aaron-ubunix systemd[1]: cups.socket: Job cups.socket/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Daily Cleanup of Temporary Directories.
Mar 30 09:06:23 aaron-ubunix systemd[1]: systemd-tmpfiles-clean.timer: Job systemd-tmpfiles-clean.timer/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for PokerTH multiplayer server.
Mar 30 09:06:23 aaron-ubunix systemd[1]: pokerth-server.service: Job pokerth-server.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Snappy daemon.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snapd.service: Job snapd.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Workaround apparmor cacheing.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snappy-workaround-apparmor.service: Job snappy-workaround-apparmor.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for LSB: Record successful boot for GRUB.
Mar 30 09:06:23 aaron-ubunix systemd[1]: grub-common.service: Job grub-common.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Socket activation for snappy daemon.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snapd.socket: Job snapd.socket/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for Restore /etc/resolv.conf if the system crashed before the ppp link was shut down.
Mar 30 09:06:23 aaron-ubunix systemd[1]: pppd-dns.service: Job pppd-dns.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for D-Bus System Message Bus Socket.
Mar 30 09:06:23 aaron-ubunix systemd[1]: dbus.socket: Job dbus.socket/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: sysinit.target: Job sysinit.target/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snappy-set-hostname.service: Failed with result 'start-limit-hit'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Failed to start Set the hostname to the value stored on the writable partition.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for System Initialization.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for System Logging Service.
Mar 30 09:06:23 aaron-ubunix systemd[1]: rsyslog.service: Job rsyslog.service/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: sysinit.target: Job sysinit.target/start failed with result 'dependency'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snappy-set-hostname.service: Failed with result 'start-limit-hit'.
Mar 30 09:06:23 aaron-ubunix systemd[1]: snappy-set-hostname.service: Start request repeated too quickly.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Failed to start Set the hostname to the value stored on the writable partition.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for System Initialization.
Mar 30 09:06:23 aaron-ubunix systemd[1]: Dependency failed for System Logging Service.
Mar 30 09:06:23 aaron-ubunix systemd[1]: rsyslog.service: Job rsyslog.service/start failed with result 'dependency'.
....
答案1
我通过在以下文件中添加以下几行来解决了这个问题。
Restart=on-failure
RestartSec=00ms
最终文件将如下所示。
sudo systemctl edit snappy-set-hostname.service
[Unit]
Description=Set the hostname to the value stored on the writable partition
After=etc-writable.mount
Requires=local-fs.target
DefaultDependencies=no
After=local-fs.service
RequiresMountsFor=/ /etc
StartLimitBurst=100
[Service]
Type=simple
ExecStart=
ExecStart=/bin/hostname -F /etc/hostname
Restart=on-failure
RestartSec=500ms
当我创建对此处的系统默认文件的覆盖时/lib/systemd/system/snappy-set-hostname.service
,它会在此处创建一个新文件 /etc/systemd/system/snappy-set-hostname.service.d/override.conf。
这就是我最终提出以下内容的原因。
ExecStart=
ExecStart=/bin/hostname -F /etc/hostname
否则,它会尝试包含 ExecStart,这/lib/systemd
可能/etc/systemd
会导致问题。因为它会尝试运行两次。
如果你看到以下情况
Mar 31 08:38:06 some-machine systemd[1]: [/etc/systemd/system/snappy-set-hostname.service.d/override.conf:1] Assignment outside of section. Ignoring.
这是因为您必须根据需要在覆盖中使用部分名称等[Unit]
。[Service]