gedit crashes system when launched from terminal as root

Asked by Guilherme on 2019-09-29

This happens whenever I try to edit a file (for example /etc/apt/sources.list) or open gedit with root privileges. Application window opens, characters are replaced by squares, and becomes impossible to drag or resize it as my system completely stalls. Also if firefox is open, it also becomes unresponsive and crashes.
This screenshot summarises what i have been experiencing so far:
Additionally, it also happens with nautilus.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gedit 3.28.1-1ubuntu1.2
ProcVersionSignature: Ubuntu 4.15.0-65.74-generic 4.15.18
Uname: Linux 4.15.0-65-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sun Sep 29 19:34:14 2019
InstallationDate: Installed on 2016-11-14 (1048 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
SourcePackage: gedit
UpgradeStatus: Upgraded to bionic on 2018-08-21 (403 days ago)

Question information

English Edit question
Ubuntu gedit Edit question
No assignee Edit question
Last query:
Last reply:
Bashing-om (bashing-om) said : #1

converted to a question.

Bashing-om (bashing-om) said : #2

Guilherme; Hey Hey

In reference to your Bug #1845892;
I have two possibilities in mind.

Memory ?
What shows:
free -m

Graphics ?
what shows:
sudo lshw -C display
cat /var/log/gpu-manager.log

Let's see where we go from these.

Guilherme (tichours) said : #3

Hi Bashing-om!

$free -m: (no big difference from when the symptoms occur)
                     total used free shared buff/cache available
Mem: 5839 2161 1068 254 2608 3155
Swap: 5859 0 5859

$sudo lshw -C display:
       description: VGA compatible controller
       product: 3rd Gen Core processor Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 09
       width: 64 bits
       clock: 33MHz
       capabilities: msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:28 memory:f7800000-f7bfffff memory:e0000000-efffffff ioport:f000(size=64) memory:c0000-dffff

$cat /var/log/gpu-manager.log:
log_file: /var/log/gpu-manager.log
last_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
new_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
can't access /run/u-d-c-nvidia-was-loaded file
can't access /opt/amdgpu-pro/bin/amdgpu-pro-px
Looking for nvidia modules in /lib/modules/4.15.0-65-generic/updates/dkms
Looking for amdgpu modules in /lib/modules/4.15.0-65-generic/updates/dkms
Is nvidia loaded? no
Was nvidia unloaded? no
Is nvidia blacklisted? no
Is intel loaded? yes
Is radeon loaded? no
Is radeon blacklisted? no
Is amdgpu loaded? no
Is amdgpu blacklisted? no
Is amdgpu versioned? no
Is amdgpu pro stack? no
Is nouveau loaded? no
Is nouveau blacklisted? no
Is nvidia kernel module available? no
Is amdgpu kernel module available? no
Vendor/Device Id: 8086:166
BusID "PCI:0@0:2:0"
Is boot vga? yes
Skipping "/dev/dri/card0", driven by "i915"
Skipping "/dev/dri/card0", driven by "i915"
Skipping "/dev/dri/card0", driven by "i915"
Found "/dev/dri/card0", driven by "i915"
output 0:
Number of connected outputs for /dev/dri/card0: 1
Does it require offloading? yes
last cards number = 1
Has amd? no
Has intel? yes
Has nvidia? no
How many cards? 1
Has the system changed? No
Single card detected
Nothing to do

Best regards.

Bashing-om (bashing-om) said : #4

 Guilherme; Hummmm ...

Does not appear to be a memory nor a graphics issue.
At this point I am grasping at straws.

When activating gedit with root privileges in terminal, any hints reported back to the screen ?
Error/info messages in context will be helpful at this point.

-sometimes I do wonder-

Guilherme (tichours) said : #5


I've had some terminal output using $sudo gedit ..., which was basically like this:
Now, using pkexec or the alternative sudo -H symptoms occur but no output.
As seen in the screenshot there is some complaint about DejaVu Sans font which I checked that is currently installed.

Bashing-om (bashing-om) said : #6

Guilherme; Well

A thought ->
Doing "sudo gedit" now who owns your /home ?

ls -al .ICEauthority .Xauthoriry
ls -ld / Guilherme/home

before we move on to investigating the font.

-gots to be a reason-

Guilherme (tichours) said : #7


Currently, .Xauthority. is not present. May this be the culprit?

$ ls -al .ICEauthority .Xauthoriry:
ls: cannot access '.Xauthority': No such file or directory
-rw------- 1 guilherme guilherme 12718 set 30 10:51 .ICEauthority

$ ls -ld / ~
drwxr-xr-x 26 root root 4096 set 27 20:20 /
drwxr-xr-x 108 guilherme guilherme 4096 set 30 10:51 /home/guilherme

$ ls -ld /home
drwxr-xr-x 3 root root 4096 fev 11 2017 /home

Yesterday, or before you turned this issue to question, I tried switching gdm from 'Ubuntu' to 'Ubuntu on wayland' and ran sudo gedit again to test. Terminal spit this:

$ sudo gedit ...
Unable to init server: Could not connect: Connection refused
(gedit:2652): Gtk-WARNING **: 08:19:10.568: cannot open display:

I was so overly frustrated by the situation and read something on askubuntu that lead me to this line:
$ xhost +SI:localuser:root

That apparently carried away the warning, but took me back to the starting point.
Today I switched gdm back to 'Ubuntu'.

Manfred Hampl (m-hampl) said : #8

I have two suggestions based on the messages in your screenshot:

1. "The owner of /home/guilherme/.config/ibus/bus is not root!"

I suggest that you run the command

rm -R /home/guilherme/.config/ibus/bus/

2. "failed to create ... font ... 'DejaVu Sans 11'"

I suggest that you run the command

sudo apt install --reinstall fonts-dejavu-core fonts-dejavu-extra

Finally try "sudo gedit /etc/apt/sources.list" again.
Do you still see the same problems and error messages?

If you run:

gedit admin:///etc/default/apport

Does the file open ok? You can always sidestep the issue and use vi or nano in the terminal.

Guilherme (tichours) said : #10

Manfred Hampl,

Ran the commands you mentioned and that cleared the warning messages, but 'sudo gedit' is still running at 100% cpu and crashing system wide.

I get the following logs on the terminal (no symptoms):

$ gedit admin:///etc/default/apport:
(gedit:13849): IBUS-WARNING **: 19:34:27.368: The owner of /home/guilherme/.config/ibus/bus is not guilherme!
** (gedit:13849): WARNING **: 19:34:27.548: The specified location is not mounted

Thanks for the tip on using the alternative editors, that's what I'm doing now.
Just found strange because I was accustomed to use gedit to make some quick modifications in system files.

sudo chown guilherme:guilherme /home/guilherme/.config/ibus/bus

Should do it....

Guilherme (tichours) said : #12


Nope, still crashing...

Manfred Hampl (m-hampl) said : #13

What is now the full output of running a command like

sudo gedit /etc/apt/sources.list

(please paste as text)

Guilherme (tichours) said : #14

Manfred Hampl,

Followed your instructions (#8) which cleared out the messages.
Unfortunately as I stated in #10, my system becomes inoperable as gedit gets 100% cpu usage the moment the gui shows up.
I'd like to provide some footage but sadly I can barely move the mouse pointer.

Guilherme (tichours) said : #15

Hi Manfred Hampl,

Today I found out that if I try to perform menu actions, like ctrl+f or just open the menu while gedit is running with sudo, it actually outputs this right before aborting:

(gedit:18977): Gtk-CRITICAL **: 13:01:41.134: gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

(gedit:18977): Gtk-CRITICAL **: 13:01:41.134: gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

(gedit:18977): GtkSourceView-WARNING **: 13:01:46.740: gtk_source_search_context_set_settings() is deprecated, the GtkSourceSearchContext:settings property will become a construct-only property in a future version.

(gedit:18977): Pango-WARNING **: 13:02:34.934: failed to create cairo scaled font, expect ugly output. the offending font is 'DejaVu Sans 11'

(gedit:18977): Pango-WARNING **: 13:02:34.934: font_face status is: out of memory

(gedit:18977): Pango-WARNING **: 13:02:34.934: scaled_font status is: out of memory

(gedit:18977): Pango-WARNING **: 13:02:34.934: shaping failure, expect ugly output. shape-engine='PangoFcShapeEngine', font='DejaVu Sans 11', text='Check Spelling…'

(gedit:18977): Pango-WARNING **: 13:02:34.939: failed to create cairo scaled font, expect ugly output. the offending font is 'DejaVu Sans 11'

(gedit:18977): Pango-WARNING **: 13:02:34.939: font_face status is: out of memory

(gedit:18977): Pango-WARNING **: 13:02:34.939: scaled_font status is: out of memory
Fontconfig error: Cannot load default config file

(gedit:18977): Gtk-WARNING **: 13:02:41.900: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/gnome/16x16/status/image-missing.png: Error opening file /usr/share/icons/gnome/16x16/status/image-missing.png: Too many open files (g-io-error-quark, 31)

Manfred Hampl (m-hampl) said : #16

When searching for the error messages that you got, I stumbled over Bug #1396048
Do you have symbolic links in your fonts directories?

Guilherme (tichours) said : #17

No, I don't.
Neither in /usr/share/fonts/ nor in ~/.fonts/

Guilherme (tichours) said : #18

Actually there are some subfolders in /usr/share/fonts/ that have links but none related to DejaVu Sans which appears in the console outputs.

Launchpad Janitor (janitor) said : #19

This question was expired because it remained in the 'Open' state without activity for the last 15 days.