Cannot run cronjob at reboot

I have edited the crontab on dom0 using the command:

$ crontab -e

And added the following lines in it:

# Run the script disabling the touchpad once
# at every reboot
@reboot bash /home/tanky0u/.local/bin/disable_touchpad

The disable_touchpad script is a simple one. And it works successfully when I call the bash to execute it manually:
$ bash /home/tanky0u/.local/bin/disable_touchpad

However, when I reboot the QubesOS, the TouchPad is still functional, and thus I believe the cronjob isn’t executed.

How can I get this cronjob executed in dom0?

Edit: For the sake of clarity, here’s the full content of disable_touchpad script:

# disable_touchpad -- Disables the TouchPad using xinput.

# Find the device ID of the TouchPad
declare -i ID
ID=`xinput --list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`

# Disable it
xinput --disable $ID

It shouldn’t be necessary given that you’re calling the script with bash, but it might be worth trying to making the script executable:

chmod +x /home/tanky0u/.local/bin/disable_touchpad

I checked online and there’s a few questions on stackoverflow. One solution was to rename the script to make it end with .sh.

Well, I have tried

  1. Renaming the script to a .sh extension. Updating the crontab accordingly. And rebooting. Didn’t work.

  2. Reverting the script to a name without the .sh extension. Then doing the chmod +x on it. Updating the crontab accordingly. And rebooting. Didn’t work.

  3. Renaming the script to a .sh extension while keeping the chmod +x rights of the file. Updating the crontab accordingly. And rebooting. Didn’t work.

So I tried these but to no solution, unfortunately. What might be causing this?

I’d suggest you to use the systemd instead.

Hmm… this seems to be a problem that’s plaguing debian/ubuntu distros; which makes sense given I have made Debian as the default distro in my QubesOS (so the dom0 must also be a debian OS).

So, schucks!, I just wanted to get a script execute once per QubesOS boot and not deal with systemd stuff that I do not understand. I wasn’t expecting to bump into an esoteric bug about @reboot.

What do you mean?

Unless you have made some big changes, that’s not the case.

During installation of QubesOS, there was an option to pick Debian (or fedora) as the default (template?) distro.

That means that the default template for newly created vms is going to be debian. dom0 is still based on fedora.

You can check/change with gui by running qubes-global-settings or cli with qubes-prefs default_template.

Well then that @reboot bug isn’t isolated to Debian. Fedora seems to suffer from it, too.

Alright, I ended up using i3 config file to run the script I wanted to run at each boot into my user as follows:

exec --no-startup-id "sh /home/tanky0u/.local/bin/disable_touchpad

So, I no longer try to get @rebootworking in crontab, nor am I trying to get a custom-made .service file under systemd folder.