私はそれを使用していますカーネルsystemd.run
パラメータManjaro ARMを初めて起動するときは、ホスト名の設定、デフォルトのユーザーの追加など、いくつかの自動設定タスクを適用し、パッケージのインストールを除いてすべてがうまく機能しますpacman
。pacman
たとえば、すべてのパッケージを更新してvimをインストールしたいとします。
pacman -Syu --noconfirm
pacman -S --noconfirm vim
たとえば、これを行うと、各画像に対してさまざまなエラーが発生します。
+ pacman -Syu --noconfirm
:: Synchronizing package databases...
core downloading...
extra downloading...
community downloading...
error: failed retrieving file 'core.db' from manjaro.mirrors.lavatech.top : Could not resolve host: manjaro.mirrors.lavatech.top
warning: too many errors from manjaro.mirrors.lavatech.top, skipping for the remainder of this transaction
error: failed retrieving file 'extra.db' from manjaro.mirrors.lavatech.top : Could not resolve host: manjaro.mirrors.lavatech.top
error: failed retrieving file 'community.db' from manjaro.mirrors.lavatech.top : Could not resolve host: manjaro.mirrors.lavatech.top
error: failed retrieving file 'core.db' from ftp.nluug.nl : Could not resolve host: ftp.nluug.nl
ローカルサーバーとインターネットドメインをpingしようとしました。
+ ping -c1 192.168.0.19
ping: connect: Network is unreachable
そのため、スクリプトの実行中にネットワーク接続が確立されていないようです。頑張ったsystemd.wants
しかし、まだ動作しません。ネットワークは利用できません。また、次systemd.wants
のような別の単位を試してみましたcmdline.txt
。
systemd.wants=systemd-networkd.service
systemd.wants=systemd-networkd-wait-online.service
systemd.wants=network-online.target
systemd.wants=dhcpcd.service
systemdディレクティブ/boot/cmdline.txt
:
systemd.run=/boot/my_init_wrapper.sh systemd.run_success_action=reboot systemd.unit=kernel-command-line.target systemd.wants=systemd-networkd.service
~からsystemd-run-generator
run
3つのオプション(、run_success_action
および)だけが言及されていますrun_failture_action
が、最初の文書を誤って理解しているように見えるので、それを理解できないようですsystemd.run.generator
。 systemdユニット自体がさまざまな種類の依存関係を指定できるため、この点を知りたいです。カーネルでこれを指定する他の方法はありますかcmdline.txt
?
ラズベリーパイ4で試してみてください。ただし、この質問はsystemdに固有のものであるため、piで実行しているのかsystemdを持つ他のシステムで実行しているのかは関係ありません。だから私はこれをRPIプラットフォームではなく一般的なLinuxの質問としてここに投稿します。
ベストアンサー1
この場合は、納品せず、少なくとも部品については通常のsystemd.run
サービスとして使用する方が良いと思います。ConditionFirstBoot=yes
pacman
~によると手動、そのようなユニットを参照する方が良いfirst-boot-complete.target
[Unit]
Description="Update packages & install vim"
ConditionFirstBoot=yes
Wants=first-boot-complete.target
Before=first-boot-complete.target
Wants=network-online.target
After=network-online.target
[Service]
#optional ping test
#ExecCondition=/usr/bin/ping -c 2 -w 2 manjaro.org
#not running arch - adapt pacman path if need be:
ExecStart=/usr/bin/pacman -Syu --noconfirm
ExecStart=/usr/bin/pacman -S --noconfirm vim
[Install]
WantedBy=default.target
pingテストは面白いかもしれません。「オンライン」の意味についての不確実性。
最初の開始条件はマニュアルで引用されます。
最初の開始条件 =
ブールパラメータを使用します。この条件は、システムが初めて起動するかどうかによってデバイスの状態を決定するために使用できます。これはほぼ
/etc/
満たされないことを意味します(詳細は参考資料の「最初の起動意味」を参照machine-id(5)
)。これは、/etc/
工場リセット後の最初の起動時、または新しいシステムインスタンスの最初の起動時に設定するために使用できます。堅牢性のために、ユニットは
ConditionFirstBoot=yes
最初に自分自身を命令し、first-boot-complete.target
この手動目標を引き付ける必要がありますWants=
。これにより、最初の起動が中断された場合は、次のシステム起動中にそのデバイスが再起動されます。このオプションがカーネルコマンドラインで指定されている場合
systemd.condition-first-boot=
(ブール値を使用)、この条件付き検証結果は無視され、/etc/machine-id
存在確認よりも優先されます。