web-dev-qa-db-ja.com

apt-getのエラー:/ usr / sbin / update-info-dir:23:/ etc / environment:/usr/local/lib/python2.7/dist-packages:許可が拒否されました

16.04の最近のapt-get upgradeの後、私は常に 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

編集:私が/etc/environmentで今月変更した[追加]した行は次のとおりです。

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

PATH変数内の項目はコロンで区切る必要があります

$ 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

代わりにセミコロンを使用する場合、bashはセミコロンの後のものをコマンドとして解釈します

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

より明確な図:uname -rのみを含むスクリプトを追加しました:

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

問題を解決するには、/etc/environmentのこの行を変更します

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

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

ログアウトしてからログインします:)

4
Zanna