我正在使用 pkexec / xhost 为另一个用户“myOtherUser”打开图形文件资源管理器
- 使用 Ubuntu 18.04,我可以通过鼠标右键单击“打开终端”来打开命令 shell。
- 但是,在新机器上使用 Ubuntu 22.04 时,当我使用鼠标右键单击上下文菜单“在终端中打开”时出现以下错误:“无法执行子进程“dbus-launch””
脚本:
#!/bin/sh
xhost +SI:localuser:myOtherUser
pkexec --user myOtherUser env DISPLAY=$DISPLAY nautilus
xhost -SI:localuser:myOtherUser
日志输出
localuser:myOtherUser being added to access control list
(org.gnome.Nautilus:3429): dbind-WARNING **: 18:11:36.147: Couldn't connect to accessibility bus: Failed to connect to socket /run/user/1000/at-spi/bus: Permission denied
(org.gnome.Nautilus:3429): libunity-CRITICAL **: 18:11:36.286: file unity-launcher.c: line 1638: unexpected error: Failed to execute child process “dbus-launch” (No such file or directory) (g-exec-error-quark, 8)
(org.gnome.Nautilus:3429): libunity-CRITICAL **: 18:11:36.286: unity_launcher_entry_dbus_impl_construct: assertion 'conn != NULL' failed
(org.gnome.Nautilus:3429): libunity-CRITICAL **: 18:11:36.288: unity-inspector.vala:96: Unable to connect to session bus: Failed to execute child process “dbus-launch” (No such file or directory)
(org.gnome.Nautilus:3429): dconf-WARNING **: 18:11:36.409: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
(org.gnome.Nautilus:3429): dconf-WARNING **: 18:11:36.409: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
(org.gnome.Nautilus:3429): LIBDBUSMENU-GLIB-WARNING **: 18:11:36.448: Unable to get session bus: Failed to execute child process “dbus-launch” (No such file or directory)
** (org.gnome.Nautilus:3429): CRITICAL **: 18:11:36.474: update_dbus_opened_locations: assertion 'dbus_object_path' failed
(org.gnome.Nautilus:3429): dconf-WARNING **: 18:11:36.475: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
(org.gnome.Nautilus:3429): GLib-GIO-CRITICAL **: 18:11:36.513: g_dbus_proxy_new_sync: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
(org.gnome.Nautilus:3429): GLib-GIO-CRITICAL **: 18:11:36.513: g_dbus_proxy_get_cached_property: assertion 'G_IS_DBUS_PROXY (proxy)' failed
Nautilus-Share-Message: 18:11:36.575: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
(org.gnome.Nautilus:3429): dconf-WARNING **: 18:11:40.854: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Failed to execute child process “dbus-launch” (No such file or directory)
我该如何解决这个问题?谢谢你的帮助!
答案1
安装 dbus-launch (通过sudo apt install dbus-x11
)对我有用
注意pkexec --user myOtherUser env DISPLAY=$DISPLAY nautilus
我改为sudo --user myOtherUser env DISPLAY=$DISPLAY nautilus