最近升级一直出现如下报错:
└──╼ #apt install gconf2
Reading package lists... Done
Building dependency tree
Reading state information... Done
gconf2 is already the newest version (3.2.6-4.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up gconf2 (3.2.6-4.1) ...
Traceback (most recent call last):
File "/usr/bin/update-gconf-defaults", line 180, in <module>
read_entries(realname)
File "/usr/bin/update-gconf-defaults", line 139, in read_entries
for line in file(filename):
NameError: name 'file' is not defined
dpkg: error processing package gconf2 (--configure):
installed gconf2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
gconf2
Configuring sandbox profiles....
Sandbox profiles updated!
E: Sub-process /usr/bin/dpkg returned an error code (1)
前几次没太在意,以为再遇到几次升级就会好的,然而并未随我的愿望,多次升级以后还是在最后抛出这个gconf2错误,并且gcon2还导致了atom升级也跟着失败了。
想来想去问题已经得寸进尺引入新的报错了,有必要多花心思看一下原因了,几轮网上搜索报错关键字也没升到什么线索,再仔细看错误的/usr/bin/update-gconf-defaults脚本,打开后一看是python写的,文件开头指定是python但并未指定python的大版本号。
至此就感觉到原因差不多要找到了,因为回想近期做测试用的python3,有过改动系统的python版本从默认的2配置到了3,研究一下出错行的内容发现python3与2在file函数上还是有一定区别的,版本3为open(…),果断切换回2.7再执行一次升级,问题解决。
└──╼ #update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3 3 auto mode
1 /usr/bin/python2 2 manual mode
2 /usr/bin/python3 3 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/python2 to provide /usr/bin/python (python) in manual mode
#重新安装和更新
┌─[root@johnson]─[/home/lee]
└──╼ #apt install gconf2
Reading package lists... Done
Building dependency tree
Reading state information... Done
gconf2 is already the newest version (3.2.6-4.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up gconf2 (3.2.6-4.1) ...
Configuring sandbox profiles....
Sandbox profiles updated!
W: APT had planned for dpkg to do more than it reported back (0 vs 4).
Affected packages: gconf2:amd64
┌─[root@xxx]─[/home/xxx]
└──╼ #apt full-upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
┌─[root@xxx]─[/home/xxx]
└──╼ #apt install atom
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
atom
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/86.7 MB of archives.
After this operation, 86.7 MB of additional disk space will be used.
Selecting previously unselected package atom.
(Reading database ... 499068 files and directories currently installed.)
Preparing to unpack .../atom_1.26.1-1~webupd8~0_amd64.deb ...
Unpacking atom (1.26.1-1~webupd8~0) ...
Setting up atom (1.26.1-1~webupd8~0) ...
Processing triggers for mime-support (3.60) ...
Processing triggers for desktop-file-utils (0.23-3) ...
Processing triggers for bamfdaemon (0.5.3-2+b1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Configuring sandbox profiles....
Sandbox profiles updated!