From 416801a563be51202c598f42832a8f02875f19d6 Mon Sep 17 00:00:00 2001 From: HuijingHei Date: Thu, 24 Oct 2024 15:09:54 +0800 Subject: [PATCH] alternatives: update doc to use the usual `alternatives` commands See https://github.com/coreos/fedora-coreos-tracker/issues/677#issuecomment-2429223322 --- modules/ROOT/pages/alternatives.adoc | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/modules/ROOT/pages/alternatives.adoc b/modules/ROOT/pages/alternatives.adoc index d281be92..0683d888 100644 --- a/modules/ROOT/pages/alternatives.adoc +++ b/modules/ROOT/pages/alternatives.adoc @@ -35,3 +35,43 @@ storage: overwrite: true hard: false ---- + +== Using alternatives commands + +Starting with Fedora CoreOS based on Fedora 41, you can use `alternatives` commands to configure the default command. + +. Example systemd unit to configure default the iptables backend +[source,yaml,subs="attributes"] +---- +variant: fcos +version: {butane-latest-stable-spec} +systemd: + units: + - name: custom-iptables-nft.service + enabled: true + contents: | + [Unit] + Description=Set the nft backend for iptables + [Service] + ExecStart=/usr/sbin/alternatives --set iptables /usr/sbin/iptables-nft + RemainAfterExit=yes + [Install] + WantedBy=multi-user.target +---- + +You can also manually running `alternatives` commands to configure the default command runtime. + +.Example manually to configure default the iptables backend +[source,bash] +---- +# Check the link info +alternatives --display iptables +iptables --version + +# Config iptables to point to iptables-nft +sudo alternatives --set iptables /usr/sbin/iptables-nft + +# Verify iptables version is iptables-nft +alternatives --display iptables +iptables --version +---- \ No newline at end of file