Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd.script from modules.cmdmod results in cache_error #9647

Open
RandyTheOtter opened this issue Dec 15, 2024 · 4 comments
Open

cmd.script from modules.cmdmod results in cache_error #9647

RandyTheOtter opened this issue Dec 15, 2024 · 4 comments
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: mgmt needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information.

Comments

@RandyTheOtter
Copy link

RandyTheOtter commented Dec 15, 2024

How to file a helpful issue

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:
@RandyTheOtter RandyTheOtter added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug labels Dec 15, 2024
@rapenne-s
Copy link

I'd add that using this in a state and applying it with state.highstate works as expected.

@marmarek
Copy link
Member

This sounds like salt-ssh limitation. I hit similar thing before: saltstack/salt#60003. And while this issue is closed, there are a few similar that are still open: saltstack/salt#61174, saltstack/salt#31531.

Just to be sure - your test-module.sh is inside file roots of the user env, right? I guess it is, otherwise it wouldn't work in dom0 either.

@rapenne-s
Copy link

This sounds like salt-ssh limitation. I hit similar thing before: saltstack/salt#60003. And while this issue is closed, there are a few similar that are still open: saltstack/salt#61174, saltstack/salt#31531.

Just to be sure - your test-module.sh is inside file roots of the user env, right? I guess it is, otherwise it wouldn't work in dom0 either.

Replying although I'm not OP. I have a state with this that works fine:

flatpak_setup:
  cmd.script:
    - source: salt://scripts/flatpak-setup.sh

However, this does not work, exactly as described by OP.

qubesctl --show-output --skip-dom0 --targets fedora-40-gui cmd.script salt://scripts/flatpak-setup.sh saltenv=user

@andrewdavidwong andrewdavidwong added C: mgmt needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. affects-4.2 This issue affects Qubes OS 4.2. labels Dec 15, 2024
@RandyTheOtter
Copy link
Author

RandyTheOtter commented Dec 16, 2024

Just to be sure - your test-module.sh is inside file roots of the user env, right? I guess it is, otherwise it wouldn't work in dom0 either.

Yes it is:

$ sudo ls /srv/user_salt/test-module.sh
/srv/user_salt/test-module.sh

states.cmd.script does indeed work.


I've tried adding --extra-filerefs, but qubesctl doesn't let it through:

$ sudo qubesctl --show-output --sync-extmods --targets disp5424 --extra-filerefs=salt://test-module.sh cmd.script salt://test-module.sh saltenv=user
usage: qubesctl [-h] [--show-output] [--force-color] [--skip-dom0]
                [--max-concurrency MAX_CONCURRENCY] [--skip-top-check]
                [--sync-extmods] [--targets TARGETS | --all] [--templates]
                [--standalones] [--app]
                ...
qubesctl: error: unrecognized arguments: --extra-filerefs=salt://test-module.sh
$ sudo qubesctl --show-output --sync-extmods --targets disp5424 cmd.script salt://test-module.sh saltenv=user --extra-filerefs=salt://test-module.sh
Usage: qubesctl [options] <function> [arguments]

qubesctl: error: no such option: --extra-filerefs
DOM0 configuration failed, not continuing

Maybe I could use something like file.cached, but I don't think there is an execution module for this, and even then I don't know how to cram both of them into a command line call:
saltstack-formulas/collectd-formula@cdcd4be#diff-fab4f4a970dc5626d6d01964bd708ed72877b5ebd3793ed9b605210a7a103e8b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: mgmt needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information.
Projects
None yet
Development

No branches or pull requests

4 participants