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

[zypper] "msg: Zypper run command failed with return code 5." when using community.general.zypper module on MicroOS #5615

Closed
1 task done
ExNG opened this issue Nov 27, 2022 · 8 comments · Fixed by #5998
Closed
1 task done
Labels
bug This issue/PR relates to a bug module module os packaging plugins plugin (any type)

Comments

@ExNG
Copy link

ExNG commented Nov 27, 2022

Summary

Using the following snippet on a freshly installed MicroOS will result in the zypper module not using transactional-update.

---
- hosts: test
  tasks:
    - name: Install fail2ban
      community.general.zypper:
        name: fail2ban
        state: present

Failling with:

PLAY [test] ****************************************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************************************
ok: [test]


TASK [Install fail2ban] ***************************************************************************************************************************************
fatal: [test]: FAILED! => changed=false 
  cmd:
  - /usr/bin/zypper
  - --quiet
  - --non-interactive
  - --xmlout
  - install
  - --type
  - package
  - --auto-agree-with-licenses
  - --no-recommends
  - --
  - +fail2ban
  msg: Zypper run command failed with return code 5.
  rc: 5
  stderr: ''
  stderr_lines: <omitted>
  stdout: |-
    <?xml version='1.0'?>
    <stream>
    <message type="error">This is a transactional-server, please use transactional-update to update or modify the system.</message>
    </stream>
  stdout_lines: <omitted>

Issue Type

Bug Report

Component Name

community.general.zypper module

Ansible Version

$ ansible --version

Community.general Version

$ ansible-galaxy collection list community.general
# /home/VENV/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 6.0.1  

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = /etc/ansible/ansible.cfg

OS / Environment

openSUSE Tumbleweed

Steps to Reproduce

- hosts: test
  tasks:
    - name: Install fail2ban
      community.general.zypper:
        name: fail2ban
        state: present

Expected Results

TASK [Install fail2ban] ***************************************************************************************************************************************
ok: [test]

Actual Results

TASK [Install fail2ban] ***************************************************************************************************************************************
fatal: [test]: FAILED! => changed=false 
  cmd:
  - /usr/bin/zypper
  - --quiet
  - --non-interactive
  - --xmlout
  - install
  - --type
  - package
  - --auto-agree-with-licenses
  - --no-recommends
  - --
  - +fail2ban
  msg: Zypper run command failed with return code 5.
  rc: 5
  stderr: ''
  stderr_lines: <omitted>
  stdout: |-
    <?xml version='1.0'?>
    <stream>
    <message type="error">This is a transactional-server, please use transactional-update to update or modify the system.</message>
    </stream>
  stdout_lines: <omitted>

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module os packaging plugins plugin (any type) labels Nov 27, 2022
@felixfontein
Copy link
Collaborator

Right now the module detects whether it should use transactional-update by looking whether /var/lib/misc/transactional-update.state exists. I guess that's not sufficient on MicroOS.

@ExNG
Copy link
Author

ExNG commented Nov 27, 2022 via email

@ExNG
Copy link
Author

ExNG commented Nov 28, 2022

I propose testing if /usr/sbin/transactional-update exists.

See ExNG@5fd014f

@felixfontein
Copy link
Collaborator

CC @sebix who implemented support for transactional updates in #3164.

@sebix
Copy link
Contributor

sebix commented Nov 28, 2022

Great to see that the support for transactional-updates / MicroOS & Co. is actually used :)

I propose testing if /usr/sbin/transactional-update exists.

I'm not sure if that's correct, I had that in mind when implementing it, but intentionally decided against it. Does anything like /var/lib/misc/transactional-update.state exist on your system? Maybe they changed paths or file names.
Otherwise I'd first ask in the openSUSE community for advice to get it right and correct now.

@ExNG
Copy link
Author

ExNG commented Dec 1, 2022

Sorry i only yet got around testing.
So my setup isn't MicroOs per se, rather a Tumbleweed install with transactional-update.
Nonetheless the same Problem plagues fresh MicroOS installs too, /var/lib/misc/transactional-update.state doesnt exist on a fresh install but will after the first snapshot was created.
I tested this in blank new VMs with the Tumbleweed DVD iso and and the MicroOS VM image.

felixfontein added a commit that referenced this issue Feb 25, 2023
* fix(zypper): Added condition to check for transactional-update binary to support microos

closes #5615

* style(changelog): Made zypper-change uppercase

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix(zypper): Removed check for /var/lib/misc/transactional-update.state

* feat(zypper): Aligned transactional-update checks with zypper's

* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount

* refactor(zypper): Removed need for regex, plus small refactoring

---------

Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
patchback bot pushed a commit that referenced this issue Feb 25, 2023
* fix(zypper): Added condition to check for transactional-update binary to support microos

closes #5615

* style(changelog): Made zypper-change uppercase

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix(zypper): Removed check for /var/lib/misc/transactional-update.state

* feat(zypper): Aligned transactional-update checks with zypper's

* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount

* refactor(zypper): Removed need for regex, plus small refactoring

---------

Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2c762c4)
patchback bot pushed a commit that referenced this issue Feb 25, 2023
* fix(zypper): Added condition to check for transactional-update binary to support microos

closes #5615

* style(changelog): Made zypper-change uppercase

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix(zypper): Removed check for /var/lib/misc/transactional-update.state

* feat(zypper): Aligned transactional-update checks with zypper's

* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount

* refactor(zypper): Removed need for regex, plus small refactoring

---------

Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2c762c4)
felixfontein pushed a commit that referenced this issue Feb 25, 2023
…roOS (#6077)

Added support for openSUSE MicroOS (#5998)

* fix(zypper): Added condition to check for transactional-update binary to support microos

closes #5615

* style(changelog): Made zypper-change uppercase

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix(zypper): Removed check for /var/lib/misc/transactional-update.state

* feat(zypper): Aligned transactional-update checks with zypper's

* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount

* refactor(zypper): Removed need for regex, plus small refactoring

---------

Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2c762c4)

Co-authored-by: andre161292 <andre161292@users.noreply.github.com>
felixfontein pushed a commit that referenced this issue Feb 25, 2023
…roOS (#6078)

Added support for openSUSE MicroOS (#5998)

* fix(zypper): Added condition to check for transactional-update binary to support microos

closes #5615

* style(changelog): Made zypper-change uppercase

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix(zypper): Removed check for /var/lib/misc/transactional-update.state

* feat(zypper): Aligned transactional-update checks with zypper's

* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount

* refactor(zypper): Removed need for regex, plus small refactoring

---------

Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2c762c4)

Co-authored-by: andre161292 <andre161292@users.noreply.github.com>
jikamens pushed a commit to jikamens/community.general that referenced this issue Feb 25, 2023
* fix(zypper): Added condition to check for transactional-update binary to support microos

closes ansible-collections#5615

* style(changelog): Made zypper-change uppercase

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix(zypper): Removed check for /var/lib/misc/transactional-update.state

* feat(zypper): Aligned transactional-update checks with zypper's

* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount

* refactor(zypper): Removed need for regex, plus small refactoring

---------

Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module os packaging plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants