求助!apt问题

我想删除CUPS打印系统。输入:apt-get remove cups,结果出来一大堆要安装,删除和升级的软件,我没仔细看就确认了。结果apt,aptitude,dselect,man等,还有桌面的所有软件都被删除了。没一个个确认。现在想装软件就得用dpkg了,但是需要一大堆依赖的软件太烦人了。有什么方法能比较简单的装回APT,APTITUDE中的一个就可以啊!哪位大神帮帮忙,谢谢了!

设法将 /var/log/apt/history.log 的内容贴到 paste.ubuntu.com/,再将链接贴过来

如果你的打印系统是安装过程中勾选了 ‘Print Server’ 而安装的,可用 tasksel 将其移除
可尝试在 tasksel 中取消勾选 “Print Server”
或用 tasksel --remove 移除
或移除 task-print-server 这个虚包,再 autoremove 试试。
凡是涉及到 autoremove 的操作,请再三确认后再进行

history的内容,http://paste.ubuntu.com/15520982/

谢谢!

[quote=“luckfatman”]history的内容,http://paste.ubuntu.com/15520982/
谢谢![/quote]

首先猜测你的系统是 wheezy,而且是从 squeeze 升上来的,而且升级不完全

如果你的系统是 wheezy:(注意,不是 wheezy 不要进行)

  1. packages.debian.org/wheezy/amd64/apt/download 下载 apt 的 deb 包,用 dpkg -i 安装。我看了依赖应该都满足
  2. 有了 apt 后,编辑 /etc/apt/sources.list 将无关条目删除,指向 wheezy
    最好只保留这两行:
deb http://httpredir.debian.org/debian wheezy main non-free contrib
deb-src http://httpredir.debian.org/debian wheezy main non-free contrib
  1. 执行
