質問: systemdユニットが起動時に起動しない 私のシステムには有効になっているsystemd-unitがあります。問題は、再起動後に再起動しないことです。どちらも期待どおりに開始されている他の2つのサービスに依存します。このサービスは認識され、有効化されており、機能していません。[centos@ansible-kube-4 ~]$ sudo systemctl status flanneld flanneld.service - flanneld overlay address etcd agent loaded: loaded (/usr/lib/systemd/system/flanneld.service; enabled) active: inactive (dead) ユニットファイル[centos@ansible-kube-4 ~]$ cat /usr/lib/systemd/system/flanneld.service [unit] description=flanneld overlay address etcd agent after=network.target after=etcd.service [service] type=notify restart=always restartsec=3 environmentfile=/etc/sysconfig/flanneld environmentfile=-/etc/sysconfig/docker-network execstart=/usr/bin/flanneld -etcd-endpoints=${flannel_etcd} -etcd-prefix=${flannel_etcd_key} $flannel_options execstartpost=/usr/libexec/flannel/mk-docker-opts.sh -k docker_network_options -d /run/flannel/docker [install] wantedby=multi-user.target アップデート1dmesgの出力:$ dmesg | grep systemd [ 1.312165] systemd[1]: systemd 208 running in system mode. (+pam +libwrap +audit +selinux +ima +sysvinit +libcryptsetup +gcrypt +acl +xz) [ 1.317238] systemd[1]: detected virtualization 'kvm'. [ 1.319597] systemd[1]: running in initial ram disk. [ 1.323489] systemd[1]: no hostname configured. [ 1.324874] systemd[1]: set hostname to <localhost>. [ 1.327570] systemd[1]: initializing machine id from kvm uuid. [ 1.389047] systemd[1]: expecting device dev-disk-by\x2duuid-a78bb152\x2de525\x2d4f0e\x2d961a\x2dbf6147ac7d3e.device... [ 1.394577] systemd[1]: starting -.slice. [ 1.396820] systemd[1]: created slice -.slice. [ 1.397990] systemd[1]: starting system slice. [ 1.400212] systemd[1]: created slice system slice. [ 1.401503] systemd[1]: starting slices. [ 1.403556] systemd[1]: reached target slices. [ 1.404756] systemd[1]: starting timers. [ 1.406834] systemd[1]: reached target timers. [ 1.408042] systemd[1]: starting dispatch password requests to console directory watch. [ 1.410065] systemd[1]: started dispatch password requests to console directory watch. [ 1.413402] systemd[1]: starting paths. [ 1.415399] systemd[1]: reached target paths. [ 1.416574] systemd[1]: starting journal socket. [ 1.418894] systemd[1]: listening on journal socket. [ 1.420242] systemd[1]: started dracut ask for additional cmdline parameters. [ 1.422150] systemd[1]: starting dracut cmdline hook... [ 1.424870] systemd[1]: started load kernel modules. [ 1.426124] systemd[1]: starting journal service... [ 1.429731] systemd[1]: started journal service. [ 1.692884] systemd-udevd[213]: starting version 208 [ 2.621300] systemd-journald[90]: received sigterm [ 2.968711] systemd[1]: successfully loaded selinux policy in 274.569ms. [ 3.023076] systemd[1]: relabelled /dev and /run in 20.031ms. [ 3.365195] systemd-udevd[382]: starting version 208 [ 3.482910] systemd-journald[377]: received request to flush runtime journal from pid 1 アップデート2chkconfigの出力:sudo chkconfig note: this output shows sysv services only and does not include native systemd services. sysv configuration data might be overridden by native systemd configuration. if you want to list systemd services use 'systemctl list-unit-files'. to see services enabled on particular target use 'systemctl list-dependencies [target]'. netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off systemctl list-dependencies flanneldの出力:flanneld.service ├─system.slice └─basic.target ├─microcode.service ├─rhel-autorelabel-mark.service ├─rhel-autorelabel.service ├─rhel-configure.service ├─rhel-dmesg.service ├─rhel-loadmodules.service ├─paths.target ├─slices.target │ ├─-.slice │ └─system.slice ├─sockets.target │ ├─dbus.socket │ ├─rpcbind.socket │ ├─systemd-initctl.socket │ ├─systemd-journald.socket │ ├─systemd-shutdownd.socket │ ├─systemd-udevd-control.socket │ └─systemd-udevd-kernel.socket ├─sysinit.target │ ├─dev-hugepages.mount │ ├─dev-mqueue.mount │ ├─kmod-static-nodes.service │ ├─proc-sys-fs-binfmt_misc.automount │ ├─sys-fs-fuse-connections.mount │ ├─sys-kernel-config.mount │ ├─sys-kernel-debug.mount │ ├─systemd-ask-password-console.path │ ├─systemd-binfmt.service │ ├─systemd-journal-flush.service │ ├─systemd-journald.service │ ├─systemd-modules-load.service │ ├─systemd-random-seed.service │ ├─systemd-sysctl.service │ ├─systemd-tmpfiles-setup-dev.service │ ├─systemd-tmpfiles-setup.service │ ├─systemd-udev-trigger.service │ ├─systemd-udevd.service │ ├─systemd-update-utmp.service │ ├─systemd-vconsole-setup.service │ ├─cryptsetup.target │ ├─local-fs.target │ │ ├─-.mount │ │ ├─rhel-import-state.service │ │ ├─rhel-readonly.service │ │ ├─systemd-fsck-root.service │ │ └─systemd-remount-fs.service │ └─swap.target └─timers.target └─systemd-tmpfiles-clean.timer
回答: ユニットファイルが変更されました。前:[install] requiredby=docker.service 後:[install] wantedby=multi-user.target その修正の後、私はユニットを再び有効にしませんでした。 systemdが再設定するためにこれが必要であることが判明しました。$ sudo systemctl reenable flanneld rm '/etc/systemd/system/docker.service.requires/flanneld.service' ln -s '/usr/lib/systemd/system/flanneld.service' '/etc/systemd/system/multi-user.target.wants/flanneld.service'