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

[snaps] when using --all-logs some command outputs will not be collected #3683

Open
arif-ali opened this issue Jun 21, 2024 · 2 comments · May be fixed by #3684
Open

[snaps] when using --all-logs some command outputs will not be collected #3683

arif-ali opened this issue Jun 21, 2024 · 2 comments · May be fixed by #3684
Milestone

Comments

@arif-ali
Copy link
Member

arif-ali commented Jun 21, 2024

Working with one of my engineering team members we discovered that snap command outputs will not be collected on the filesystem due to the strict confinement of snaps and hence not having permissions to the destination. A lot of snap related have been added over the past 6 months, and first time we've discovered this issue.

The output from STDOUT to files was introduced in PR #2729 to improve the memory management and speed of collection of the corresponding commands.

Some of the data around this is documented in Launchpad [1]

One possible workaround is that we could have a disable this feature with all logs if the command being run is a command from a snap, but I'll think of an idea on how we can achieve this moving forward.

[1] https://launchpad.net/bugs/2069941

@arif-ali arif-ali added this to the 4.8.0 milestone Jun 21, 2024
@arif-ali arif-ali assigned arif-ali and unassigned arif-ali Jun 21, 2024
arif-ali added a commit to arif-ali/sos that referenced this issue Jun 21, 2024
Resolves: sosreport#3683

Signed-off-by: Arif Ali <arif.ali@canonical.com>
@TurboTurtle
Copy link
Member

TurboTurtle commented Jun 22, 2024

Just to clarify, this is happening when sos is installed as a snap, yes? Not that the commands we are trying to collect are installed from snaps?

@arif-ali
Copy link
Member Author

So, this is when a package is a snap, and hence the command is being run from that snap package.

i.e. the maas plugin is triggered, the maas status command will run, but will not be able to get the output directly to the file due to snap confinement restrictions

arif-ali added a commit to arif-ali/sos that referenced this issue Jun 22, 2024
Resolves: sosreport#3683

Signed-off-by: Arif Ali <arif.ali@canonical.com>
arif-ali added a commit to arif-ali/sos that referenced this issue Jun 22, 2024
Resolves: sosreport#3683

Signed-off-by: Arif Ali <arif.ali@canonical.com>
@arif-ali arif-ali linked a pull request Jun 22, 2024 that will close this issue
6 tasks
arif-ali added a commit to arif-ali/sos that referenced this issue Jun 25, 2024
Resolves: sosreport#3683

Signed-off-by: Arif Ali <arif.ali@canonical.com>
arif-ali added a commit to arif-ali/sos that referenced this issue Jun 27, 2024
When using `_outfile` in the first `Popen` and the command beig run
is a snap, then this will not work, and will not write to the file and
will be blank.

Dividing this into 2, and use `cat` as the second and grabbing it from
the PIPE solves this problem.

Resolves: sosreport#3683

Signed-off-by: Arif Ali <arif.ali@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants