Score:2

Terminal and other apps suddenly won't open

tk flag

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

Raffa avatar
jp flag
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](https://askubuntu.com/a/1443735) for your projects … And never mess with system-wide python version again.
Exquisite Mong avatar
tk flag
Ah, ok. But how can I revert it without terminal? @Raffa
FedKad avatar
cn flag
Did you try Ctr+Alt+F3 (or F4, F5, ...)?
Exquisite Mong avatar
tk flag
Yes. It seems I need to revert python but I don't know how without terminal.
Raffa avatar
jp flag
Follow the steps for booting from a live USB in [this answer](https://askubuntu.com/a/1304951) 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 avatar
jp flag
Helpful subject related info [here](https://askubuntu.com/q/1347748) and [here](https://askubuntu.com/q/1321421)
karel avatar
sa flag
Does this answer your question? [Removed Python 3 and now Ubuntu Software Center, terminal and other applications don't work](https://askubuntu.com/questions/384033/removed-python-3-and-now-ubuntu-software-center-terminal-and-other-applications)
Score:4
jp flag

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:

Exquisite Mong avatar
tk flag
Those commands executed, but whenever I tried to alter the system I would get: `sudo: unable to allocate pty: No such device` @Raffa
Raffa avatar
jp flag
@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/`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.