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

Error when installing packages with snap after update to 8.1.0 #6803

Closed
1 task done
maciejkra opened this issue Jun 28, 2023 · 13 comments · Fixed by #6826
Closed
1 task done

Error when installing packages with snap after update to 8.1.0 #6803

maciejkra opened this issue Jun 28, 2023 · 13 comments · Fixed by #6826
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type)

Comments

@maciejkra
Copy link

Summary

When trying to update install packages via snap module after upgrade to ansible 8.1.0 the task fails. Although they are properly installed.
Rolling back to the previous version (7.x) solves the issue.

Issue Type

Bug Report

Component Name

snap

Ansible Version

ansible [core 2.15.1]
  config file = None
  configured module search path = ['/Users/jamicque/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/8.1.0/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/jamicque/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.4 (main, Jun 20 2023, 17:23:00) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/opt/homebrew/Cellar/ansible/8.1.0/libexec/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

empty

Configuration

CONFIG_FILE() = None
PAGER(env: PAGER) = less

OS / Environment

Os X 13.4.1 (22F82)

Steps to Reproduce

- name: install microk8s on the host
  remote_user: root
  hosts: all
  gather_facts: false
  tasks:
  - name: install microk8s & kubectl
    snap:
      name:
        - microk8s
        - kubectl
      classic: yes

Expected Results

installed microk8s and kubectl without errors

Actual Results

https://gist.github.com/maciejkra/51d283c5b066a231fe38d6ad0aa02407

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 plugins plugin (any type) labels Jun 28, 2023
@felixfontein
Copy link
Collaborator

CC @russoz - could be related to #6468 or #6435.

@russoz
Copy link
Collaborator

russoz commented Jun 29, 2023

hi @maciejkra thanks for reporting this issue. I assume the OSX 13.4.1 you reported is the OS on the controller node. Could you please confirm what the OS is on the target node? TIA

@maciejkra
Copy link
Author

Oh sorry it was my mistake.
The target node is Ubuntu 22.04

@russoz
Copy link
Collaborator

russoz commented Jun 29, 2023

I ran that same input on my local vagrant setup and could not reproduce the error - microk8s and kubectl were installed without issues. Will have to investigate further.

@russoz
Copy link
Collaborator

russoz commented Jun 29, 2023

What I'm seeing so far is:

  • the actual snap commands don't seem to be failing
  • the snap output in the gist seems to be a lot more verbose than mine, including colors and progress reporting
  • the line where the exception is raised is hit when it fails to parse the output of the snap command

So that leads me to believe that the parsing is the problem. I still don't know why the output in my test is more terse than yours. Any thing you could think of?

Anyways, it's late here at GMT+12, I'll resume this tomorrow.

@maciejkra
Copy link
Author

Hi,
I don’t have any idea, apart from that, that if I downgrade to v.7 it works fine.
So decently some issue is happening only with newer version

@russoz
Copy link
Collaborator

russoz commented Jun 29, 2023

Good morning from the other side.

vagrant@ubuntu-jammy:~$ snap version
snap    2.59.5
snapd   2.59.5
series  16
ubuntu  22.04
kernel  5.15.0-75-generic

Could you please compare this output with yours and let us know the differences? TIA

In the mean while, I continue to try and find out why snap here produces a different output from snap there.

@russoz
Copy link
Collaborator

russoz commented Jun 29, 2023

@maciejkra do you have anything configured in /etc/snap? In this local VM I have here, even after installing snapd there is no /etc/snap at all. Just shaking that tree as well.

@maciejkra
Copy link
Author

Hi, the OS ia am testing this on is a standard VM from Digital Ocean. Sorry I was testing it on 22.10 not 22.04.

Bellow is the configuration output:

snap    2.57.4+22.10ubuntu1
snapd   2.57.4+22.10ubuntu1
series  16
ubuntu  22.10
kernel  5.19.0-23-generic

Answering your question no dictionary in /etc/snap
Downgrading ansible, solves the issue.

@russoz
Copy link
Collaborator

russoz commented Jul 2, 2023

Hi @maciejkra

I am tailoring an unit test to reproduce that situation, and based on the outputs provided (thank you!) we have managed to reproduce the error in unit testing.

I still find it odd that we fail to reproduce that in the local VMs though. I have ran it with Ubuntu 22.04 and 22.10, the vagrant images used were:

  • ubuntu/jammy64 (Ubuntu 22.04)
  • generic/ubuntu2210

In your tests, the output is consistent with the output we get when running snap manually in a terminal, with the fancy progress bar and all the terminal sparks and gimmicks associated with that. In my test setup, snap seems to be running as if not associated with a terminal, and that's what I have experienced whenever I run Ansible for anything. I am wondering what could be set up differently to cause that behaviour. @felixfontein any ideas there? Maybe something in ansible.cfg ?

@maciejkra
Copy link
Author

@russoz thank you #6826 fixes the issue!

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 has_pr module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants