4

In my /usr/bin/gnome-terminal file, I have this error message :

Traceback (most recent call last):

File "/usr/bin/gnome-terminal", line 109, in <module>
main()
File "/usr/bin/gnome-terminal", line 99, in main
mainloop = GLib.MainLoop()
NameError: name 'GLib' is not defined

Do you know how to solve it please? I believe this is the reason why I cannot start gnome-terminal.

  • is it just by trying to start gnome-terminal or with a python code? if it's the 1rst case, where did Ubuntu prompt you this error? – damadam Oct 29 '19 at 11:38
  • Have you modified something in /usr/bin/gnome-terminal? What is the output of grep "from gi.repository import GLib, Gio" /usr/bin/gnome-terminal? – Kulfy Oct 29 '19 at 15:06
  • 2
    If you haven't customized anything I would use sudo apt install --reinstall gnome-terminal before investing alot of time. – WinEunuuchs2Unix Oct 29 '19 at 17:30
  • Please add to your question "glib" at the end, specifying the error – Josef Klimuk Oct 30 '19 at 6:54
  • The output is [from gi.repository import GLib, Gio ] – Fred007 Nov 2 '19 at 18:28
1

Your gnome-terminal program (Python Script) is corrupted. Here's some quick checks:

$ wc /usr/bin/gnome-terminal

 107  213 3368 /usr/bin/gnome-terminal

$ tail /usr/bin/gnome-terminal

    GnomeTerminal(sys.argv[:], mainloop)

    try:
        mainloop.run()
    except KeyboardInterrupt:
        pass


if __name__ == "__main__":
    main()
  • Word count program (wc) tells us it is 107 lines, 213 words and 3368 characters.
  • Tail program (tail) shows what the last 10 lines look like.

In your case an accident/bug caused part of gnome-terminal to be overwritten with garbage. Although we could spend time trying to figure out what caused the problem, it is easiest just reinstalling. Assuming there are no custom modifications done to gnome-terminal then:

  • Open console login with Ctrl+Alt+F3.
  • Log into the console with your User ID and Password.
  • Type sudo apt update && sudo apt install --reinstall gnome-terminal.
  • For Ubuntu 16.04 return to your GUI desktop with Ctrl+Alt+F7.
  • For Ubuntu 18.04+ return to your GUI desktop with Alt+F2.
  • I did the sudo apt update && sudo apt install --reinstall gnome-terminal. Unfortunately it did not work out – Fred007 Nov 2 '19 at 18:29
  • Did you run tail /usr/bin/gnome-terminal before and after reinstalling to confirm it was corrupted before and changed after? – WinEunuuchs2Unix Nov 2 '19 at 18:32
  • the tail gives me this output : – Fred007 Nov 3 '19 at 10:22
  • GnomeTerminal(sys.argv[:], mainloop) try: mainloop.run() except KeyboardInterrupt: pass if name == "main": main() – Fred007 Nov 3 '19 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.