yum erase python = destruction

3

I'm sure this question will make many laugh, but certainly not me.

I were trying to install some packages for python earlier today and also trying to change pydev compiler in AptanaStudio, and something was not working out. So I decided to completely remove python from the computer (I ran Fedora 10) by running

sudo yum erase python  

I definitely should have not done this. Even the message that 788 packages would be removed didn't stop me. As a result, I seem to have erased the whole Fedora interface. After a lot of pain, I managed to copy all the important stuff to external hard drive (apparently the hard drive of the computer remained intact), but Fedora doesn't want to start. So here's what I'd like to find out:

  1. What exactly happened and why?

  2. Is it possible to restore the interface somehow?

Alex

Posted 2012-07-31T10:08:49.573

Reputation: 143

many RedHat basic components depends on Python (including RPM, I think). – None – 2012-07-31T10:15:42.973

1@PauloScardine RPM probably not, but yum. – glglgl – 2012-07-31T10:27:56.673

@glglgl: I don't use RPM-based distros since last century... :-) – Paulo Scardine – 2012-07-31T10:33:52.717

Does but Fedora doesn't want to start means that the whole OS fails to boot (quite unexpected), or that you get dropped to a text shell rather than a graphical interface? – Hennes – 2012-07-31T12:13:24.917

@Hennes: that's right, I get the message it is being loaded but nothing happens – Alex – 2012-08-01T00:48:32.407

For what it's worth, this is not possible anymore in Fedora 17: Error: Trying to remove "yum", which is protected. – Cristian Ciupitu – 2012-08-19T03:41:27.553

Answers

5

As Kimvas has noted, you can get a list of all removed packages from /var/log/yum.log. Re-installing them with yum is unlikely to work though because yum is a python script and python was removed from your system.

What you can try though is downloading removed rpm's from Fedora mirrors then booting from some Fedora bootable disk, chroot'ing to the system partition and installing those rpm's using rpm.

It is a good idea to keep /home and system / partitions separate, so that when / gets wiped or reinstalled all your data in /home stays intact.

Maxim Egorushkin

Posted 2012-07-31T10:08:49.573

Reputation: 299

why need to reboot? Can't he just wget and rpm -Uvh the packages yum and it's dependencies? – Kimvais – 2012-07-31T11:36:47.413

He mentions that Fedora "doesn't start". – Maxim Egorushkin – 2012-07-31T12:09:17.830

Oh right, I assumed that he meant Gnome by "Fedora" there. – Kimvais – 2012-07-31T12:11:28.960

Yep, not clear whether it doesn't boot or can't start the desktop environment. – Maxim Egorushkin – 2012-07-31T12:36:52.383

downloading removed rps's: you mean all 788 or so of them? – Alex – 2012-08-01T00:51:38.453

Unless you know exactly which particular rpm's to install to revive your system. – Maxim Egorushkin – 2012-08-01T08:30:40.093

1

You deleted GNOME GUI among other things. If you recreate the list of packages you deleted and then use yum to install them you should be able to restore you distro to its former glory.

david@david-AOA150:~$ sudo apt-get remove python
[sudo] password for david: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libssl-dev libssl-doc zlib1g-dev libexpat1-dev python2.7-dev
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libpython3.2 python3 python3-minimal python3-uno python3.2 python3.2-minimal
Suggested packages:
  python3-doc python3-tk python3.2-doc
