0

I wanted to upgrade my python versions, and when the update via apt did nothing, I decided I wanted to build the newest versions of Python 2 (2.7.16) and 3 (3.7.2). Before I did that however, I unfortunately decided to remove both of the versions I had (2.7.15~rc1-1, 3.6.7), so I basically destroyed my system. I could build and install the new versions just fine, but when I restarted, the GUI wasn't loading. The boot loader is still working, and I can get in the terminal. But when trying to follow some advice on here (like installing ubuntu-desktop), I discovered that I can't connect to the internet (host names can't be resolved when I try to install packages and I can't ping www.google.com). I tried to use the recovery mode where I enabled networking, but no difference.

Is there any chance I can repair my system? Or is there some way I could use a Ubuntu installation USB stick to reset the system to "factory settings" (same partitions etc. as before), even if I have to delete everything on there? I'm running Windows 10 and Ubuntu 18.04 on dual-boot, and even though the installation process went quite smoothly the first time, I had problems before with dual-booting Windows and Ubuntu on my laptop and now I'm scared I could cause even more damage. I'd be very happy if someone could help me.

Edit#1: It seems like I still have python3.6-minimal installed, apt list --installed | grep 'python' outputs:

libpython-stdlib/bionic,now 2.7.15~rc1-1 amd64 [installed,auto-removable]
libpython2.7/bionic-updates,bionic-security,now 2.7.15~rc1-1ubuntu0.1 amd64 [installed]
libpython2.7-minimal/bionic-updates,bionic-security,now 2.7.15~rc1-1ubuntu0.1 amd64 [installed]
libpython2.7-stdlib/bionic-updates,bionic-security,now 2.7.15~rc1-1ubuntu0.1 amd64 [installed]
libpython3-stdlib/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
libpython3.6/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
libpython3.6-minimal/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
libpython3.6-stdlib/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
python-apt-common/bionic-updates,bionic-updates,now 1.6.3ubuntu1 all [installed]
python-minimal/bionic,now 2.7.15~rc1-1 amd64 [installed,auto-removable]
python-talloc/bionic,now 2.1.10-2ubuntu1 amd64 [installed]
python2.7/bionic-updates,bionic-security,now 2.7.15~rc1-1ubuntu0.1 amd64 [installed]
python2.7-minimal/bionic-updates,bionic-security,now 2.7.15~rc1-1ubuntu0.1 amd64 [installed,automatic]
python3-minimal/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
python3.6/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
python3.6-minimal/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]

Also ls /var/cache/apt/archive | grep 'python' gives me:

python3-apt_1.6.3ubuntu1_amd64.deb
python3-distupgrade_1%3a18.04.30_all.deb
python3-gi_3.26.1-2ubuntu1_amd64.deb
python3-gi-cairo_3.26.1-2ubuntu1_amd64.deb
python3-update-manager_1%3a18.04.11.9_all.deb
python-apt-common_1.6.3ubuntu1_all.deb

I hope this helps.

Edit#2: Session log from /var/log/apt/term.log:

