[Bug 797006] Re: software-center package update failure due to the use of update-alternatives
Junjie Wu
797006 at bugs.launchpad.net
Tue Jun 14 04:40:28 UTC 2011
"My suggestion is to change the check in /usr/share/pycentral-
data/pyversions.py to directly check the python version, instead of
joining /usr/bin/python and version number."
Sorry I got the detail wrong. After carefully examining /usr/share
/pycentral-data/pyversions.py, I think it's line 151 causing the
problem:
try:
_default_version = link = os.readlink('/usr/bin/python') # line 151
except OSError:
_default_version = None
try:
cmd = ['/usr/bin/python', '-c', 'import sys; print sys.version[:3]']
import subprocess
p = subprocess.Popen(cmd, bufsize=1,
shell=False, stdout=subprocess.PIPE)
fd = p.stdout
except ImportError:
fd = os.popen("/usr/bin/python -c 'import sys; print sys.version[:3]'")
line = fd.readline().strip()
fd.close()
if re.match(r'\d\.\d$', line):
_default_version = 'python' + line
Since the link exists, line 151 returns '/etc/alternatives/python',
which fails the consistency check. A quick fix is to remove line 150 to
153, as '/usr/bin/python', '-c', 'import sys; print sys.version[:3]'
returned the correct 2.7.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to software-center in Ubuntu.
https://bugs.launchpad.net/bugs/797006
Title:
software-center package update failure due to the use of update-
alternatives
Status in “software-center” package in Ubuntu:
New
Bug description:
Binary package hint: software-center
After using update-alternatives to switch between python versions
recently, the update of software-center failed. I do realize that it
needs python 2.7 and switched python back to 2.7 using update-
alternatives. It turns out that it's the link itself, which might be
fixed in /usr/bin/pycentral.
Result of running apt-get install -f, when it failed:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
chromium-browser-inspector
Use 'apt-get autoremove' to remove them.
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.
Setting up software-center (4.0.3) ...
Traceback (most recent call last):
File "/usr/bin/pycentral", line 2327, in <module>
main()
File "/usr/bin/pycentral", line 2321, in main
rv = action.run(global_options)
File "/usr/bin/pycentral", line 1493, in run
runtimes = get_installed_runtimes()
File "/usr/bin/pycentral", line 278, in get_installed_runtimes
default_version = pyversions.default_version(version_only=True)
File "/usr/share/pycentral-data/pyversions.py", line 172, in default_version
raise ValueError, "/usr/bin/python does not match the python default version. It must be reset to point to %s" % debian_default
ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.7
dpkg: error processing software-center (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
software-center
E: Sub-process /usr/bin/dpkg returned an error code (1)
While at the same time, python -V gives the correct python 2.7.1+.
ls /usr/bin/python* yields:
/usr/bin/python /usr/bin/python2.6 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.2 /usr/bin/python3.2mu
and track the link down:
/usr/bin/python -> /etc/alternatives/python*
/etc/alternatives/python -> /usr/bin/python2.7*
To confirm that it's the link caused software-center's update failure,
I used update-alternatives --remove-all to remove the python link,
recreated it to point directly to /usr/bin/python2.7, and the apt-get
install proceeded fine.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
chromium-browser-inspector
Use 'apt-get autoremove' to remove them.
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.
Setting up software-center (4.0.3) ...
Updating software catalog...this may take a moment.
Software catalog update was successful.
Processing triggers for python-central ...
My suggestion is to change the check in /usr/share/pycentral-
data/pyversions.py to directly check the python version, instead of
joining /usr/bin/python and version number.
I am using the desktop Ubuntu 11.04 x64
Linux *** 2.6.38-10-generic #44-Ubuntu SMP Thu Jun 2 21:32:22 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/797006/+subscriptions
More information about the foundations-bugs
mailing list