Fix netconsole: disable before reconfiguring.

Configfs params can't be modified while the target is enabled.
Disable first if already enabled, then reconfigure and re-enable.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-12 13:22:27 +00:00
parent 4efc44e964
commit 83fb796a9f

View File

@@ -37,12 +37,17 @@
RemainAfterExit = true;
};
script = ''
mkdir -p /sys/kernel/config/netconsole/target1
echo enp1s0 > /sys/kernel/config/netconsole/target1/dev_name
echo 192.168.1.2 > /sys/kernel/config/netconsole/target1/remote_ip
echo 6666 > /sys/kernel/config/netconsole/target1/remote_port
echo c0:3f:d5:62:55:bb > /sys/kernel/config/netconsole/target1/remote_mac
echo 1 > /sys/kernel/config/netconsole/target1/enabled
TARGET=/sys/kernel/config/netconsole/target1
mkdir -p $TARGET
# Disable first if already enabled (can't modify params while enabled)
if [ -f $TARGET/enabled ] && [ "$(cat $TARGET/enabled)" = "1" ]; then
echo 0 > $TARGET/enabled
fi
echo enp1s0 > $TARGET/dev_name
echo 192.168.1.2 > $TARGET/remote_ip
echo 6666 > $TARGET/remote_port
echo c0:3f:d5:62:55:bb > $TARGET/remote_mac
echo 1 > $TARGET/enabled
'';
};