1

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

7
  • 1
    It’s not the update … It’s changing the default system python that is the problem … Change it back and use a virtual environment with python 3.11 for your projects … And never mess with system-wide python version again.
    – Raffa
    Jan 4 at 15:05
  • 2
    Did you try Ctr+Alt+F3 (or F4, F5, ...)?
    – FedKad
    Jan 4 at 15:49
  • 1
    Yes. It seems I need to revert python but I don't know how without terminal. Jan 4 at 15:55
  • 1
    Follow the steps for booting from a live USB in this answer but don’t install the python version in that answer as it’s for an older Ubuntu release … Instead, after the sudo chroot /mnt/ step, just run your commands to revert to original system python and then just exit and unmount and reboot.
    – Raffa
    Jan 4 at 16:09
  • 3

1 Answer 1

2

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.

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:

2
  • Those commands executed, but whenever I tried to alter the system I would get: sudo: unable to allocate pty: No such device @Raffa Jan 8 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 at 14:31

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.