I’ve modified the poweroff command in /lib/python3/dist-packages/qubesidle/idleness_monitor.py from subprocess.call(['sudo', 'poweroff']) to subprocess.call(['poweroff']).
Running the poweroff command directly in the user terminal successfully shuts down the VM, but the modified script does not work as expected.
@Atrate Thanks for sharing the issue. I just double checked and the solution suggested by you (and @marcos-morar ) simply works. I am not sure why it did not work for @marcos-morar earlier.
@Atrate are you willing to submit a patch? Just some try... except... to run power down with and without sudo.
I upgraded the Whonix-Workstation base template using the Template Manager, and the user-sysmaint-split package was installed during the upgrade. After the upgrade, subprocess.call(["poweroff"]) worked fine. However, I cloned templates that were updated using Qubes Update Manager, and I manually installed user-sysmaint-split in those templates. In these cloned templates, subprocess.call(["poweroff"]) did not work, but subprocess.call(['systemctl', 'poweroff']) worked fine.