0

I was working in Ubuntu 16.04 Xenial.

I was trying to upgrade from Python 3.5 to Python 3.8.

After doing pip install, I checked python3 --version it was still showing version 3.5.

So, I removed python 3.5 intending to reinstall Python 3.8 using the following commands:

$sudo apt list --installed | grep "python"

$sudo apt remove python3.5 (or the version the above command returned)

$sudo apt purge python3.5

Now, I see a blank purple screen. I can neither log in to the GUI nor the terminal.

How can I restore the lost system files without damaging working data?

Note: The machine is shared. So, there are other user accounts on the device. Therefore, a fresh install isn't an option.

6
  • 1
    Ubuntu 16.04 LTS has reached the end of it's standard support life thus is now off-topic here unless your question is specific to helping you move to a supported release of Ubuntu. Ubuntu 16.04 ESM support is available, but not on-topic here, see askubuntu.com/help/on-topic See also ubuntu.com/blog/…
    – guiverc
    Commented Jan 28, 2023 at 2:50
  • Ubuntu Desktop uses python3 for many tools; and it only reliably works with the version supplied. When you change the default python3 version, you lose access to those tools; which include GUI terminal, as well as many GUI functions.. Text terminals will still login, so you can reverse you changes (or just revert your backups), but 16.04 isn't on-topic here due to EOSS, reaching the end of it's five year standard supported life in 2021-April; ESM support options do exist if you do need to use 16.04 (or refer on-topic link for SE Unix & Linux)
    – guiverc
    Commented Jan 28, 2023 at 2:53
  • 1
    You and your fellow users on that machine might revisit "a fresh install isn't an option." It should ALWAYS be an option after a catastrophe (which this might be if you lack the skills to fix it). A 6-year-old operating system that's been out-of-support for almost two years is a catastrophe waiting to happen.
    – user535733
    Commented Jan 28, 2023 at 2:55
  • FYI: One of the things I love about Ubuntu Desktop (and flavors of Ubuntu) is that you can non-destructively re-install the system when you make package mistakes, run an stupid rm type of command to a system directory, and fix the installed system is less than 15 minutes (ie. no user files are touched, and the manually installed packages I added get auto-reinstalled). You mention fresh install isn't an option; but you do realize that's not your only install option!
    – guiverc
    Commented Jan 28, 2023 at 2:58
  • After you have reinstalled, you can create python virtual environments to set up separate versions of python without destroying your system. Commented Jan 28, 2023 at 3:14

2 Answers 2

1

I was working in Ubuntu 16.04 Xenial.

Ubuntu 16.04 has been out of support since April 2021. Consider installing a later LTS version (e.g. 22.04, which will be supported until 2027).

Now, I see a blank purple screen. I can neither log in to the GUI nor the terminal. How can I restore the lost system files without damaging working data?

Flash Ubuntu 22.04 on a USB stick, and boot from it. You can use the live session to copy your data to an external hard drive (or, to a partition where Ubuntu is not installed).

Note: The machine is shared. So, there are other user accounts on the device. Therefore, a fresh install isn't an option.

After removing the default python version, none of the users will be able to access the GUI. Reinstalling is the least painful option.

0

Launch Ubuntu as you would usually. Allow it to reach the login screen completely. When you arrive, avoid signing in. Instead, on your keyboard, press Ctrl + Alt + F3. Ubuntu will transition from the graphical login screen to a terminal that is just in black and white.

When prompted, type your username. When prompted for your password, type it in. You'll land on a terminal screen that looks familiar. Just as in your graphical terminal windows, you can navigate here.

You should check the file in your home folder. You need to be there right away after logging in. You must look up the file with the proper flags because it is a hidden "dot file." The following command performs a search using ls and grep.

The file's permissions should be mentioned first, followed by its owner's username and group. You've identified the issue's root if "root" is listed there.

2
  • the log-in screen is not visible.
    – user366312
    Commented Jan 28, 2023 at 7:06
  • Instead, on your keyboard, press Ctrl + Alt + F3. --- already tried. nothing happens.
    – user366312
    Commented Jan 28, 2023 at 7:06

Not the answer you're looking for? Browse other questions tagged .