2

Ubuntu 22.04.01 LTS Gnome Version 42.5


Terminal won't open either via the GUI or by the keyboard shortcut. When I click the GUI icon a circle merely spins.

Keyboard shortcuts tried:

  • ctrl + alt + del
  • ctrl + alt + F7
  • ctrl + alt + F1

Automatic updates notified me that there was an error when checking for updates. 25% of apps pinned to my dock won't open when clicked. Apart from that everything seems normal. I am able to connect to the internet and use firefox.

The only thing I changed today was upgrading to python 3.11. These problems occurred around 4 hours after making those changes.

For that here is what I did:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
sudo update-alternatives --config python3

When I restarted the system there was a firmware update, but these issues were occurring prior to that update.

This similar question didn't solve anything: "Problem occurred when checking for updates" and now I can't use terminal

muru
  • 197,895
  • 55
  • 485
  • 740

2 Answers2

4

Problem

You changed the default system-wide python3 version ...

Each Ubuntu release has a default version of python3 for system-wide use ... This default version must not be changed by the user as Ubuntu relies heavily on python and most applications are written/maintained with the default python version in mind ... For example gnome-terminal (3.44.0-1ubuntu1) in Ubuntu 22.04(Jammy) depends on python3 (3.10.4-0ubuntu2)(This might get minor version automatic updates from the official release-specific repositories during the release life but shouldn't be altered manually by the user)

Solution

Undo what you have done ...

Boot into the live USB(Like the one you used to install Ubuntu) Ubuntu system and select Try Ubuntu then connect to Internet(might be needed if installing/upgrading packages) from the live system and open a terminal then follow these steps:

  • Run:

    sudo fdisk -l
    

    And identify your original system's root / partition on the HDD. It could be something like /dev/sda1 then mount it to /mnt like so:

    sudo mount /dev/sda1 /mnt/
    
  • Then run:

    sudo mount --bind /proc/ /mnt/proc/
    
  • Then run:

    sudo mount --bind /sys/ /mnt/sys/
    
  • Then run:

    sudo mount --bind /dev/ /mnt/dev/
    
  • Then run:

    sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
    
  • Then run:

    sudo chroot /mnt/
    

Now you are in your original system on the hard disk with a working terminal and Internet connection ... Run whatever command/s you need to fix the system-wide python3 and change it back to the original release default version … You won’t need to use sudo as commands you run here will run as the user root … Be careful though.

When finished,

  • Run:

    exit
    
  • Then run:

    sudo umount /mnt/dev/
    
  • Then run:

    sudo umount /mnt/sys/
    
  • Then run:

    sudo umount /mnt/proc/
    
  • Then run:

    sudo umount /mnt/
    
  • Then reboot to your original system, and see if it is fixed.

If this does not work, you'll probably need to reinstall Ubuntu.

Important:

If you get to the point where nothing worked and you decided to reinstall Ubuntu, make sure you backup all your important data to an external disk first.

Also to minimize loosing your settings, copy your home directory(i.e. /home/username/) with all its hidden directories and files to an external disk then copy it back again after the new install. This will keep most of your settings for applications i.e. Firefox, Thunderbird... etc but you will need to reinstall applications and packages you manually installed again for that to work.

Suggestion

Never change the default system-wide python3 version again ... You might however use other python versions on your system to run your own projects/code either by using the executable python binary file directly or in a virtual environment ... Please see:

Raffa
  • 32,237
  • Those commands executed, but whenever I tried to alter the system I would get: sudo: unable to allocate pty: No such device

    @Raffa

    – Exquisite Mong Jan 08 '23 at 16:05
  • @ExquisiteMong Sorry for the late reply … I don’t know how I missed your comment … You can solve that by ether becoming root by running sudo -i before running the first command then you don’t need to use sudo afterwards … or by mounting /dev/ recursively with sudo mount --rbind /dev/ /mnt/dev/ instead of the none-recursive mount sudo mount --bind /dev/ /mnt/dev/ – Raffa Jan 12 '23 at 14:31
-1

You forced Linux to use Python 3.11

I am no expert in Linux. Just change it back and it will work fine

sudo update-alternatives --config python3

and choose 1

I have script that need 3.11 to work, so i change that config every time when i need that script then i change it back on 3.10. when im done. It would be great if someone knows how to force some app to use python 3.11 without changing whole Linux to 3.11.

python3 --version

With this line can see what Python is active.

sudo update-alternatives --config python3

And with this you change what is active.

That is all I know for that problem.

Artur Meinild
  • 26,018
  • That won't work as written because he's hasn't got a working terminal. The accepted answer explains what to do in the case of a non-working terminal. – karel Feb 15 '24 at 11:02