Log started: 2019-03-13  23:31:26
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 180782 files and directories currently installed.)
Removing gnome-software-plugin-snap (3.28.1-0ubuntu4.18.04.8) ...
Removing snapd (2.37.1.1+18.04) ...
Removing apparmor (2.12-4ubuntu5.1) ...
Removing apport-gtk (2.20.9-0ubuntu7.5) ...
Removing apport (2.20.9-0ubuntu7.5) ...
Removing ubuntu-desktop (1.417) ...
Removing gnome-control-center (1:3.28.2-0ubuntu0.18.04.2) ...
Removing language-selector-gnome (0.188.1) ...
Removing nautilus-share (0.7.3-2ubuntu3) ...
Removing apturl (0.5.2ubuntu14.2) ...
Removing apturl-common (0.5.2ubuntu14.2) ...
Removing command-not-found (18.04.5) ...
Removing firefox (65.0.1+build2-0ubuntu0.18.04.1) ...
Removing foomatic-db-compressed-ppds (20180306-1) ...
Removing gdm3 (3.28.3-0ubuntu18.04.4) ...
Removing gedit (3.28.1-1ubuntu1.1) ...
Removing gedit-common (3.28.1-1ubuntu1.1) ...
Removing ubuntu-session (3.28.1-0ubuntu3) ...
Removing update-notifier (3.192.1.5) ...
Removing update-manager (1:18.04.11.9) ...
Removing ubuntu-release-upgrader-gtk (1:18.04.30) ...
[1mdpkg:[0m aptdaemon: dependency problems, but removing anyway as you requested:
 python3-aptdaemon depends on aptdaemon.

Removing aptdaemon (1.1.1+bzr982-0ubuntu19) ...
[1mdpkg:[0m python3-aptdaemon: dependency problems, but removing anyway as you requested:
 python3-aptdaemon.gtk3widgets depends on python3-aptdaemon (= 1.1.1+bzr982-0ubuntu19).

Removing python3-aptdaemon (1.1.1+bzr982-0ubuntu19) ...
Selecting previously unselected package policykit-1-gnome.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 178575 files and directories currently installed.)
Preparing to unpack .../policykit-1-gnome_0.105-6ubuntu2_amd64.deb ...
Unpacking policykit-1-gnome (0.105-6ubuntu2) ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 178584 files and directories currently installed.)
Removing ibus-table (1.9.14-3) ...
Removing ibus (1.5.17-3ubuntu4) ...
Removing gnome-menus (3.13.3-11ubuntu1.1) ...
Removing gnome-online-accounts (3.28.0-0ubuntu2.1) ...
Removing ubuntu-software (3.28.1-0ubuntu4.18.04.8) ...
Removing gnome-software (3.28.1-0ubuntu4.18.04.8) ...
Removing nautilus-extension-gnome-terminal (3.28.2-1ubuntu1~18.04.1) ...
Removing xorg (1:7.7+19ubuntu7.1) ...
Removing gnome-terminal (3.28.2-1ubuntu1~18.04.1) ...
Removing printer-driver-postscript-hp (3.17.10+repack0-5) ...
Removing hplip (3.17.10+repack0-5) ...
Removing hplip-data (3.17.10+repack0-5) ...
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/ui5' not empty so not removed
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/scan' not empty so not removed
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/prnt' not empty so not removed
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/pcard' not empty so not removed
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/installer' not empty so not removed
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/fax' not empty so not removed
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/copier' not empty so not removed
[1mdpkg:[0m [1;33mwarning:[0m while removing hplip-data, directory '/usr/share/hplip/base/pexpect' not empty so not removed
Removing ubuntu-standard (1.417) ...
Removing language-selector-common (0.188.1) ...
Removing xserver-xorg (1:7.7+19ubuntu7.1) ...
Removing python3-apport (2.20.9-0ubuntu7.5) ...
Removing update-notifier-common (3.192.1.5) ...
Removing update-manager-core (1:18.04.11.9) ...
[1mdpkg:[0m [1;33mwarning:[0m while removing update-manager-core, directory '/var/lib/update-manager' not empty so not removed
Removing ubuntu-minimal (1.417) ...
Removing nplan (0.40.1~18.04.4) ...
Removing netplan.io (0.40.1~18.04.4) ...
[1mdpkg:[0m [1;33mwarning:[0m while removing netplan.io, directory '/etc/netplan' not empty so not removed
Removing networkd-dispatcher (1.7-0ubuntu3.3) ...
Removing openprinting-ppds (20180306-1) ...
Removing orca (3.28.0-3ubuntu1) ...
Removing plymouth-theme-ubuntu-text (0.9.3-1ubuntu7.18.04.1) ...
update-initramfs: deferring update (trigger activated)
Removing printer-driver-foo2zjs (20170320dfsg0-4) ...
Removing printer-driver-foo2zjs-common (20170320dfsg0-4) ...
Removing printer-driver-m2300w (0.51-13) ...
Removing printer-driver-ptouch (1.4.2-3) ...
Removing printer-driver-pxljr (1.4+repack0-5) ...
Removing unattended-upgrades (1.1ubuntu1.18.04.9) ...
Removing python3-problem-report (2.20.9-0ubuntu7.5) ...
Removing ubuntu-web-launchers (18.04.6) ...
Removing ubuntu-release-upgrader-core (1:18.04.30) ...
Removing software-properties-gtk (0.96.24.32.7) ...
Removing ubuntu-drivers-common (1:0.5.2.2) ...
Removing python3-aptdaemon.gtk3widgets (1.1.1+bzr982-0ubuntu19) ...
Removing python3-launchpadlib (1.10.6-1) ...
Removing python3-keyring (10.6.0-1) ...
Removing python3-secretstorage (2.3.1-2) ...
Removing python3-cryptography (2.1.4-1ubuntu1.2) ...
Removing python3-asn1crypto (0.24.0-1) ...
Removing python3-brlapi (5.5-4ubuntu2.0.1) ...
Removing python3-gi-cairo (3.26.1-2ubuntu1) ...
Removing system-config-printer (1.5.11-1ubuntu2) ...
Removing system-config-printer-common (1.5.11-1ubuntu2) ...
Removing python3-cairo:amd64 (1.16.2-1) ...
Removing python3-macaroonbakery (1.1.3-1) ...
Removing python3-requests-unixsocket (0.1.5-3) ...
Removing python3-pymacaroons (0.13.0-1) ...
Removing python3-nacl (1.1.2-1build1) ...
Removing python3-cffi-backend (1.11.5-1) ...
Removing usb-creator-gtk (0.3.5) ...
Removing usb-creator-common (0.3.5) ...
Removing python3-debian (0.1.32) ...
Removing python3-commandnotfound (18.04.5) ...
Removing python3-keyrings.alt (3.0-1) ...
Removing python3-crypto (2.6.1-8ubuntu2) ...
Removing system-config-printer-udev (1.5.11-1ubuntu2) ...
Removing python3-cupshelpers (1.5.11-1ubuntu2) ...
Removing software-properties-common (0.96.24.32.7) ...
Removing python3-debconf (1.5.66) ...
Removing python3-defer (1.0.6-2build1) ...
Removing python3-distro-info (0.18) ...
Removing python3-gdbm:amd64 (3.6.7-1~18.04) ...
Removing totem-plugins (3.26.0-0ubuntu6.2) ...
Removing python3-lazr.restfulclient (0.13.5-1) ...
Removing python3-httplib2 (0.9.2+dfsg-1) ...
Removing python3-wadllib (1.3.2-3ubuntu0.18.04.1) ...
Removing python3-lazr.uri (1.0.3-2build1) ...
Removing python3-louis (3.5.0-1ubuntu0.3) ...
Removing rhythmbox-plugins (3.4.2-4ubuntu1) ...
Removing python3-mako (1.0.7+ds1-1) ...
Removing python3-markupsafe (1.0-1build1) ...
Removing python3-netifaces (0.10.4-0.1build4) ...
Removing python3-oauth (1.0.1-5) ...
Removing python3-olefile (0.45.1-1) ...
Removing python3-pexpect (4.2.1-1) ...
Removing python3-reportlab (3.4.0-3build1) ...
Removing python3-pil:amd64 (5.1.0-1) ...
Removing python3-zope.interface (4.3.2-1build2) ...
Removing python3-protobuf (3.0.0-9.1ubuntu1) ...
Removing python3-ptyprocess (0.5.2-1) ...
Removing python3-pyatspi (2.26.0+dfsg-1) ...
Removing python3-renderpm:amd64 (3.4.0-3build1) ...
Removing python3-reportlab-accel:amd64 (3.4.0-3build1) ...
Removing python3-rfc3339 (1.0-4) ...
Removing python3-simplejson (3.13.2-1) ...
Removing python3-software-properties (0.96.24.32.7) ...
Removing python3-speechd (0.8.8-1ubuntu1) ...
Removing python3-systemd (234-1build1) ...
Removing python3-tz (2018.3-2) ...
Removing python3-uno (1:6.0.7-0ubuntu0.18.04.2) ...
Removing python3-xdg (0.25-4ubuntu1) ...
Removing python3-xkit (0.5.0ubuntu2) ...
Removing python3-yaml (3.12-1build2) ...
Removing rhythmbox-plugin-alternative-toolbar (0.18.0-1) ...
Removing ubuntu-system-service (0.3.1) ...
Removing ufw (0.35-5) ...
Skip stopping firewall: ufw (not enabled)
Removing python3-requests (2.18.4-2ubuntu0.1) ...
Removing python3-certifi (2018.1.18-2) ...
Removing python3-chardet (3.0.4-1) ...
Removing python3-cups (1.9.73-2) ...
Removing python3-dbus (1.2.6-1) ...
Removing python3-gi (3.26.1-2ubuntu1) ...
Removing python3-idna (2.6-1) ...
Removing python3-pkg-resources (39.0.1-2) ...
Removing python3-urllib3 (1.22-1) ...
Removing python3-six (1.11.0-2) ...
Removing python3-distupgrade (1:18.04.30) ...
Removing python3-update-manager (1:18.04.11.9) ...
Removing lsb-release (9.20170808ubuntu1) ...
Removing python3-apt (1.6.3ubuntu1) ...
[1mdpkg:[0m gir1.2-ibus-1.0:amd64: dependency problems, but removing anyway as you requested:
 gnome-shell depends on gir1.2-ibus-1.0 (>= 1.5.2); however:
  Package gir1.2-ibus-1.0:amd64 is to be removed.

Removing gir1.2-ibus-1.0:amd64 (1.5.17-3ubuntu4) ...
[1mdpkg:[0m python3: dependency problems, but removing anyway as you requested:
 gnome-shell depends on python3; however:
  Package python3 is to be removed.

Removing python3 (3.6.7-1~18.04) ...
[1mdpkg:[0m gnome-shell: dependency problems, but removing anyway as you requested:
 network-manager-gnome depends on policykit-1-gnome | polkit-1-auth-agent; however:
  Package policykit-1-gnome is not configured yet.
  Package polkit-1-auth-agent is not installed.
  Package policykit-1-gnome which provides polkit-1-auth-agent is not configured yet.
  Package gnome-shell which provides polkit-1-auth-agent is to be removed.

Removing gnome-shell (3.28.3-0ubuntu0.18.04.4) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libreoffice-common (1:6.0.7-0ubuntu0.18.04.2) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for libglib2.0-0:amd64 (2.56.3-0ubuntu0.18.04.1) ...
Processing triggers for cups (2.2.7-1ubuntu2.3) ...
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up policykit-1-gnome (0.105-6ubuntu2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for shared-mime-info (1.9-2) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Log ended: 2019-03-13  23:32:0

I can see now that a bunch of really important packages got removed. And by the looks of my bash history, it seems I called both sudo apt remove python and sudo apt remove python3 even before building the newer versions. I changed my original question to reflect that.

  • 2
    Do you have a way to download packages, using either Ubuntu or Windows? Is your python3.6-minimal package, by chance, still in your /var/cache/apt/archive? – user535733 Mar 13 at 23:43
  • As a last resort you can certainly run Ubuntu from live media -- USB -- and perform a fresh install to the same partition(s) to which it was installed the first time. If you didn't opt for anything special during the previous install there's a good chance Ubuntu just resides on a single partition and it should be relatively simple. – Steve Mar 14 at 1:51
  • you may be able to chroot into system and use that to update. but reinstall may be quicker/easier. UEFI chroot askubuntu.com/questions/53578/… If you do not check format, system will be refreshed, but any configuration files you edited will revert to defaults. Best to have good backups. help.ubuntu.com/community/UbuntuReinstallation – oldfred Mar 14 at 2:53
  • @user535733 It seems so. I've edited my post to include a list of installed / cached (?) python packages, hope this helps. How can I use the minimal package? I don't think I can download packages, it seems like I don't get an internet connection at all. Also, it seems my Ubuntu installation is pretty much invisible to Windows. Both operating systems are on different drives, too. – BambooCake Mar 14 at 13:58
  • Your output seems to indicate that apt believes you DO have the base python 3.6 installed. Please edit your question to provide the complete output or error message(s) that makes you believe that Py3.6 is not installed anymore. – user535733 Mar 14 at 14:14
1

I solved the issue by reinstalling Ubuntu as suggested (thank you!).

When I first installed Ubuntu, I followed exactly the advice from Dual Boot Windows 10 and Linux Ubuntu on Separate Hard Drives [duplicate].

I still had the USB installation medium, so I booted from it, chose 'Something else' and then I had only three changes to make (Ubuntu was installed on partition /dev/sdd):

  • set sdd2 to be used as ext4 file system (instead of 'don't use this partition') and set '/' as mount
  • set sdd4 to be used as ext4 file system (instead of 'don't use this partition') and set '/home' as mount
  • set sdd1 to be used for the boot loader in the drop-down list

So in summary I just had to redo part of the settings I used for my initial installation, and I didn't have to create the partition table first etc. I made sure not to select the 'format partition' option anywhere, so when the installation was done, all my files where still there. Thank you for your help everyone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.