Powershell: 2019/03/29 18:55:40.090235 cmd_run.go:876: WARNING: cannot create user data directory: failed to verify SELinux context of /home/foo/snap: exec: "matchpathcon": executable file not found in $PATH

Created on 29 Mar 2019  路  13Comments  路  Source: PowerShell/PowerShell

Environment data

2019/03/29 18:55:40.090235 cmd_run.go:876: WARNING: cannot create user data directory: failed to verify SELinux context of /home/foo/snap: exec: "matchpathcon": executable file not found in $PATH


Issue-Question Resolution-Answered

Most helpful comment

I've described a workaround here: https://forum.snapcraft.io/t/selinux-warning-when-running-lxc/11100/11
TLDR: install selinux-policy-default, set SELINUX=disabled in /etc/selinux/config and reboot the system.

All 13 comments

matchpathcon is a command from SELinux utilities (http://manpages.ubuntu.com/manpages/trusty/man8/matchpathcon.8.html). You probably need to install it. On Ubuntu : sudo apt install selinux-utils

The problem still persists after installation of selinux

2019/04/04 02:22:49.966135 cmd_run.go:876: WARNING: cannot create user data directory: failed to verify SELinux context of /home/foo/snap: exit status 1
PowerShell 6.2.0
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /home/foo>

having this issue in vscode on ubuntu 18.04.

PS /home/foo> uname -a
Linux foo2 5.0.6-050006-generic #201904030534 SMP Wed Apr 3 05:36:14 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
PS /home/foo> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic
PS /home/foo>

I also met this issue.

lxc list

2019/04/22 09:38:08.109128 cmd_run.go:876: WARNING: cannot create user data directory: failed to verify SELinux context of /home/nvidia/snap: exec: "matchpathcon": executable file not found in $PATH

after I install matchpathcon by "sudo apt install selinux-utils", I met below error.

cmd_run.go:876: WARNING: cannot create user data directory: failed to verify SELinux context of /home/nvidia/snap: exit status 1

I'am on Ubuntu 18.04, recently switched from kernel 4.20 to 5.06 and had the same problems. After downgrading to kernel 4.20 the problem was gone.

The problem is caused by booting a system with a kernel that has SELinux enabled in it's configuration and uses it as a default security backend (CONFIG_DEFAULT_SECURITY), while at the same time the userspace has none or just rudimentary support for SELinux. In other words, the system advertises that it supports SELinux, but is missing the userspace tools and/or policy bits to actually make it work.

AFAIK Ubuntu enables AppArmor as a default (and only) MAC in their kernels, and the userspace is built with similar assumption. It looks to me that the 'mainline' kernel people grab from some random PPA is not ready to be used with such userspace.

Thanks @bboozzoo and @zelgerj for the information. Any ideas for a workaround (without going back to the LTS kernel)?

I've described a workaround here: https://forum.snapcraft.io/t/selinux-warning-when-running-lxc/11100/11
TLDR: install selinux-policy-default, set SELINUX=disabled in /etc/selinux/config and reboot the system.

@bboozzoo Thanks. It works on my side :+1:

I'm running Ubuntu 18.04, so I've tested with the latest 5.0.9 kernel (still the same warning). To workaround I've updated /etc/default/grub and added GRUB_CMDLINE_LINUX="selinux=0" and regenerated the grub config with sudo update-grub and rebooted: warning gone.

Please fill out the issue template completely so that we can investigate.

I believe this answer is probably correct: https://github.com/PowerShell/PowerShell/issues/9252#issuecomment-486722749

This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.

Was this page helpful?
0 / 5 - 0 ratings