Rc.local appears to not do anything on fedora-40-minimal template

I tried editing /rw/config/rc.local within the template and the appVM but neither appear to do anything when the VM starts. I have substituted a launcher within .config/autostart to run scripts at startup but that only works when I don’t need sudo because it runs with user privileges.

So, no need to change the template. Have you tried the testing approaches in the following topic?

What happens if you run your rc.local script as root? What’s inside your rc.local? What makes you think that they “appear to do anything”?

The script appears not to run at all. No effect. I am testing with a simple echo "nameserver 127.0.0.1" > /etc/resolv.conf although I have had the same issue with other simple scripts. Should work since rc.local scripts run as root.

It just occurred to me that this specific issue might be due to Qubes setting its own network configuration after rc.local runs. I’m not sure if this is the case and will have to test it, but I haven’t been able to get any rc.local scripts to run in Fedora templates.

edit: Running rc.local from command line works fine.

Relevant posts: Rc.local in my template does nothing - #9 by michael

Try to add:

touch /etc/testfile

In the rc.local, restart the qube and check if this file will be created.

To debug rc.local problems it’s also useful to look at the logs (inside the qube):

sudo journalctl -b -u qubes-misc-post
1 Like