Why is salt used in Qubes OS for automation while being SO BAD?
I am certain that using salt stack for automation in Qubes OS is not an optimal solution. Because salt is too unreliable and too often break things.
Here are some of the reasons:
Bad error handling, mostly not handling errors at all
Salt has no proper error handling. If any step of declarative commands goes wrong with error, user sees a wall of text with call stack and un-handled exception, even in simple cases.
E.g. run on Qubes OS R4.3 this:
sudo qubesctl top.enable AAA
It will show you 3 screens of text with call stack.
- What the hell is that error processing?
- Why no proper error messages?
- Why such basic exception was un-handled?
Terrible software design.
No reverts, not preserving system consistency but breaking OS
Salt is not able to actually revert changes if something goes wrong. I mean it can be Turing-complete language, so it can have proper processing in theory, but I’ve never saw it to be the case in Qubes OS, nor anywhere else.
Salt just leaves the user’s system in half-way semi-broken state almost always.
- No free space? Terminate half-way!
- You have different qube name for firewall? No checks, terminate half-way!
- Syntax of some external command has changed? Terminate half-way!
In all cases it shows ridiculous error debug-level error message and leaving a lot of un-reverted changes in the OS.
No information what should be done, no human error messages, no proper revert/undo features in case of any errors. So, every call of salt I ever make is gamble, and in many cases I regret I used it at all.
Declarative language without any validation nor compilation
The whole syntax of salt files is terrible. You never can know in advance what fields are possible, what values are allowed. Any typo in text string in any field and you will have half-ruined OS after running this script (due to execution being stop in the middle).
It would be good to have some type of scripts validation, or compilation would be good to have on the language level.
Salt is not for Qubes OS
Even in case salt does not fail (as often happens for me), it still is designed for different type of big-network-systems, with multiple computers, master-minions relations and etc. Qubes OS uses only part of it. The whole technology looks as alien and over-engineered technology, that does not suit Qubes OS and does not work reliably at all.
Proper alternatives?
Maybe there are good alternatives to salt, that can work reliably, be well-designed, and hopefully allow interactive run like port installation scripts in FreeBSD.
Even good python or even bash automation scripts would be better in most cases.
Let’s consider on task that needs automation: creating sys-audio qube. The proper automation solution should:
- guide user, telling what is happening on each step,
- ask questions, explaining possible options,
- revert changes if something failed at each step,
- telling user what exactly failed and what should be checked to solve the issue.
And salt is terrible in all that, showing walls of stack traces in every basic trouble, as we have in the current issue.
I decided to install sys-audio on R4.3 via salt commands: qusal/salt/sys-audio at main · ben-grande/qusal · GitHub . But running the first command sudo qubesctl top.enable sys-audio in dom0 showed a huge 3-screen-size output with python exceptions, probably telling that sys-audio.top file was not found or something. I hope this command execution did not break anything already. I am afraid to run such commands again.
Why is salt so bad?
I do not know, you tell me.
Each time I touch it as a user, I suffer and risk getting broken system. EACH TIME.
Can you imagine that running
sudo dnf install AAAA
would also show 100 lines of internal call stack with several unhandled exceptions in them instead of proper ERROR text?
And would also leave the system in unknown state (user does not know what part of automation was done before unhandled exceptions were thrown).
Can salt be a dead-end approach for Qubes OS?