Friday, March 18, 2016

16.04 - Error on apt-get: /usr/sbin/update-info-dir: 23: /etc/environment: /usr/local/lib/python2.7/dist-packages: Permission denied



After a recent apt-get upgrade on 16.04 I now always get errors from install-info:



$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
1 not fully installed or removed.

After this operation, 0 B of additional disk space will be used.
Setting up install-info (6.1.0.dfsg.1-5) ...
/usr/sbin/update-info-dir: 23: /etc/environment: /usr/local/lib/python2.7/dist-packages: Permission denied
dpkg: error processing package install-info (--configure):
subprocess installed post-installation script returned error exit status 126
Errors were encountered while processing:
install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ ls -ld /etc/environment /usr/local/lib/python2.7/dist-packages

-rw-r--r-- 1 root root 1181 Sep 14 21:08 /etc/environment
drwxrwsr-x 331 root root 20480 Sep 14 15:15 /usr/local/lib/python2.7/dist-packages


EDIT: The one line I've changed [added] this month in my /etc/environment was:



PYTHONPATH=/usr/local/lib/python2.7/site-packages;/usr/local/lib/python2.7/dist-packages


Items in a PATH variable should be separated with colons




$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/telegram:/opt/lks-indicator:/snap/bin


If you use a semicolon instead, bash interprets the thing after the semicolon as a command



$ export PATH=$PATH;/home/zanna/playground
bash: /home/zanna/playground: Is a directory



A clearer illustration: I added a script that just contains uname -r:



$ export PATH=$PATH;/home/zanna/playground/uname
4.4.0-36-generic


To fix your problem, change this line in /etc/environment



PYTHONPATH=/usr/local/lib/python2.7/site-packages;/usr/local‌​/lib/python2.7/dist-‌​packages



to



PYTHONPATH=/usr/local/lib/python2.7/site-packages:/usr/local‌​/lib/python2.7/dist-‌​packages


And log out and back in :)


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...