yum erasure python = 破坏

yum erasure python = 破坏

我确信这个问题会让很多人发笑,但我肯定不会。

今天早些时候,我尝试安装一些 Python 软件包,并尝试在 AptanaStudio 中更改 pydev 编译器,但有些事情没有奏效。因此,我决定通过运行以下命令从计算机(我运行的是 Fedora 10)中完全删除 Python

sudo yum erase python  

我绝对不应该这样做。即使有 788 个软件包将被删除的消息也没能阻止我。结果,我似乎删除了整个 Fedora 界面。经过一番痛苦之后,我设法将所有重要的东西复制到了外部硬盘上(显然电脑的硬盘完好无损),但 Fedora 却无法启动。所以,我想弄清楚的是:

  1. 究竟发生了什么?为什么?

  2. 是否有可能以某种方式恢复界面?

答案1

正如 Kimvas 所指出的,你可以从 获得所有已删除软件包的列表/var/log/yum.log。但使用 重新安装它们yum不太可能奏效,因为yum这是一个 python 脚本,而 python 已从你的系统中删除。

不过,您可以尝试从 Fedora 镜像下载已删除的 rpm,然后从某个 Fedora 可启动磁盘启动,chroot 到系统分区并使用 安装这些 rpm rpm

/home将系统分区分开保存是一个好主意/,这样当/擦除或重新安装时,其中的所有数据/home都保持完整。

答案2

您删除了 GNOME GUI 等。如果您重新创建已删除的软件包列表,然后使用 yum 安装它们,您应该能够将您的发行版恢复到以前的状态。

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.

我正在运行 ubuntu 12.04,但看起来我会做同样的事情

答案3

我认为最好的办法是重新安装整个系统,同时牢记以下几点:

  1. 备份您的/etc/目录 - 重新安装将覆盖任何剩余的配置文件。
  2. 按照以下说明收集您意外删除的软件包列表重新安装(因为日志文件将被覆盖)
  3. 不是mkfs重新安装时格式化/初始化/任何文件系统
  4. 做了最小系统重新安装,重新安装从 yum 日志中收集的已删除的软件包。
  5. 最后,从 /etc/ 备份中替换已安装软件包的默认配置。您可能需要手动执行一些步骤,例如重新创建用户帐户和组。

要查看已卸载的内容,请查看文件/var/log/yum.log,例如sudo cat /var/log/yum.log | grep Erased列出全部已卸载的软件包(自创建该日志文件以来!)

要尝试重新安装所有内容,你可以尝试类似sudo cat /var/log/yum.log | grep Erased | awk '{print $5}'|xargs sudo yum install

相关内容