top of page
  • Writer's pictureHaripriya

Ubuntu worries | What’s with upgrading Python and gnome-terminal crashing?

Updated: Jan 16

Ubuntu worries


My Story: Being a happy Ubuntu user, I enjoy ‘the-boring-interface’. So, when it came to organizing my work log, I chose zimwiki. However, the basic journal plugin of the software did not work. After surfing for quite sometime, I realized that this requires minimum version of Python3 and above in Ubuntu 16.04 (which wasn’t explicitly mentioned anywhere in the website).




I followed the steps mentioned here and happily upgraded my Python to 3.6 and rebooted my system. BOOM! My default gnome-terminal died!



What happened Next?


I quickly JUMPED into resolving the issue. I tried below possible solutions that were widely suggested in various forums to wake up my gnome.

# update default alternatives and choose python 3.6
$ sudo update-alternatives --config python3

# Navigate to /usr/bin and edit gnome-terminal
$ cd /usr/bin
$ sudo nano gnome-terminal
$ #!/usr/bin/python3 to #!/usr/bin/python3.6.

Did it work? — No. Did I resolve at some point ? — Yes. How long did it take for me to resolve? — 2 days (Unfair!)


Why the dickens? — First of all, I started digging into resolution, without really knowing what I was hoping to resolve.


Ask right questions

I had to stop at some-point to ask myself, what on earth am I trying to solve? (An existential question that’s most often never asked!).

📋 ✍️ Hence, I followed the age-old practice of pen and paper to jot down relevant questions and wrote answers along the side.

  1. Why Python upgrade messes default Ubuntu packages?

✅ The answer is that, fairly large part of the Ubuntu system is written in Python. At the moment, for Ubuntu 16.04, the default code runs on Python 2.6; and the code won’t easily run on, say, Python 3.6 when you upgrade.


2. What changed between Python 2.6 and 3.6?


3. What is the library required to load gnome-terminal in Ubuntu?

✅ The answer was fairly straight forward, gi (graphical interface).

4. Does gi gets updated by default with python version upgrade? ✅ The answer is, Yes. After the installation is complete, you can change the original python3 of the system to the current 3.6, or you can use it without any changes. However, if you change the gnome-terminal directly, you will not be able to open it.

That was my mistake. Editing gnome-terminal directly from #!/usr/bin/python3 to #!/usr/bin/python3.6.

Now, the gnome-terminal won’t open, because there is no_gi package in it. So, it required to manually copy relevant gi and gi_cario libraries from 3.5 to 3.6. Below steps worked like Magic! Tada!


# Navigate to relevant gi python package
$ cd /usr/lib/python3/dist-packages/gi/# copy gi from version 3.5 to 3.6

$ sudo cp _gi.cpython-35m-x86_64-linux-gnu.so _gi.cpython-36m-x86_64-linux-gnu.so# copy gi_cario from version 3.5 to 3.6

$ sudo cp _gi_cairo.cpython-35m-x86_64-linux-gnu.so _gi_cairo.cpython-36m-x86_64-linux-gnu.so

Lessons learnt

  • Define the problem — Before you jump into the hole, ask yourself why

  • Know your tools better — Understand what OS you use and surf for relevant resolutions, instead of trying all possible methods

  • Seek out solutions in relevant forums —look out for answers in the same/similar domain space of your problem. Here, say, answers in Ubuntu forums are more reliable than any other.




29 views

Recent Posts

See All

Commentaires


bottom of page