当我gedit
在使用 时Ubuntu 20.04
,无论何时我单击 中的任何复选框Preferences
,都不会发生任何事情。
例如,当我单击 时Display line numbers
,复选框仍处于选中状态。出于某种原因,单击Display grid pattern
、Enable text wrapping
和Do not split words over two lines
可以正常工作,但当我退出Preferences
并重新进入时,它们会恢复到原始状态,如图所示。
其他选项卡中的所有其他选项均无法更改。
编辑:显然,以普通用户身份Preferences
使用时有效,而不是 root用户gedit
。之前,我试图将Preferences
现在,我想知道为什么不能以 root 身份更改首选项。我注意到,当我gedit
以普通用户身份使用时,终端上不会弹出任何内容,但是当我gedit
以 root 身份打开时,终端中会显示以下消息:
(gedit:2024): dconf-WARNING **: 21:01:08.260: failed to commit changes to dconf: The connection is closed
(gedit:2024): dconf-WARNING **: 21:01:08.270: failed to commit changes to dconf: The connection is closed
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
(gedit:2024): dconf-WARNING **: 21:01:08.509: failed to commit changes to dconf: The connection is closed
(gedit:2024): dconf-WARNING **: 21:01:08.509: failed to commit changes to dconf: The connection is closed
(gedit:2024): dconf-WARNING **: 21:01:08.510: failed to commit changes to dconf: The connection is closed
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
(gedit:2024): dconf-WARNING **: 21:04:00.840: failed to commit changes to dconf: The connection is closed
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
答案1
当启动 GUI 应用程序(例如gedit
,使用)时sudo
,您必须使用sudo -H
,如下所示:
sudo -H gedit /path_to/filename