42

I have uninstalled python3 via:

apt-get remove python

I lost the dashboard and terminal. Even the desktop is blank. Also the top bar which shows time and other setting options are gone. Basically I can see my desktop wallpaper when I open my laptop.

Whenever I open my laptop it shows following before showing the login. However, I can access the Ubuntu advanced options. I need to restore my data because it has my college projects.

Enter image description here

4
  • 10
    This is why it is always good to read the output of a command before confirming the removal of essential packages. Also, in the future, maybe --dry-run can be helpful to avoid this sort of situation.
    – Léo Lam
    Aug 11, 2016 at 11:51
  • 7
    why? Why did you think it was a good thing to remove the python package? Basically half of Ubuntu is built in python...
    – Bakuriu
    Aug 11, 2016 at 15:46
  • 2
    apt-get remove python will remove python 2.
    – James K
    Aug 11, 2016 at 17:46
  • @Bakuriu why would someone know that?
    – Moberg
    Nov 3, 2022 at 19:23

3 Answers 3

81

You can press Ctrl+Alt+F5 to get a shell. Once there, try reinstalling Python and anything else you may be missing:

sudo apt-get install python3-all
sudo apt-get install gnome-terminal

If nothing seems to work properly, or your dependencies have been messed up, try installing all of the desktop components again. This should give you all of the dependencies you need.

sudo apt-get remove ubuntu-desktop
sudo apt-get install ubuntu-desktop
3
  • 3
    Maybe apt-get install --reinstall instead of separate remove and install commands?
    – Nobody
    Aug 11, 2016 at 17:31
  • 3
    @Nobody ubuntu-deskop is just a meta package, so a reinstall will effectively do nothing in this case. Aug 11, 2016 at 19:44
  • No, ubuntu-desktop installs all the related packages in my system. After I removed python accidentally when trying to upgrade from 16 to 18.
    – Vignesh
    Sep 12, 2018 at 11:14
10

Python3 is used by many system components on Ubuntu.. removing that will break a lot (as you just witnessed). Can you try to simply reïnstal Python3 again with sudo apt-get install python3?

2
  • 2
    His problem appears to be that he has no access to the terminal, therefore has nowhere to enter the command to re-install python
    – Jon Story
    Aug 11, 2016 at 16:05
  • @JonStory, use tty3.
    – ar2015
    Sep 20, 2021 at 21:59
7

Your current install is likely damaged beyond repair and needs to be wiped.

Boot up a live CD and mount your current install drive. Copy any important documents to a flash drive and reinstall Ubuntu.

Note that while you may be able to just reinstall Python, there may still be other (deeper) damage that isn't just apparent yet. You can run the following command to try to repair your OS:

sudo apt-get install --reinstall ubuntu-desktop
2
  • 5
    Note that a 'Live CD' these days can also be a flash drive or in some cases even a phone.
    – Cronax
    Aug 11, 2016 at 12:41
  • I think before that need to check common-software-properties and install if missing Nov 17, 2019 at 14:20

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