-1

I'm using Ubuntu 18.04, and don't know how I got into tty1. Ctrl+Fn+Alt+F7 on my laptop only shows a blank screen.

It all started when I mistakenly uninstalled Python3. It deleted my terminal, the Chrome browser, and other Ubuntu software packages. I somehow downloaded all but couldn't download Chrome.

When I type sudo apt-get update it shows an error.

When I installed Ubuntu desktop, it shows 'Unable to correct problems, you have held broken packages' error message.

I don't know how to recover from this.

K7AAY
  • 17,202

2 Answers2

2

It all started when I mistakenly uninstalled python3

Python 3 is a critical part of many of the Ubuntu packages and its operation. It should never be removed because that will break things.

The best option for recovery is probably to use a live session, make a backup of your personal files and then re-install --without formatting your partitions. So mount /, and all other partitions but do not tick "format".


To share, this is the list of packages it will remove in a running installation:

$ sudo apt remove python3
[sudo] password for rinzwind: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  accountsservice apg apport-symptoms aptdaemon-data attr avahi-utils
  budgie-core cinnamon-l10n command-not-found-data cups-pk-helper dc diffstat
  distro-info-data file-roller fonts-lato gettext gir1.2-atspi-2.0
  gir1.2-budgie-1.0 gir1.2-gmenu-3.0 gir1.2-gst-plugins-base-1.0
  gir1.2-gstreamer-1.0 gir1.2-gtksource-4 gir1.2-ibus-1.0 gir1.2-notify-0.7
  gir1.2-packagekitglib-1.0 gir1.2-peas-1.0 gir1.2-polkit-1.0 gir1.2-rb-3.0
  gir1.2-snapd-1 gir1.2-vte-2.91 gir1.2-wnck-3.0 gist gkbd-capplet
  gnome-control-center-data gnome-control-center-faces gnome-power-manager
  gnome-screensaver gnome-session-bin gnome-session-common gnome-shell-common
  gnome-software-common gnome-startup-applications hddtemp hwdata ibus-gtk
  ibus-gtk3 ibverbs-providers intltool-debian inxi ippusbxd libappstream-glib8
  libapt-pkg-perl libarchive-zip-perl libasync-mergepoint-perl
  libbudgie-private0 libbudgietheme0 libcapture-tiny-perl libcephfs2
  libcgi-fast-perl libcgi-pm-perl libclass-accessor-perl libclone-perl
  libdigest-bubblebabble-perl libdmapsharing-3.0-2 libemail-valid-perl
  libexempi8 libexporter-tiny-perl libfcgi-perl libfuture-perl libgail-3-0
  libglu1-mesa libgnome-menu-3-0 libgnomekbd-common libgnomekbd8
  libgoa-backend-1.0-1 libgpod-common libgpod4 libgrilo-0.3-0 libgsound0
  libibus-1.0-5 libibverbs1 libimagequant0 libio-async-perl libio-pty-perl
  libio-string-perl libipc-run-perl libldb1 liblightdm-gobject-1-0
  liblirc-client0 liblist-moreutils-perl liblua5.2-0 libmtp-common
  libmtp-runtime libmtp9 libmutter-4-0 libnet-dns-perl libnet-dns-sec-perl
  libnet-domain-tld-perl libnet-ip-perl libnfs12 libnl-route-3-200
  libparse-debianchangelog-perl libpath-tiny-perl libperlio-gzip-perl
  libpython3-stdlib libqt5positioning5 libqt5printsupport5 libqt5qml5
  libqt5quick5 libqt5script5 libqt5sensors5 libqt5webchannel5 libqt5webkit5
  libqt5xml5 librados2 libraven0 libruby2.5 libsane-hpaio
  libsereal-decoder-perl libsereal-encoder-perl libsereal-perl libsgutils2-2
  libstruct-dumb-perl libtalloc2 libtest-fatal-perl libtest-refcount-perl
  libtevent0 libtext-levenshtein-perl libunicode-utf8-perl libva-wayland2
  libvulkan1 libwbclient0 libwhoopsie-preferences0 libxatracker2 libxcb-res0
  libxklavier16 libxml-simple-perl libxnvctrl0 libxvmc1 libyaml-libyaml-perl
  libyelp0 lightdm lintian mesa-vulkan-drivers mscompress mutter-common
  patchutils phantomjs pkg-config python-apt-common python3-minimal python3.7
  python3.7-minimal qt5-style-platform-gtk2 qt5-style-plugin-blackberry
  qt5-style-plugin-cleanlooks qt5-style-plugin-gtk2 qt5-style-plugin-motif
  qt5-style-plugin-plastique qt5-style-plugins rake rtmpdump ruby
  ruby-did-you-mean ruby-json ruby-minitest ruby-net-telnet ruby-power-assert
  ruby-test-unit ruby-xmlrpc ruby2.5 rubygems-integration samba-common
  session-migration squashfs-tools t1utils tdb-tools tree whoopsie-preferences
  x11-apps x11-session-utils xbitmaps xbrlapi xinit xinput xprintidle
  xserver-xorg-legacy xserver-xorg-video-all xserver-xorg-video-amdgpu
  xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-intel
  xserver-xorg-video-nouveau xserver-xorg-video-qxl xserver-xorg-video-radeon
  xserver-xorg-video-vesa xserver-xorg-video-vmware xul-ext-ubufox
  yaru-theme-gnome-shell yelp-xsl
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libaudio2 libept1.5.0 libgtk2-perl libpango-perl libxapian30 synaptic
Suggested packages:
  nas libgtk2-perl-doc xapian-tools dwww menu apt-xapian-index tasksel
  software-properties-gtk
