LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 590|回复: 5

求助 无法进入系统 所有命令 not found

[复制链接]
发表于 2011-1-14 09:18:25 | 显示全部楼层 |阅读模式
昨天emerge 了 jdk 后 , 在 /etc/profile 里面设置了环境变量 , JAVA使用正常。
后来关机后,重新启动,登陆的时候,显示 -bash:et:command not found 。
其他所有命令无法使用 , 都是command not found。
后来进入/etc/profile 发现 #set java 中少了#s 变成了 et java 将这一句去掉之后,开机不会提示 et:command not found , 但其他的命令还一样。
vim /bin/bash发现无法显示,全是@@@@@@@@@@乱码,其他文件显示正常。
locale是en_US.UTF-8。
请问遇到这样的问题该如何解决。
谢谢
发表于 2011-1-14 09:23:43 | 显示全部楼层
你不应该在/etc/profile里设置东西,你emerge完jdk后,环境变量会自己设置好。
所有命令都找不到,肯定是你错误设置了path变量,把你在profile里添加的设置内容贴出来吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-1-14 09:40:52 | 显示全部楼层
唉,都是按网上设的。。后来都删了,不行。现在只能进入rescue模式
# /etc/profile: login shell setup
#
# That this file is used by any Bourne-shell derivative to setup the
# environment for login shells.
#

# Load environment settings from profile.env, which is created by
# env-update from the files in /etc/env.d
if [ -e /etc/profile.env ] ; then
        . /etc/profile.env
fi

# 077 would be more secure, but 022 is generally quite realistic
umask 022

# Set up PATH depending on whether we're root or a normal user.
# There's no real reason to exclude sbin paths from the normal user,
# but it can make tab-completion easier when they aren't in the
# user's PATH to pollute the executable namespace.
#
# It is intentional in the following line to use || instead of -o.
# This way the evaluation can be short-circuited and calling whoami is
# avoided.
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
        PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin{ROOTPATH}"
else
        PATH="/usr/local/bin:/usr/bin:/bin{PATH}"
fi
KDEWM=e16

export PATH KDEWM
unset ROOTPATH KDEWM

# Extract the value of EDITOR
[ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`"
[ -z "$EDITOR" ] && EDITOR="/bin/nano"
export EDITOR

if [ -n "${BASH_VERSION}" ] ; then
        # Newer bash ebuilds include /etc/bash/bashrc which will setup PS1
        # including color.  We leave out color here because not all
        # terminals support it.
        if [ -f /etc/bash/bashrc ] ; then
                # Bash login shells run only /etc/profile
                # Bash non-login shells run only /etc/bash/bashrc
                # Since we want to run /etc/bash/bashrc regardless, we source it
                # from here.  It is unfortunate that there is no way to do
                # this *after* the user's .bash_profile runs (without putting
                # it in the user's dot-files), but it shouldn't make any
                # difference.
                . /etc/bash/bashrc
        else
                PS1='\u@\h \w \$ '
        fi
else
        # Setup a bland default prompt.  Since this prompt should be useable
        # on color and non-color terminals, as well as shells that don't
        # understand sequences such as \h, don't put anything special in it.
        PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
fi

for sh in /etc/profile.d/*.sh ; do
        if [ -r "$sh" ] ; then
                . "$sh"
        fi
done
unset s
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-1-14 09:48:56 | 显示全部楼层
是不是设置的环境变量把原来的变量覆盖了,需要重新设置一下环境变量?
回复 支持 反对

使用道具 举报

发表于 2011-1-14 10:47:35 | 显示全部楼层
你贴的什么啊?哪里是你添加的部分?一个java也没看到啊。

算了,你直接从stage3里弄个新的覆盖吧,然后env-update
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-1-14 11:05:31 | 显示全部楼层
添加JAVA变量的那部分后来我删掉了。现在我在用户目录下编辑 .bashrc 加入 export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin 后 可以用命令了。估计那个JAVA环境变量把系统原来的环境变量给覆盖了。现在还有 root用户没有设环境变量,不知道原来标准的环境变量是怎么样的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表