我正在制作Debian Jessie的图片。 系统启动时没有/etc/machine-id
文件。 这会导致日记本无法启动的问题。
我发现,在systemd回购:
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. [Unit] Description=First Boot Wizard Documentation=man:systemd-firstboot(1) DefaultDependencies=no Conflicts=shutdown.target After=systemd-remount-fs.service Before=systemd-sysusers.service sysinit.target shutdown.target ConditionPathIsReadWrite=/etc ConditionFirstBoot=yes [Service] Type=oneshot RemainAfterExit=yes ExecStart=@rootbindir@/systemd-firstboot --prompt-locale --prompt-timezone --prompt-root-password StandardOutput=tty StandardInput=tty StandardError=tty
它应该放在哪里,以便运行?
在systemd 215中,ConditionFirstBoot不可用。 如何处理?
我有点惊讶,你没有安装这个脚本来安装systemd,但是(一般情况下)我认为答案是你应该把它放到/etc/systemd/system
。
在这种情况下(因为你正在做这一切尝试获得一个机器ID,为了使日记工作),我想我可能会replace您检查您所关心的文件, /etc/machine-id
的ConditionFirstBoot 。
所以我可能会重写单位部分为:
[Unit] Description=First Boot Wizard Documentation=man:systemd-firstboot(1) DefaultDependencies=no Conflicts=shutdown.target After=systemd-remount-fs.service Before=systemd-sysusers.service sysinit.target shutdown.target ConditionPathIsReadWrite=/etc ConditionPathExists=!/etc/machine-id
这就是说,如果可以发布一个更新的系统图像(我对Debian不太好,所以我也找不到任何地方去检查最新的支持版本),这可能是值得研究的 – systemd 215已经解决了一些问题( https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=systemd )。