最大的原因:软件源不合适
比如安装xinetd之类的安装失败出现debconf: apt-extracttemplates failed: No such file or directory等等报错,找了很久找到一个源是12.04可以用的。
完整报错:
apt-get install xinetd
The following NEW packages will be installed:
xinetd
0 upgraded, 1 newly installed, 0 to remove and 1170 not upgraded.
Need to get 0 B/108 kB of archives.
After this operation, 310 kB of additional disk space will be used.
E: /var/cache/apt/archives/xinetd_1%3a2.3.15.3-1_amd64.deb not a valid DEB package.
E: Prior errors apply to /var/cache/apt/archives/xinetd_1%3a2.3.15.3-1_amd64.deb
debconf: apt-extracttemplates failed: No such file or directory
dpkg-deb: error: archive '/var/cache/apt/archives/xinetd_1%3a2.3.15.3-1_amd64.deb' contains not understood data member control.tar.xz, giving up
dpkg: error processing /var/cache/apt/archives/xinetd_1%3a2.3.15.3-1_amd64.deb (--unpack):
subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/xinetd_1%3a2.3.15.3-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
解决步骤:
1.sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #备份
2.sudo vim /etc/apt/sources.list #修改
替换内容:
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
3.保存后更新sudo apt-get update #更新列表