无法安装

无法安装

我无法在 ubuntu 中安装任何软件(从软件中心),安装后失败,当我检查详细信息时,出现以下错误...请帮我安装它,

installArchives() failed: perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_IN.ISO8859-1"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_IN.ISO8859-1"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_IN.ISO8859-1"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up install-info (5.2.0.dfsg.1-2) ...
/etc/environment: line 2: JAVA_HOME: command not found
dpkg: error processing package install-info (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 install-info
Error in function: 
Setting up install-info (5.2.0.dfsg.1-2) ...
/etc/environment: line 2: JAVA_HOME: command not found
dpkg: error processing package install-info (--configure):
 subprocess installed post-installation script returned error exit status 127

我有 /etc/environment 的以下输出,java_home 已经安装在那里。

输出cat /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/u‌​sr/local/games" 
JAVA_HOME =/usr/lib/jvm/jdk1.7.0/bin 

我已经更新了语言支持并收到以下错误

amulbhatia@Nadar:~$ sudo apt-get install language-pack-en
[sudo] password for amulbhatia: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  kde-l10n-engb
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  language-pack-en-base
The following packages will be upgraded:
  language-pack-en language-pack-en-base
2 upgraded, 0 newly installed, 0 to remove and 321 not upgraded.
1 not fully installed or removed.
Need to get 0 B/459 kB of archives.
After this operation, 1,421 kB disk space will be freed.
Do you want to continue? [Y/n] y
Setting up install-info (5.2.0.dfsg.1-2) ...
/etc/environment: line 2: JAVA_HOME: command not found
dpkg: error processing package install-info (--configure):
 subprocess installed post-installation script returned error exit status 127
E: Sub-process /usr/bin/dpkg returned an error code (1)

提前感谢朋友们,

答案1

我不确定/etc/environmentPAM 是如何应用的,但它看起来像是来源。因此,当它遇到如下行时:

JAVA_HOME =/usr/lib/jvm/jdk1.7.0/bin

JAVA_HOME由于 之前有空格, shell 会将其解释为命令=,这是一个严重错误,因为JAVA_HOME未在 PATH 中找到,也未将其定义为别名或函数。 中的错误source会导致 shell 退出(因为维护脚本以这种方式运行),这就是此错误停止安装的原因。(同样, 之后的空格=会导致 shell 将其视为/usr/lib/jvm/jdk1.7.0/bin命令,这虽然不是那么糟糕,但仍然是一个问题。)因此正确的行是:

JAVA_HOME=/usr/lib/jvm/jdk1.7.0/bin

答案2

几个月来我一直面临同样的问题。一开始我并没有留意,但当我下载更新时,它开始出现问题,并且无法安装。最后,我找到了解决方案。问题出在 的路径上JAVA_HOME。我的路径是:

JAVA_HOME = '/usr/lib/jvm/java-9-oracle'

我把它替换为

JAVA_HOME=/usr/lib/jvm/java-9-oracle

所以,基本上我删除了引号和空格。

怎么做 ?

使用以下方法检查PATH和路径变量JAVA_HOME

$ cat /etc/environment

它显示了类似

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME = '/usr/lib/jvm/java-9-oracle'

.orig我建议您在使用时备份原始环境变量

sudo cp /etc/environment /etc/environment.orig

用于sudo nano command强制更改变量路径

sudo nano -w /etc/environment

通过删除引号和空格编辑路径后,使用Ctrl+X退出,按Y确认并重命名新文件。

并再次检查路径。

 $ cat /etc/environment

现在更新并升级您的系统,以获得流畅的性能和安装。

相关内容