求助,deepin的环境变量崩溃
Tofloor
poster avatar
lovechang1986
deepin
2016-07-15 22:34
Author
每次重启之后都必须要在终端运行 . /etc/profile
才能启用环境变量,连sudo 和ls都说没有加入环境变量。
求助怎么解决啊,不希望每次都要运行命令才好。
Reply Favorite View the author
All Replies
avatar
lilongyu
deepin
2016-07-15 22:55
#1
请问你用的是lightdm还是其他的dm?
Reply View the author
avatar
lovechang1986
deepin
2016-07-15 23:07
#2
新手,您讲的太专业我不太懂,安装好deepin之后没有做过其他调整,除了安装jasper/zlib/java/libpng/sublime/notepadqq外没做其他的事情。
然后向使用脚本 halt时发现问题。
后来加入加入~/.bashrc 之后就可用,之后halt,电脑等待2分钟不能彻底关机就强关了。
最后就现在我说的这样了。
Reply View the author
avatar
lilongyu
deepin
2016-07-15 23:23
#3
halt是需要root权限命令,所以默认不在用户PATH,另外halt也不是关机命令
Reply View the author
avatar
lilongyu
deepin
2016-07-15 23:32
#4
真的要使用halt等命令的话,可以在当前用PATH加入/sbin,也可以直接使用决定路径执行/sbin/halt
halt 对应的操作是挂起,终止cpu运行但是不断电,个人猜测你需要使用的是poweroff命令
Reply View the author
avatar
lovechang1986
deepin
2016-07-15 23:41
#5
恩,现在这个halt和poweroff的问题不是关键,大神。

是连cd ls sudo 这样的命令在usr下都不能用了。必须要. /etc/profile之后才可以用,而且第一次使用这个命令还不行,必须要两次。。。。
我回头接一下图。。。
Reply View the author
avatar
justforlxz
deepin
2016-07-16 00:11
#6
本帖最后由 kirigaya 于 2016-7-15 16:20 编辑

我觉得可能是你把错误的内容写到环境变量文件了,然后执行错误,所以你的环境变量就挂了。下次如果再写环境变量,
推荐你把export的内容写到用户目录的.pam_environment文件里面。这是我的。
16:12:13  ~ 
$ cat .pam_environment  
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN
export WINEARCH=win32
GOPATH=/home/kirigaya/go
PATH=$PATHGOPATH/bin
XIM_PROGRAM=fcitx
XIM=fcitx
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
SDL_IM_MODULE=fcitx
XMODIFIERS="@im=fcitx"
XMODIFIERS=@im=fcitx &
LD_LIBRARY_PATH=/usr/local/libLD_LIBRARY_PATH &



Reply View the author
avatar
catbb49294929
deepin
2016-07-16 03:06
#7
最简单粗暴的,换一个终端,比如sudo apt-get install zsh,然后zsh切换
Reply View the author
avatar
catbb49294929
deepin
2016-07-16 03:07
#8
另外把你.bashrc复制粘贴上来看看?
Reply View the author
avatar
lovechang1986
deepin
2016-08-02 17:38
#9
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

# added by Anaconda2 4.1.1 installer
export PATH="/root/anaconda2/binPATH"

# added by Anaconda2 4.1.1 installer
export PATH="/home/anaconda2/binPATH"

# halt power shutdown
export PATH="/sbin"
Reply View the author
avatar
lovechang1986
deepin
2016-08-02 17:40
#10
/etc/profile

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi


# set java
JAVA_HOME=/usr/java/jre1.8.0_91
PATH=$JAVA_HOME/binPATH
CLASSPATH=.JAVA_HOME/lib/dt.jarJAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH

export PATH=$PATH:/root:/usr:/root/bin:/usr/bin
Reply View the author
avatar
lovechang1986
deepin
2016-08-02 17:41
#11
还有什么需要粘贴的,我在粘贴过来。
本人小白一个,只用简单的功能。请大神指导指导
Reply View the author
avatar
打击越
deepin
2016-08-02 17:54
#12
https://bbs.deepin.org/post/41475
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /et ...

这.bashrc最后一行错了啊。应该这样写

export PATH=/sbinPATH
Reply View the author
avatar
Island
deepin
2016-08-02 18:08
#13
PATH环境变量被你改错了,覆盖掉了之前的声明。应该追加 而不是覆盖
Reply View the author
avatar
Smokey Joe
deepin
2016-08-02 19:24
#14
在bashrc里面加一行  source /etc/profile 就行了。
Reply View the author