Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am getting an error message every time I ssh into my box or run sudo -i. It looks like this for login:

login as: person
chands@ubuntu-server's password:
-bash: .: filename argument required
.: usage: . filename [arguments]
chands@ubuntu-server:~$

And like this when I execute sudo -i:

chands@ubuntu-server:~$ sudo -i
[sudo] password for chands:
-bash: .: filename argument required
.: usage: . filename [arguments]
root@ubuntu-server:~#

This error doesn't appear when I launch screen, when I use sudo to execute some other commands, when i execute sudo su and not even when I su into chands from root.

I checked ~/.bashrc for both chands and root and /etc/bash.bashrc but all three of them are the defaults and none of them have any errors with . usage.

Also, this error started happening after i removed and purged byobu from my system. I don't know if this has anything to do with the problem, but that's my point of reference before which everything worked fine.

What could be going wrong here? Any ideas anyone?

share|improve this question
1  
You have to check ~/.profile, /etc/profile, /etc/profile.d/* and, if exists, ~/.bash_profile –  enzotib Aug 11 '11 at 20:59
1  
Try bash -xl. The -l makes it a login-shell, which is what ssh and sudo -i will run as well. -x turns on debugging mode, making it echo each command before executing it. Should help in narrowing down where the error is. –  geirha Aug 11 '11 at 21:34
    
@enzotib: It was ~/.profile that was the offending file! And my hunch that it might have something to do with byobu was correct. This was the last line in both mine and root's .profile files: . $(which byobu-launch). Obviously which didn't return anything since byobu-launch didn't exist and thus . barfed. –  chandsie Aug 12 '11 at 1:12
    
@geirha: Your suggestion was just as helpful and is a great bit knowledge that I'm sure will come in handy some day. When I ran bash -xl I saw that the last line being executed in the login process was just . and right before that was `which byobu-launch so I was able to easily pinpoint what was wrong. This combined with enzotib's advice solved the problem! –  chandsie Aug 12 '11 at 1:14
    
someone should provide the answer as a "proper answer" so it can be accepted and this question closed. –  Marcel Stimberg Aug 12 '11 at 9:58
add comment

1 Answer 1

up vote 5 down vote accepted

So the root cause of this issue was indeed byobu (well actually the lack of byobu). I do not know why but for some reason byobu didn't clean up a line from ~/.profile.This was the last line of the file: . $(which byobu-launch). Luckily I was able to find this line quite easily and quickly by doing the following (as advised by @enzotib and @geirha):

First I ran bash -xl to enter bash as a login shell(-l) in debug mode(-x). When I ran this I could see what the offending line was. Once I knew what was causing the problem I issued cat <file> | grep . $(which byobu-launch) for every file that is executed when bash starts up.

Those files are the following:

  1. ~/.bashrc
  2. /etc/bash.bashrc
  3. ~/.profile
  4. /etc/profile
  5. /etc/profile.d/*
  6. ~/.bash_profile
  7. + all others that are included/executed by any of the above files.
share|improve this answer
    
which is a command you should never use, especially not in a shell script. For interactive use, it is far superseded by the type builtin of the shell. Remember, avoid whichcraft. –  geirha Aug 13 '11 at 21:59
1  
@geirha: FYI, byobu inserted that line itself, it wasn't something I put in. –  chandsie Aug 15 '11 at 17:53
1  
Yes, I assumed as much. I just thought it was an important thing to mention. Byobu definitely needs fixing when it adds bugs to a user's .profile. . byobu-launch or command -v byobu-launch >/dev/null && . byobu-launch would make much more sense to use. –  geirha Aug 16 '11 at 15:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.