VLC 和 Snap-Store 无法打开,并在 ubuntu 20.04 中显示错误权限被拒绝

VLC 和 Snap-Store 无法打开,并在 ubuntu 20.04 中显示错误权限被拒绝

我尝试打开 vlc 或 snap-store,但它们无法打开。尝试通过终端打开后,我收到以下错误,如下所示。vlc 错误:

snap run vlc
/snap/vlc/1700/bin/desktop-launch: line 51: /home/jd81197/.config/user-dirs.dirs: Permission denied
Error: unable to open display :0
VLC media player 3.0.11 Vetinari (revision 3.0.11-0-gdc0c5ced72)
xcb_connection_has_error() returned true
[000056540703fd50] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
ALSA lib conf.c:3916:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
[000056540704bbe0] main interface error: no suitable interface module
[0000565406f73b40] main libvlc error: interface "globalhotkeys,none" initialization failed
[0000565406f73b40] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000056540704bbe0] skins2 interface error: cannot initialize OSFactory
[0000565406f703c0] main playlist: playlist is empty
[000056540704bbe0] [cli] lua interface: Listening on host "*console".
VLC media player 3.0.11 Vetinari
Command Line Interface initialized. Type `help' for help.

snap-store 错误:

snap run snap-store
/snap/snap-store/467/snap/command-chain/desktop-launch: line 50: /home/jd81197/.config/user-dirs.dirs: Permission denied
sed: can't read /home/jd81197/.config/user-dirs.dirs: Permission denied
/snap/snap-store/467/snap/command-chain/desktop-launch: line 238: /home/jd81197/.config/user-dirs.dirs: Permission denied
cp: cannot open '/home/jd81197/.config/user-dirs.locale' for reading: Permission denied
/snap/snap-store/467/snap/command-chain/desktop-launch: line 243: /home/jd81197/.config/user-dirs.locale: Permission denied
realpath: '': No such file or directory
realpath: '': No such file or directory
realpath: '': No such file or directory
realpath: '': No such file or directory
realpath: '': No such file or directory
realpath: '': No such file or directory
realpath: '': No such file or directory
realpath: '': No such file or directory
cp: cannot stat '/snap/snap-store/467/gnome-platform/usr/share/mime': No such file or directory
/snap/snap-store/467/snap/command-chain/desktop-launch: line 20: /snap/snap-store/467/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0: No such file or directory
ERROR: /snap/snap-store/467/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0 exited abnormally with status 127
Directory '/home/jd81197/snap/snap-store/467/.local/share/mime/packages' does not exist!
ERROR: update-mime-database /home/jd81197/snap/snap-store/467/.local/share/mime exited abnormally with status 1
/snap/snap-store/467/usr/bin/snap-store: error while loading shared libraries: libgdk_pixbuf-2.0.so.0: cannot open shared object file: No such file or directory

谁能分享一些关于如何修复这些权限被拒绝错误的见解。

答案1

对于大多数 X11 gui 应用程序,您可以导出运行 Xserver 的用户的相同 DISPLAY 变量并xhost +以该用户身份运行,以允许其他用户访问 Xserver。
对于 snap,您必须将添加export DISPLAY=$YourDisplayValue到运行 snap 命令的用户 .bashrc 中。
我不记得如何以编程方式执行此值以使其更具可移植性,但它通常不会发生太大变化。显然,将环境传递给 snap 应用程序有点困难。
但这在当前的 20.04 上对我有用

相关内容