# apt-get update
# apt-get install aspell-en openoffice.org-draw python-coherence libgweather1 python-gnome2 menu gnome-media-common libwpd8c2a gnome-power-manager espeak gcj-4.4-jre-headless python-notify libevolution python-cupshelpers python-pyorbit rpm2cpio openoffice.org-evolution pnm2ppa python-debian python-gnomedesktop tasksel-data gnome-accessibility unattended-upgrades gnome-media libcupsppdc1 metacity libgnome2-vfs-perl nautilus libopenraw1 libgnome2-0 python-twisted-bin python-numpy aspell libgtkhtml-editor0 openoffice.org-officebean gnome-session-bin gstreamer0.10-plugins-bad openoffice.org-emailmerge libbrasero-media0 cndrvcups-ufr2-uk libgcj-bc gcj-4.4-base telnet gnome-applets poppler-utils python-reportbug libicu44 openoffice.org-impress gstreamer0.10-plugins-ugly libseed0 totem-plugins gnome-panel-data evolution-plugins hplip-cups libmagickcore3 libpangomm-1.4-1 scim-bridge-client-gtk evolution libspectre1 python-openssl libgnomeui-0 openoffice.org-base-core libgtkmm-2.4-1c2a gnome-settings-daemon python-pyatspi python-louie python-louis libboost-python1.42.0 bsh-gcj ghostscript-cups epiphany-browser alacarte gedit gnome-menus python-imaging python-httplib2 gnome-system-monitor libmagickwand3 python-nevow libgnomevfs2-common gnome-terminal gnome-session libpolkit-gtk-1-0 hpijs libplot2c2 libgnomevfs2-extra python-software-properties reportbug hplip libboost-date-time1.42.0 gconf2 python-zope.interface libjack-jackd2-0 librpmio1 python-twisted-conch librpm1 libwps-0.1-1 libmagick++3 aptitude libgomp1 hylafax-client apt-listchanges python-apt gcj-4.4-jre-lib openoffice.org-help-en-us gcj-jre groff-base python-central gettext-base libfftw3-3 python-gnomekeyring python-gtksourceview2 libboost-iostreams1.42.0 python-twisted-web python-apt-common scim python-axiom libexiv2-9 mysql-server-core-5.1 libsigc++-2.0-0c2a liblapack3gf libcanberra-gtk-module libcwidget3 libscim8c2a libgweather-common evolution-webcal python-serial grub-pc openoffice.org-math openoffice.org-writer gcc-4.4 metacity-common openoffice.org-gcj gstreamer0.10-plugins-good libgcj10 cups-ppdc libglibmm-2.4-1c2a dasher apt-utils cndrvcups-common python-epsilon libhsqldb-java-gcj openoffice.org-report-builder-bin browser-plugin-gnash python-gmenu libportaudio2 openoffice.org-gtk libpstoedit0c2a python-pam libgegl-0.0-0 libcairomm-1.0-1 libgcj10-awt libgtkspell0 libgail-gnome-module gnome-orca pstoedit apt ufraw-batch python-glade2 gnash-common python-brlapi uno-libs3 gnome-about python-clientform libexempi3 iceweasel fbi openoffice.org-java-common gcc libgnome2-common eog python-xapian apt-xapian-index deskbar-applet libept1 totem-coherence libpanel-applet2-0 python-uno dasher-data python gcj-4.4-jre libgtkglext1 gok python-xdg cups-driver-gutenprint libgtkhtml3.14-19 libgnomevfs2-0 im-config xulrunner-1.9.1 python-cairo gnome-applets-data system-config-printer-udev libgme0 at-spi libpoppler5 librarian0 software-properties-gtk rarian-compat w3m scim-gtk2-immodule libboost-thread1.42.0 libevince2 python-dbus openoffice.org-filter-mobiledev python-mechanize libxapian22 gdm3 gnome-terminal-data cups python-tagpy libdjvulibre21 libpoppler-glib4 openoffice.org-filter-binfilter evince python-chardet system-config-printer python-twisted-core gcj-jre-headless python-utidylib libespeak1 libgnome-media0 python-configobj x-ttcidfont-conf nautilus-data openoffice.org python-gnupginterface scim-bridge-agent cdrdao libblas3gf tasksel libgs9 libhunspell-1.2-0 gnome-dictionary gimp ure twm python-gobject openoffice.org-base libvisual-0.4-plugins libmozjs2d yelp libperl5.10 libgnome-speech7 synaptic openoffice.org-style-tango fbterm libwebkit-1.0-2 gksu libsidplay1 gnash gnome-screensaver python-gdbm python-cups gnome-core openoffice.org-calc ghostscript libbonoboui2-0 python-gst0.10 libsoundtouch1c2 hylafax-server libgksu2-0 libgnome2-perl scim-pinyin xorg libgfortran3 python-gnomeapplet python-support gnome-control-center man-db python-pexpect evolution-data-server imagemagick gnome-user-guide libgraphite3 exiv2 libmusicbrainz4c2a python-wnck brasero libwpg-0.1-1 libgc1c2 libmagickcore3-extra openoffice.org-common python-gdata gnome-panel capplets-data libgcj-common sun-java6-fonts grub-common dvd+rw-tools libglu1-mesa openoffice.org-style-galaxy totem python-pkg-resources libmetacity-private0 perlmagick binutils python-beautifulsoup python-pysqlite2 openoffice.org-gnome openoffice.org-thesaurus-en-us inkscape p7zip-full defoma python-rdflib python-feedparser mysql-server-5.1 lsb-release python-gtk2 python-gconf python-crypto openoffice.org-core gnome-doc-utils libofa0 python-libxml2 file-roller libmythes-1.2-0 mysql-client-5.1 python-pyasn1 gnome-netstatus-applet scim-modules-socket hplip-data libtag1-vanilla 
  1. 执行
# apt-get update
# apt-get dist-upgrade

非常感谢!不过用dpkg安装apt出错误,您帮我看一下
dpkg: regarding apt_1.0.9.8.2_amd64.deb containing apt:
apt breaks sun-java6-jdk (>> 0)
sun-java6-jdk (version 6.26-0squeeze1) is present and installed.

dpkg: error processing apt_1.0.9.8.2_amd64.deb (–install):
installing apt would break sun-java6-jdk, and
deconfiguration is not permitted (–auto-deconfigure might help)
Errors were encountered while processing:
apt_1.0.9.8.2_amd64.deb

我下载的是apt_1.0.9.8.2_amd64.deb