The following packages will be REMOVED:
  activity-log-manager-control-center aisleriot apparmor apport apport-gtk
  apt-xapian-index aptdaemon apturl apturl-common bluez bluez-alsa
  bluez-gstreamer checkbox checkbox-qt command-not-found compiz compiz-gnome
  compiz-plugins-main-default compizconfig-backend-gconf deja-dup duplicity
  evolution-data-server firefox firefox-globalmenu firefox-gnome-support
  foomatic-db-compressed-ppds gcj-4.6-jre-lib gconf2 gedit
  gir1.2-ubuntuoneui-3.0 gksu gnome-bluetooth gnome-control-center gnome-media
  gnome-menus gnome-orca gnome-sudoku gnome-terminal gnome-terminal-data
  gnome-user-share gstreamer0.10-gconf gwibber gwibber-service
  gwibber-service-facebook gwibber-service-identica gwibber-service-twitter
  hplip hplip-data ibus ibus-pinyin ibus-table indicator-datetime
  indicator-power jockey-common jockey-gtk landscape-client-ui-install
  language-selector-common language-selector-gnome launchpad-integration
  libbonoboui2-0 libcanberra-gtk-module libcanberra-gtk3-module
  libcompizconfig0 libdb5.1-java-gcj libfolks-eds25 libgcj-bc libgcj-common
  libgcj12 libgksu2-0 libgnome-media-profiles-3.0-0 libgnome2-0
  libgnome2-common libgnomeui-0 libgnomevfs2-0 libgnomevfs2-common
  libgweather-3-0 libgweather-common libgwibber-gtk2 libgwibber2
  libmetacity-private0 libpurple-bin libreoffice-gnome libswt-gnome-gtk-3-jni
  libsyncdaemon-1.0-1 libubuntuoneui-3.0-1 light-themes lsb-release metacity
  metacity-common nautilus-dropbox nautilus-share network-manager-gnome
  nvidia-common onboard oneconf openprinting-ppds printer-driver-foo2zjs
  printer-driver-postscript-hp printer-driver-ptouch printer-driver-pxljr
  printer-driver-sag-gdi printer-driver-splix python python-appindicator
  python-apport python-apt python-apt-common python-aptdaemon
  python-aptdaemon.gtk3widgets python-aptdaemon.pkcompat python-brlapi
  python-cairo python-chardet python-configglue python-crypto python-cups
  python-cupshelpers python-dateutil python-dbus python-debian
  python-debtagshw python-defer python-dev python-dirspec
  python-egenix-mxdatetime python-egenix-mxtools python-gconf python-gdata
  python-gdbm python-gi python-gi-cairo python-gnomekeyring
  python-gnupginterface python-gobject python-gobject-2 python-gpgme
  python-gst0.10 python-gtk2 python-httplib2 python-ibus python-imaging
  python-keyring python-launchpadlib python-lazr.restfulclient python-lazr.uri
  python-libproxy python-libxml2 python-louis python-mako python-markupsafe
  python-notify python-oauth python-openssl python-packagekit python-pam
  python-pexpect python-pip python-piston-mini-client python-pkg-resources
  python-problem-report python-protobuf python-pyatspi2 python-pycurl
  python-pyinotify python-pypcap python-renderpm python-reportlab
  python-reportlab-accel python-serial python-setuptools python-simplejson
  python-smbc python-software-properties python-speechd python-support
  python-twisted-bin python-twisted-core python-twisted-names
  python-twisted-web python-ubuntu-sso-client python-ubuntuone-client
  python-ubuntuone-control-panel python-ubuntuone-storageprotocol python-uno
  python-virtkey python-wadllib python-xapian python-xdg python-xkit
  python-zeitgeist python-zope.interface rhythmbox rhythmbox-mozilla
  rhythmbox-plugin-cdrecorder rhythmbox-plugin-magnatune
  rhythmbox-plugin-zeitgeist rhythmbox-plugins rhythmbox-ubuntuone
  sessioninstaller software-center software-center-aptdaemon-plugins
  software-properties-common software-properties-gtk
  system-config-printer-common system-config-printer-gnome
  system-config-printer-udev totem totem-mozilla totem-plugins ubuntu-artwork
  ubuntu-desktop ubuntu-minimal ubuntu-sso-client ubuntu-sso-client-gtk
  ubuntu-standard ubuntu-system-service ubuntuone-client
  ubuntuone-client-gnome ubuntuone-control-panel ubuntuone-couch
  ubuntuone-installer ufw unattended-upgrades unity unity-2d unity-common
  unity-lens-applications unity-lens-video unity-scope-musicstores
  unity-scope-video-remote update-manager update-manager-core update-notifier
  update-notifier-common usb-creator-common usb-creator-gtk xdiagnose
  xul-ext-ubufox zeitgeist zeitgeist-core zeitgeist-datahub
The following NEW packages will be installed:
  libpython3.2 python3 python3-minimal python3-uno python3.2 python3.2-minimal
0 upgraded, 6 newly installed, 241 to remove and 0 not upgraded.
Need to get 5,701 kB of archives.
After this operation, 240 MB disk space will be freed.
Do you want to continue [Y/n]? n
Abort.

I am running ubuntu 12.04, but it looks like I would have done the same thing

dsliberty

Posted 2012-07-31T10:08:49.573

Reputation: 111

0

I think your best bet is to reinstall the whole system bearing the following points in mind:

  1. back up your /etc/ directory - the reinstall will overwrite any leftover configuration files.
  2. Collect the list of packages you accidentally removed as instructed below before doing the re-installation (as the log file will be overwritten)
  3. Do NOT format / initialize / mkfs any file systems when doing the re-install
  4. After doing a minimal system reinstall, reinstall the removed packages you collected from the yum log.
  5. lastly, replace the default configurations from your installed packages from your /etc/ backup. You might need to do some steps by hand, such as re-creation of user accounts and groups.

To see what you have unistalled, see the file /var/log/yum.log e.g. sudo cat /var/log/yum.log | grep Erased to list all the packages that have been unistalled (since the creation of that log file!)

To try to re-install everything, you could try something like sudo cat /var/log/yum.log | grep Erased | awk '{print $5}'|xargs sudo yum install

Kimvais

Posted 2012-07-31T10:08:49.573

Reputation: 3 809

3Except that yum is dependent on Python, and so is no longer installed. – Ignacio Vazquez-Abrams – 2012-07-31T10:26:53.150

worse than that, fedora doesn't want to launch. – Alex – 2012-08-01T00:47:00.817