ArchThis Forum is for the discussion of Arch Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm not sure what happened, but here's the situation:
All of a sudden, my bash prompts are giving me wierd messages and commands are not being found. Here is the message I get when I su - to become root:
Code:
[kris@myhost ~]$ su -
Password:
-bash: n#: command not found
-bash: thennfor: command not found
-bash: dontest: command not found
-bash: thenn.: command not found
[root@myhost ~]#
Now if I try to load a kernel module, here's the message I get:
Code:
[root@myhost ~]# modprobe coretemp
-bash: modprobe: command not found
[root@myhost ~]#
This seems to have happened after I added a few aliases to my .bashrc file (for only my user - not root):
Code:
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
PS1='[\u@\h \W]\$ '
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias pacman='pacman-color'
alias sudo='sudo '
I tried commenting them all out and logging out/in but that didn't help.
Now that I'm looking at root's path, I'm noticing /usr/ucb and have ABSOLUTELY NO IDEA how that got there. So I change it to /usr/sbin:/bin:/usr/bin:/etc by doing this command:
Now I try to modprobe coretemp and get "command not found." So I check my $PATH again and it looks fine (until I exit the root account and then su back to the root account - then it becomes /usr/ucb again). The modprobe command (among many others) still doesn't work though. I know there's a file somewhere to change this but I forget which one... I tried grep -i "/usr/ucb" / and it didn't find it.
What the heck is going on? Is this a bug in a recent update? Everything WAS fine after a fresh install...
Last edited by kasl33; 09-17-2011 at 02:08 PM.
Click here to see the post LQ members have rated as the most helpful post in this thread.
I believe I may have found the problem. I looked in /etc/profile (glad I finally remembered where to look) and the file has a bunch of jibberish. Here is what the file looks like (no line spacing, escaped newline characters, etc:
Code:
\n# /etc/profile\n\n#Set our umask\numask 022\n\n# Set our default path\nPATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"\nexport PATH\n\n# Load profiles from /etc/profile.d\nif test -d /etc/profile.d/; then\nfor profile in /etc/profile.d/*.sh; do\ntest -r "$profile" && . "$profile"\ndone\nunset profile\nfi\n\n# Source global bash config\nif test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then\n. /etc/bash.bashrc\nfi\n\n# Termcap is outdated, old, and crusty, kill it.\nunset TERMCAP\n\n# Man is much better than us at figuring this out\nunset MANPATH\nPT5HOME=/usr/local/PacketTracer5\nexport PT5HOME
Would anybody be willing to paste the contents of their /etc/profile file so I can see the difference - as well as replace mine? I'd be greatful!
This is from Slackware 13.37, but it should be somewhat similar on Arch.
Code:
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.
# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"
# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
export INPUTRC=/etc/inputrc
fi
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi
# I had problems with the backspace key using 'eval tset' instead of 'TERM=',
# but you might want to try it anyway instead of the section below it. I
# think with the right /etc/termcap it would work.
# eval `tset -sQ "$TERM"`
# Set TERM to linux for unknown type or unset variable:
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
TERM=linux
fi
# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
VISUAL=emacs
# VISUAL=gmacs
# VISUAL=vi
fi
# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2
# Default umask. A umask of 022 prevents new files from being created group
# and world writable.
umask 022
# Notify user of incoming mail. This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
biff y 2> /dev/null
fi
# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
"dontest" is part of the gibberish you were getting when powering up to root.
Found it in your /etc/profile:
Code:
do\ntest
So your /etc/profile is indeed corrupted.
Gotcha - makes sense now. Thanks!
Quote:
Originally Posted by TobiSGD
~ [/etc/profile code]
I suppose Slackware is a BSD style distribution and that it should work. I'll try it. If it doesn't work out, I realized I could just go to Archbang's website and get a config file from them; they post them for people whose files break. I'm using regular Arch but it should work.
Okay I used the Slackware file and it obviously works, but if anybody has an Arch or Archbang /etc/profile file, I would appreciate it if you would paste it in here. Different distro's do have their differences.
I feel like a jackass. the "echo -e" command came to the rescue (Thanks to Karol at Arch Forums):
Code:
echo -e "\n# /etc/profile\n\n#Set our umask\numask 022\n\n# Set our default path\nPATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"\nexport PATH\n\n# Load profiles from /etc/profile.d\nif test -d /etc/profile.d/; then\nfor profile in /etc/profile.d/*.sh; do\ntest -r "$profile" && . "$profile"\ndone\nunset profile\nfi\n\n# Source global bash config\nif test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then\n. /etc/bash.bashrc\nfi\n\n# Termcap is outdated, old, and crusty, kill it.\nunset TERMCAP\n\n# Man is much better than us at figuring this out\nunset MANPATH\nPT5HOME=/usr/local/PacketTracer5\nexport PT5HOME"
Outputted the correct formatting:
Code:
# /etc/profile
#Set our umask
umask 022
# Set our default path
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export PATH
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r && .
done
unset profile
fi
# Source global bash config
if test [\u@\h \W]\$ && test /bin/bash && test -r /etc/bash.bashrc; then
. /etc/bash.bashrc
fi
# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP
# Man is much better than us at figuring this out
unset MANPATH
PT5HOME=/usr/local/PacketTracer5
export PT5HOME
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.