【问题标题】:Debian/Ubuntu: grub-customizer fails to startDebian/Ubuntu:grub-customizer 无法启动
【发布时间】:2019-12-16 10:48:36
【问题描述】:
grub-customizer 最近被添加到 Debian 主存储库中,这很酷。
但是,当我尝试从应用程序菜单启动它时,输入密码后没有任何反应。
尝试从命令行启动它会导致错误:
cameronhudson:~$ pkexec grub-customizer
Unable to init server: Could not connect: Connection refused
(grub-customizer:13778): Gtk-WARNING **: 07:59:33.251: cannot open display:
如何让grub-customizer 启动?
【问题讨论】:
标签:
ubuntu
debian
grub2
debian-buster
【解决方案1】:
这个问题的解决方法包括两个部分:
-
创建pkexec 可以使用的“策略”。这是pkexec 和gksudo 之间的主要区别。历史上,gksudo 用于以 root 用户身份启动图形应用程序。但是,它已被弃用,取而代之的是 pkexec。
要创建策略,请创建一个包含以下内容的文件/usr/share/polkit-1/actions/org.freedesktop.policykit.grub-customizer.policy:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.example.pkexec.grub-customizer">
<description>Run Grub Customizer</description>
<message>Authentication is required to run Grub Customizer</message>
<icon_name>audio-x-generic</icon_name>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/grub-customizer</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>
-
在我写这篇文章时,有一个known bug in Wayland 需要额外的步骤。
首先,试试
pkexec grub-customizer
如果您收到此错误消息:
cameronhudson@debian:~$ pkexec grub-customizer
No protocol specified
Unable to init server: Could not connect: Connection refused
(grub-customizer:4111): Gtk-WARNING **: 09:32:29.152: cannot open display: :0
然后运行这个命令:
xhost +si:localuser:root
不要将“localuser”替换为您自己的用户名。将其保留为“本地用户”。
然后,再次尝试pkexec grub-customizer。
此外,您现在应该能够从应用程序菜单启动 Grub Customizer。