3

I'm using Xubuntu 19.10 and after installing Python 3.8.1 from ppa:deadsnakes/ppa, I decided that the installed by default python 3.7.5 is no longer needed and I did sudo apt remove --purge python3.7 -y. This incredibly bad idea blew off half of my system. I read that installing xubuntu-desktop again can restore the most of the broken things and it really works, but after rebooting I found that I'm no longer able to connect to the Internet. It seems that something more is removed and I missed to install it again. I saved the entire output after running the disastrous command and it is here.

  • Could this be fixed without reinstalling the entire Xubuntu?
  • Xubuntu doesn't have repair option, but if I install it on the same partition without formatting, will this preserve all my data, manually installed packages and configurations?
bobeff
  • 431

6 Answers6

5

I know you already answered yourself, but I broke the entire desktop after removing Python3.8 (including internet connection) and fixed it by manually installing every missing dependency that makes up netplan.io from a USB.

These missing dependencies were:

  • libpython3.8-minimal
  • libpython3.8
  • libpython3.8-stdlib
  • python3-distutils
  • python3-lib2to3
  • python3.8-minimal
  • python3.8
  • python3-yaml
  • python3-netifaces
  • libnetplan0

(you can download them as *.deb from https://pkgs.org/)

After that I finally could install netplan.io to get internet access and then repair everything with:

apt --fix-broken install
apt install ubuntu-desktop
apt update
apt upgrade

Everything started because I tried to upgrade python from 3.8 to 3.10 lol

Artur Meinild
  • 26,018
YoomarXD
  • 61
  • 1
  • 4
2

I managed to rescue my system by booting in recovery mode available in "Advanced Options for Ubuntu" in the GRUB boot menu. Then I had access at least to WiFi connection and by having working Internet again, I executed sudo apt --fix-broken install.

bobeff
  • 431
2

The reason why you can't connect to the internet via ethernet after uninstalling python3 is because... it removed netplan.io, yes, that netplan. This is from your output:

Removing netplan.io (0.98-0ubuntu1) ...
dpkg: warning: while removing netplan.io, directory '/etc/netplan' not empty so 
not removed

You will have to manually connect to the internet, then all you should have to do is:

sudo apt update
sudo apt install netplan.io
reboot

And you should be good to go, a different package controls wireless connections vs wired from what I understand.

1

Many ubuntu tools use python3 for their work, and expect the pre-installed version, and can stop working if it is removed or upgraded. It's best not to touch the original python3 if you rely on Ubuntu tools.

Yes you can install again, using 'something else', selecting your existing partitions but ensure you do not have format checked. That option will

  • take note of your added software
  • erase system directories
  • install new system
  • add back software you had added
  • won't touch user files unless you formatted

Note: this assumes you don't format. Also some programs do store config files in system directories thus they will be lost, but that applies generally only to server applications (desktop programs store their files in $HOME or your user directory so won't be touched).

Of course you should backup first, I'd do it from 'live' media just to be safe, but you'll no doubt already have backups in place, but better safe than sorry.

Your alternative is downloading python3-minimal (https://packages.ubuntu.com/eoan/python3-minimal) using wget (from another box & walk across on thumb-drive if necessary) and then install dpkg, and you may be able to resurrect your system without a re-install, but it'll take longer to test for damage than the re-install option (you're likely to have removed other needed components so you'll need to assess your logs & re-install back what is required...) Once python3-minimal is installed some tools will become available again...

guiverc
  • 30,396
  • 1
    You didn't answer the main question. Is it possible to enable the internet connection again? – bobeff Feb 07 '20 at 22:11
  • 1
    You'll need to look at logs and see what was removed. By using the '-y' option you gave permission for loads to be removed (you should avoid using '-y' unless you're 110% sure of what will occur). I suspect yes, but without knowing what you actually removed I cannot be sure unless you provide that detail (ie. all packages you okay'ed removal to with the -y command from logs; that can differ depending on what you'd packages you'd installed post-install which I cannot know). With python3-minimal yes it'll fix, unless your command removed other things needed too – guiverc Feb 07 '20 at 22:29
0

Running Ubuntu 20.04, I accidentally deleted python3 which inevitably corrupted my internet connection (i.e. unable to ping) and failed to load the Ubuntu GUI / login screen.
I followed instructions provided from @YoomarXD and also had to download "netplan.io" deb package as well: https://pkgs.org/download/netplan.io

To fix python3, restore internet (LAN) and the Ubuntu GUI

Download dependencies

  • libpython3.8-minimal
  • libpython3.8
  • libpython3.8-dev
  • libpython3.8-stdlib
  • python3-distutils
  • python3-lib2to3
  • python3.8-minimal
  • python3.8
  • python3.8-dev
  • python3-yaml
  • python3-netifaces
  • libnetplan0
  • 2to3
  • netplan.io


  • Switch to Terminal

  • 'safe mode'
  • or
  • press 'control' + 'alt' + 'F5'


  • Mount USB Stick

    Find USB device
    sudo fdisk -l
    Mount device
    sudo mkdir /media/usb sudo mount [DEVICE] /media/usb

    Install dependencies

    sudo dpkg -i
    sudo dpkg -i libpython3.8-minimal_3.8.2-1ubuntu1_amd64.deb sudo dpkg -i libpython3.8-stdlib_3.8.2-1ubuntu1_amd64.deb sudo dpkg -i libpython3.8_3.8.2-1ubuntu1_amd64.deb sudo dpkg -i libpython3.8-dev_3.8.2-1ubuntu1_amd64.deb sudo dpkg -i python3.8-minimal_3.8.2-1ubuntu1_amd64.deb sudo dpkg -i python3.8_3.8.2-1ubuntu1_amd64.deb sudo dpkg -i python3.8-dev_3.8.2-1ubuntu1_amd64.deb
    sudo dpkg -i --force all
    Would love to hear others thoughts, but had to force install given 'dpkg' failed to acknowledge python was installed, even after reboot.
    sudo dpkg -i --force all python3-lib2to3_3.8.2-1ubuntu1_all.deb sudo dpkg -i --force all python3-distutils_3.8.2-1ubuntu1_all.deb sudo dpkg -i --force all python3-netifaces_0.10.4-1ubuntu4_amd64.deb sudo dpkg -i --force all python3-yaml_5.3.1-1_amd64.deb sudo dpkg -i --force all 2to3_3.8.2-0ubuntu2_all.deb sudo dpkg -i --force all libnetplan0_0.99-0ubuntu1_amd64.deb sudo dpkg -i --force all netplan.io_0.99-0ubuntu1_amd64.deb

    Reboot

    sudo reboot

    Verify Responsive Internet

    ping 8.8.8.8

    Repair Everything

    sudo apt --fix-broken install sudo apt install ubuntu-desktop sudo apt update sudo apt upgrade
    0

    For me, it was the low level "ip" command that allowed me to get back on the network.

    "ifup" and "ifdown" were not available, but "ip" was.

    So, I manually added the ip address and gateway/route by using the following commands:

    (note: server's ip was 192.168.0.123)

    # Find out networks cards device name (for me it was enp0s3, could also be eth0 or similar...)
    ip link show
    

    Assign the ip address manually

    ip addr add 192.168.0.123/8 dev enp0s3

    Bring up the device

    ip link set enp0s3 up

    add the gateway to the internet

    ip route add 192.168.0.0/24 dev enp0s3

    That way, my network was restarted and I could repair the installation with

    sudo apt --fix-broken install
    
    Xosofox
    • 111