otter2
December 15, 2024, 6:00am
1
I am trying to run a script with cmd.script
module (don’t mistake it for states.cmd
, this is modules.cmdmod
), but it fails in qubes:
$ sudo qubesctl --show-output --targets disp1337 cmd.script salt://test-module.sh saltenv=user
local:
----------
pid:
62922
retcode:
0
stderr:
stdout:
module works
disp1337:
----------
cache_error:
True
pid:
0
retcode:
1
stderr:
stdout:
The script itself:
echo "module works"
Do you have any idea why would it behave this way?
p.s. couple of other execution modules I checked seem to work flawlessly, I have a suspicion that it fails to download the script.
p.p.s. Maybe you have some knowledge about cache_error
and what it means here? I can’t find it in the salt reference…
solene
December 15, 2024, 10:35am
2
Add --skip-dom0
otherwise it tries to run it on dom0 (this is the local
part).
I can reproduce your problem, although this works fine when I use cmd.script in a state and run state.highstate
.
1 Like
otter2
December 15, 2024, 12:42pm
3
This is the exact problem I have: it runs in dom0 no problem (as you can see by the correct return under “local”), but fails in any qube (retcode 1 and cache_error under “disp1337”).
Yes, states.cmd
works for me too, no matter how I invoke it. I guess these modules are different under the hood.
p.s. Thanks for checking it for me!
For anyone who might stumble upon this in the future, I’ve posted an issue:
opened 01:22PM - 15 Dec 24 UTC
T: bug
P: default
[How to file a helpful issue](https://www.qubes-os.org/doc/issue-tracking/)
#… ## Qubes OS release
R4.2
### Brief summary
Functionality `cmd.script` from salt execution module `cmdmod` doesn't work in qubes. It works in dom0, but returns 1 with `cache_error: True` when ran in qubes.
### Steps to reproduce
1. Write a script
2. Run `sudo qubesctl --show-output --targets <your_target> cmd.script salt://<your_script> saltenv=user`
- Replace placeholders here with your values
My testing script:
```
# test-module.sh
echo "module works"
```
Command I ran:
```
sudo qubesctl --show-output --targets disp1337 cmd.script salt://test-module.sh saltenv=user
```
### Expected behavior
```
local:
----------
pid:
62922
retcode:
0
stderr:
stdout:
module works
disp1337:
----------
pid:
1234
retcode:
0
stderr:
stdout:
module works
```
### Actual behavior
```
local:
----------
pid:
62922
retcode:
0
stderr:
stdout:
module works
disp1337:
----------
cache_error:
True
pid:
0
retcode:
1
stderr:
stdout:
```