The following packages will be REMOVED:
  apparmor apport apport-gtk aptdaemon budgie-desktop budgie-desktop-common
  budgie-desktop-environment budgie-dropby-applet
  budgie-keyboard-autoswitch-applet budgie-lightdm-theme
  budgie-lightdm-theme-base budgie-previews-applet budgie-rotation-lock-applet
  catfish cinnamon-desktop-data command-not-found firefox
  foomatic-db-compressed-ppds gedit gedit-common gnome-control-center
  gnome-menus gnome-mpv gnome-online-accounts gnome-software
  gnome-software-plugin-snap gnome-tweaks gnome-user-docs google-chrome-stable
  gvfs-backends hplip hplip-data ibus language-selector-common
  language-selector-gnome libcinnamon-desktop4 libmpv1 libsmbclient libxapp1
  lightdm-settings lsb-release menulibre mpv nemo nemo-data nemo-fileroller
  netplan.io networkd-dispatcher nvidia-prime nvidia-settings
  openprinting-ppds orca plymouth-theme-ubuntu-budgie-text
  plymouth-theme-ubuntu-text printer-driver-foo2zjs
  printer-driver-foo2zjs-common printer-driver-m2300w
  printer-driver-postscript-hp printer-driver-ptouch printer-driver-pxljr
  printer-driver-sag-gdi python3 python3-apport python3-apt python3-aptdaemon
  python3-aptdaemon.gtk3widgets python3-asn1crypto python3-blinker
  python3-brlapi python3-cairo python3-certifi python3-cffi-backend
  python3-chardet python3-commandnotfound python3-crypto python3-cryptography
  python3-cups python3-cupshelpers python3-dateutil python3-dbus
  python3-debconf python3-debian python3-defer python3-distro
  python3-distro-info python3-distupgrade python3-dnspython
  python3-entrypoints python3-gdbm python3-gi python3-gi-cairo
  python3-httplib2 python3-idna python3-jwt python3-keyring
  python3-launchpadlib python3-lazr.restfulclient python3-lazr.uri python3-ldb
  python3-louis python3-macaroonbakery python3-mako python3-markupsafe
  python3-nacl python3-netifaces python3-notify2 python3-oauthlib
  python3-olefile python3-pexpect python3-pil python3-pkg-resources
  python3-problem-report python3-protobuf python3-psutil python3-ptyprocess
  python3-pyatspi python3-pymacaroons python3-pyudev python3-pyxattr
  python3-renderpm python3-reportlab python3-reportlab-accel python3-requests
  python3-requests-unixsocket python3-rfc3339 python3-samba
  python3-secretstorage python3-setproctitle python3-simplejson python3-six
  python3-software-properties python3-speechd python3-systemd python3-talloc
  python3-tdb python3-tz python3-uno python3-update-manager python3-urllib3
  python3-wadllib python3-xapp python3-xdg python3-xkit python3-yaml
  rhythmbox-plugin-alternative-toolbar rhythmbox-plugins samba
  samba-common-bin samba-dsdb-modules samba-libs samba-vfs-modules
  screen-resolution-extra slick-greeter smplayer smplayer-l10n smplayer-themes
  snapd software-properties-common software-properties-gtk
  system-config-printer system-config-printer-common
  system-config-printer-udev ubuntu-advantage-tools ubuntu-budgie-desktop
  ubuntu-docs ubuntu-drivers-common ubuntu-minimal
  ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk ubuntu-standard
  ubuntu-system-service ufw unattended-upgrades update-manager
  update-manager-core update-notifier update-notifier-common xapps-common xorg
  xserver-xorg yelp youtube-dl
