6

After uninstalling some python packages (got rid of of 3.9 and 3.8), I rebooted my computer and now it gets stuck at the boot screen with the motherboard logo, right before the ubuntu loading screen.

I have recently updated my graphics drivers and have installed cuda, so I thought that might have something to do with it. I did ctrl + alt+F2 and ran sudo apt-get purge nvidia* following the advice from this thread https://askubuntu.com/a/974910/1196087 It did not help.

I have also tried installing various packages, I've used the recovery mode dpkg to repair any broken packages, but anything I try to install or upgrade, including sudo apt update and --fix-missing commands get errors such as "Temporary failure resolving x", "Failed to fetch x": Failed to fetch

The boot parameters look like this if that is of any help: boot parameters

Please let me know if you need any more info.

Appreciate any help!

  • 2
    No surprise save your data and install new. – nobody Mar 25 '21 at 19:29
  • No surprise? Is it common for Ubuntu to get irreversibly corrupted after uninstalling python packages? I will look into retrieving my data and reinstalling thanks – Doctorhmmm Mar 25 '21 at 19:32
  • 3
    The operating system needs python. With great power comes great responsibility. If you tell your system to uninstall an essential package, it will obey. See: https://askubuntu.com/a/1321433 – Nmath Mar 25 '21 at 19:40
  • I love how I can just casually destroy my whole system by downgrading from python 3.9 to 3.7. Is there no way of fixing this other than complete reinstall? Python 3.7 is still there – Doctorhmmm Mar 25 '21 at 20:05
  • Welcome to Linux, where you have the freedom to completely trash your installed OS by not looking before you leap. The 'net is littered with questions from people who have done the same thing you did. Boot to a live USB and backup the data in /home/ and consider this a chance to learn something new. The system can't protect itself from you. – KGIII Mar 25 '21 at 20:26
  • If there are so many people that keep doing the same mistake then its just bad design. Why not have a warning or a little note when attempting to uninstall or downgrade python packages? Anyways... thanks for the suggestions, I’ll do the big reinstall – Doctorhmmm Mar 25 '21 at 20:32
  • 1
    There were warnings in that you got listed the packages that were being removed; if you read the list you would have detected the issues you'd have had next boot; but you accepted the removal thus giving permission (why it asks for permission to continue which some users stupidly give before they read the warnings with a '-y'). You need to install python3-minimal | 3.8.2-0ubuntu2 | focal | amd64, arm64, armhf, i386, ppc64el, riscv64, s390x at a minimum back, plus anything else you forced removal (viewable in apt logs) and you're okay; re-install is often quicker (non-destructive install) – guiverc Mar 25 '21 at 21:47
  • If there are so many people that keep doing the same mistake then its just bad design -- The users are supposed to look at the packages that will be removed. There are reasons why it asks for a password to install/remove even a small program. A user is even allowed to delete the root directory. – Archisman Panigrahi May 30 '21 at 10:57
  • @Ulfren You’re not supposed to know by heart all dependencies of the system, but as a rule of thumb, when removing a package and you see that other packages are going to be removed in the process, it’s certainly worth checking. Especially when the list is huge ! That being said, I perfectly understand your frustration. – NovHak Nov 12 '22 at 01:17

3 Answers3

7

First of all, you need to boot into recovery mode and select:

root            Drop to root shell prompt

Then check if you have an active internet connection by pinging Google's DNS server. If you have, skip the first step and go to the second step.

  1. Execute these commands

    ip link
    ip link set <interface> up
    dhclient <interface>
    ip addr show dev <interface>
    

    If you got an IP address from your router check the internet connection again by pinging Google's DNS server.

  2. Install ubuntu-desktop and reboot:

    sudo apt-get install ubuntu-desktop
    reboot
    

After these steps you should be able to boot into Ubuntu.

  • This worked perfectly. I entered into recovery mode. Entered my credentials ran install ubuntu-desktop. After a reboot Ubuntu was installed, it preserved my Windows dual boot, and preserved my Ubuntu files. No need to ping. – GBG Apr 27 '22 at 18:19
  • Didn't work for me, gives unmet dependencies Try apt --fix-broken install, and even this command doesn't work. Once you mess with Python library, you are done with Ubuntu, you have to reinstall, no other way. – Sumeet Jun 14 '23 at 18:31
0

Press alt+F2 when a cursor blinks. This should get you to tty (terminal).

If you got tty on the screen just run:

sudo apt-get install ubuntu-desktop
reboot

If no gui is on press esc or shift before splash and run:

sudo apt-get install ubuntu-desktop
reboot

the problem here is that you lost the gnome, so you need to install it again. No worries about losing data or files.

0

Faced the same issue (By mistake uninstalled Python) and for me the safe mode even was not working. The ubuntu desktop was gone and it was landing to terminal after restart all the time. While running commands it was throwing messages like-

unmet dependencies Try apt --fix-broken install

After investing 12 hours and to save my critical data the steps to bring back the VM could be summarized in below steps:

  1. switch to root user sudo su -

  2. Internet connectivity was gone. I tried pinging google from my ubuntu box and it threw error -

network is unreachable

So to solve this issue first I had to run below commands

sudo rmmod e1000
sudo rmmod e1000e
sudo rmmod igb
sudo modprobe e1000
sudo modprobe e1000e
sudo modprobe igb
sudo dhclient ens33
  1. Now internet was back, I was able to ping google dns. If your internet is

    working you can skip step 2; Next commands-

sudo apt-get update && sudo apt-get upgrade
sudo apt --fix-broken install
sudo apt-get purge network-manager
sudo apt-get install network-manager --fix-broken
sudo apt-get install ufw --fix-broken
sudo apt-get install python3:any --fix-broken
sudo apt-get install ubuntu-desktop

Hurrah ! The terminal switched back to linux desktop view and everything was the same as before.