[quote=“luckfatman”]非常感谢!不过用dpkg安装apt出错误,您帮我看一下
dpkg: regarding apt_1.0.9.8.2_amd64.deb containing apt:
apt breaks sun-java6-jdk (>> 0)
sun-java6-jdk (version 6.26-0squeeze1) is present and installed.
[/quote]

你下载的是 jessie 的 apt。不是 wheezy 的
执行以下命令将结果全部复制贴上来

cat /etc/issue
cat /etc/os-release
cat /etc/apt/sources.list

cat /etc/issue
Debian GNU/Linux 6.0 \n \l
cat /etc/os-release
cat: /etc/os-release: No such file or directory
cat /etc/apt/sources.list

deb cdrom:[Debian GNU/Linux 7.8.0 Wheezy - Official i386 DVD Binary-1 20150110-13:32]/ wheezy contrib main

deb cdrom:[Debian GNU/Linux 7.8.0 Wheezy - Official i386 DVD Binary-1 20150110-13:32]/ wheezy contrib main

deb ftp.us.debian.org/debian/ wheezy main
deb-src ftp.us.debian.org/debian/ wheezy main

deb security.debian.org/ wheezy/updates main contrib
deb-src security.debian.org/ wheezy/updates main contrib

wheezy-updates, previously known as ‘volatile’

deb ftp.us.debian.org/debian/ wheezy-updates main contrib
deb-src ftp.us.debian.org/debian/ wheezy-updates main contrib

[quote=“luckfatman”]cat /etc/issue
Debian GNU/Linux 6.0 \n \l
deb ftp.us.debian.org/debian/ wheezy main
deb-src ftp.us.debian.org/debian/ wheezy main
[/quote]

果然不出所料

  1. apt 和 openjdk-6-jdk 冲突是从 jessie 开始的。wheezy 的 apt 没有这个问题。
    从这个地址 packages.debian.org/wheezy/amd64/apt/download 下载 apt 的 deb,下载得到的文件名应该是 apt_0.9.7.9+deb7u7_amd64.deb

  2. 按楼上操作

根据你的地理位置,合理选择镜像源。

你对 Debian 版本/套件库的认识不足,建议阅读 wiki.debian.org/DontBreakDebian

我是菜鸟啊!还得多学习。谢谢指导。
不过还是有问题:
(Reading database … 96041 files and directories currently installed.)
Preparing to replace apt 0.9.7.9+deb7u7 (using apt_0.9.7.9+deb7u7_amd64.deb) …
Unpacking replacement apt …
dpkg: dependency problems prevent configuration of apt:
apt depends on libapt-pkg4.12 (>= 0.9.7.9+deb7u7); however:
Package libapt-pkg4.12:amd64 is not configured yet.

dpkg: error processing apt (–install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
apt

执行

# dpkg --configure -a

若无效,从 packages.debian.org/wheezy/amd6 … 2/download 下载 libapt-pkg4.12_0.9.7.9+deb7u7_amd64.deb 安装



或

[code]sudo apt-get -f install[/code]

太感谢vickycq,apt能用了!我正在按照楼上你给出的命令执行。也感谢Priate,谢谢!我会继续努力学习的。

不知道这个问题是怎么出现的,为什么用apt执行个删除软件的命令就会变成这样?以后真得小心点了。重装系统会疯掉的。

之前你的系统本身处于 squeeze / wheezy 混合态,很容易遇到奇怪的依赖问题
建议你按楼上第四步操作,将系统完全升级到 wheezy
(第三步将误删除的软件包装回
第四步将系统完全升级到 wheezy)

另外,如果目前的系统没有运行重要的应用,建议重新安装/升级到 jessie

另外,就算之前你的系统没有处于 squeeze / wheezy 混合态,移除系统自带组件也需要小心操作。
由于虚包机制,很容易出现大量连坐现象。

建议阅读 wiki.debian.org/DontBreakDebian

我按你说的更改了sources.list,所以有许多之前删除的软件没法装回来了。不过没关系,有许多也不需要。感谢您的耐心帮助。我只是业余时间玩玩,重装太累了,之前安装和设置的许多应用,现在都忘了,重新设置会疯掉的。再次感谢!!