The following NEW packages will be installed:
  libaudio2 libept1.5.0 libgtk2-perl libpango-perl libxapian30 synaptic
0 upgraded, 6 newly installed, 182 to remove and 29 not upgraded.
Need to get 2122 kB of archives.
After this operation, 703 MB disk space will be freed.
Do you want to continue? [Y/n]  
Thomas Ward
  • 74,764
Rinzwind
  • 299,756
  • And, reinstalling all those packages still will not complete restoring you to a fully working system the way it was before. – K7AAY Aug 15 '19 at 17:48
0

First, make a copy of all your files from ~/ , your home directory. How to properly copy files from hard drive to USB flash drive in tty4 terminal? spells out the steps, so let's discuss it. BTW, you can run this from any tty, not just tty4.

The example linked above assumes you will copy your data to a flash drive, but that's not the only way. You can use an externally attached USB hard drive or solid state drive, or an internally attached drive of either of those types. The important thing is to avoid overwriting your source drive, which is probably /dev/sda , but you will find it when you run lsblk in step 2.

Step 2 may have found where your destination drive was mounted; the example there was /media/me/4C45-110F. Great; we'll use that in a little bit.

If your PC did not find your destination drive automounted when you ran lsblk, then we will mount it . It will appear in Step 2's lsblk, just not with a mount point, if not mounted. So, we give it a mount point, by Step 3's command

udisksctl mount -b /dev/sdXY

where X is the letter assigned to the destination drive, and Y is the first partition on that drive. X will probably be b but you will need to carefully confirm that by looking at its size and matching it to the known size of the destination drive. Y will probably be 1, but could be 2, based on what lsblk showed you.

udisksctl mount will return the name of the drive partition you will copy your files to. Write that down, and copy it carefully. In the example it was /media/xieerqi/A669-34EF but xieerqi will be replaced by your username, and A669-34EF will be randomly different. In the next line, substitute what you found

rsync -av ~/ /media/xieerqi/A669-34EF/~ 

That's a little different than the example, but will catch everything in or underneath your home directory or ~/ .

Then, when complete, Step 5 will safely unmount the destination drive; remember it mat be named different, depending on what we found with lsblk in Step 2.

Once you have copied those files, please take the destination drive to another Linux computer and look at its files.

Did you get everything you expected? Great!
Did you get more than you expected? You can carefully delete what you don't want to keep (or move to a different folder, which is safer).
If you see files missing, check back here.

K7AAY
  • 17,202