ubuntu 登陸不上/ 環境變量失效 The command could not be located because '/usr/bin:/bin' is not inclu...

機器上編譯了5.0/6.0的源碼,安裝的jdk1.7 ,而後因爲須要編譯4.2.2,因此又安裝了jdk1.6 ,配置了環境變量android

gedit /etc/environment 改爲以下shell

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"bash

PATH="$PATH:/usr/lib/jvm/jdk1.6.0_43/bin:/usr/lib/jvm/jdk1.6.0_43"app

JAVAHOME="/usr/lib/jvm/jdk1.6.0_43"less

CLASSPATH="$JAVAHOME/lib:$JAVAHOME/jre/lib"eclipse

JRE_HOME=$JAVA_HOME/jrejvm

編譯源碼成功後,次日重啓,發現圖形登陸界面密碼正確登陸不上,循環跳回登陸界面.ide

Ctrl+ Alt+ F1 進入tty1 ,輸入用戶名和密碼,可是基本命令都用不了,如reboot/ls/rm/nano/vi都不行,提示工具

The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.this

後來在網上搜索到  http://blog.163.com/shao_yuru/blog/static/130517606201010310581842/

刪掉/etc/environment添加的部分,修改前記得備份,重啓正常.


本質緣由是 /etc/environment PATH第一個是系統的命令路徑,第二個把PATH再賦值給覆蓋了致使系統找不到命令.

http://www.oschina.net/question/1762880_233348也是一樣問題

 

gedit ~/.bashrc 裏修改  source ~/.bashrc生效

如下是我我的的見解,通常而言,在Linux中,我不喜歡修改/etc/profile裏的內容,那裏至關於系統環境變量,通常咱們只需更改本身用

戶的環境變量配置文件(.bashrc)便可,這樣能夠保證多個用戶的獨立性。固然了,對於Eclipse(或者說對於Java)這個工具,你要是以爲所

有用戶都應該使用,修改/etc/profile也有必定道理。

不過,若是你是像我這種將jdk和eclipse都放在本身家目錄的話,修改.bashrc仍是比較有道理的吧,由於.bashrc纔是屬於本身的東西。



gedit ~/.bashrc 配置以下

 

#add for jdk1.6

export JAVAHOME="/usr/lib/jvm/jdk1.6.0_43"

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH

export PATH=${PATH}:/root/Tools/sdk/tools

export PATH=${PATH}:/root/Tools/sdk/platform-tools

#add for 4418 gcc

export PATH=/opt/FriendlyARM/toolchain/4.9.3/bin:$PATH

export GCC_COLORS=auto

#add for NDK

export NDK=/opt/ndk/android-ndk-r10c

export PATH=$NDK:$PATH

# ~/.bashrc: executed by bash(1) for non-login shells.

# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)

# for examples

# If not running interactively, don't do anything

[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options

# ... or force ignoredups and ignorespace

HISTCONTROL=ignoredups:ignorespace

# append to the history file, don't overwrite it

shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

HISTSIZE=1000

HISTFILESIZE=2000

# check the window size after each command and, if necessary,

# update the values of LINES and COLUMNS.

shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)

[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)

if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then

debian_chroot=$(cat /etc/debian_chroot)

fi

# set a fancy prompt (non-color, unless we know we "want" color)

case "$TERM" in

xterm-color) color_prompt=yes;;

esac

# uncomment for a colored prompt, if the terminal has the capability; turned

# off by default to not distract the user: the focus in a terminal window

# should be on the output of commands, not on the prompt

#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then

if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then

# We have color support; assume it's compliant with Ecma-48

# (ISO/IEC-6429). (Lack of such support is extremely rare, and such

# a case would tend to support setf rather than setaf.)

color_prompt=yes

else

color_prompt=

fi

fi

if [ "$color_prompt" = yes ]; then

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

else

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

fi

unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir

case "$TERM" in

xterm*|rxvt*)

PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"

;;

*)

;;

esac

# enable color support of ls and also add handy aliases

if [ -x /usr/bin/dircolors ]; then

test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"

alias ls='ls --color=auto'

#alias dir='dir --color=auto'

#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'

alias fgrep='fgrep --color=auto'

alias egrep='egrep --color=auto'

fi

# some more ls aliases

alias ll='ls -alF'

alias la='ls -A'

alias l='ls -CF'

# Alias definitions.

# You may want to put all your additions into a separate file like

# ~/.bash_aliases, instead of adding them here directly.

# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then

. ~/.bash_aliases

fi

# enable programmable completion features (you don't need to enable

# this, if it's already enabled in /etc/bash.bashrc and /etc/profile

# sources /etc/bash.bashrc).

#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then

#    . /etc/bash_completion

#fi

做者:水木井 連接:https://www.jianshu.com/p/44ec005546fe 來源:簡書 著做權歸做者全部。商業轉載請聯繫做者得到受權,非商業轉載請註明出處。
相關文章
相關標籤/搜索