Changing the default reboot command for aktualizr following the docs does not work

Hello guys,

yesterday, I wanted to define a custom reboot command for the Torizon update client aktualizr by following the docs: Torizon Update Client - Aktualizr Commands & Settings | Toradex Developer Center

Unfortunately, it never executed my command. I then dug into the layers and found that my file with the prefix 21 just gets overwritten by the already existing file 70:

Should I just change the prefix to 71 and then execute /usr/bin/touch /run/need-reboot after my custom commands? Or is there another recommended way?

FYI: we use a torizon-minimal build and not torizon-os.

Many thanks for your answers :slight_smile:

Best,

Chris

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Your approach is correct! You should use a higher-numbered prefix (like 71) to override the default reboot command(1). According to the Aktualizr configuration documentation, files are processed in alphabetical order, and if a config option is specified in multiple files, the last entry overrules any previous entries(1).

Recommended Solution

Create your custom reboot configuration file with a prefix higher than 70 (such as 71-custom-reboot.toml) in /etc/sota/conf.d/(1). Here’s the process:

  1. Create the directory if it doesn’t exist:
# sudo mkdir -p /etc/sota/conf.d/

(1)

  1. Create your custom reboot configuration file:
# cat <<EOF | sudo tee /etc/sota/conf.d/71-custom-reboot.toml
[bootloader]
reboot_command = "/path/to/your/custom/script.sh && /usr/bin/touch /run/need-reboot"
EOF

(1)

Important Considerations

  • Include the /usr/bin/touch /run/need-reboot command at the end of your custom script, as this is what signals the system that a reboot is needed
  • Use a prefix higher than 70 to ensure your configuration overrides the default 70-reboot.toml file
  • Restart Aktualizr after making changes:
# sudo systemctl restart aktualizr

(2)

Alternative Approach

If you need more complex reboot logic, you could also create a custom script that includes both your custom commands and the required touch command, then reference that script in your configuration file.

This approach ensures your custom reboot behavior takes precedence while maintaining compatibility with Torizon’s update mechanism.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hello @Fungiking,

You’re on the right track. The key point is that aktualizr loads all .toml files in order and the last one wins. Since 70-reboot.toml defines bootloader.reboot_command, it will always override your 21-*.toml.

Also, since you’re building with Yocto/Torizon, you don’t need to create /etc/sota/conf.d/ manually on the device. The usual approach is to install your config from your own layer so it already ends up in /etc/sota/conf.d/ when the image is built.

To actually override the reboot command, the simplest way is to add another file with a higher prefix, for example 71-custom-reboot.toml:

[bootloader]
reboot_command = "/usr/bin/my-custom-reboot-script"

Then implement the logic in /usr/bin/my-custom-reboot-script. If you still want to keep the normal behavior, you can just end that script with touch /run/need-reboot. Alternatively, if you don’t need the default logic at all, you could also override 70-reboot.toml directly from your layer. But we recommend the creation of another file approach.

This is also described on: Modifying the Aktualizr Configuration

Best regards,

Nice, thanks so much! This solved the issue! :slight_smile: