LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Bash errors when terminal is started (https://www.linuxquestions.org/questions/ubuntu-63/bash-errors-when-terminal-is-started-4175454975/)

CollieJim 03-21-2013 05:37 AM

Bash errors when terminal is started
 
I have just updated kubuntu 12.04.2, and now get the following when I start a terminal window:
Code:

bash: _python: line 15: syntax error near unexpected token `('
bash: _python: line 15: ` !(?(*/)python*([0-9.])|-?))'
bash: error importing function definition for `_python'
bash: _k3b: line 21: syntax error near unexpected token `('
bash: _k3b: line 21: ` _filedir @(cue|iso|toc);'
bash: error importing function definition for `_k3b'
bash: _xz: line 15: syntax error near unexpected token `('
bash: _xz: line 15: ` --decompress | --list | --test | -!(-*)[dlt]*)'
bash: error importing function definition for `_xz'
bash: _tar: line 8: syntax error near unexpected token `('
bash: _tar: line 8: ` ?(-)[cr]*f)'
bash: error importing function definition for `_tar'
bash: _growisofs: line 12: syntax error near unexpected token `('
bash: _growisofs: line 12: ` /?(r)dev/*)'
bash: error importing function definition for `_growisofs'

What is causing them?

ukiuki 03-21-2013 06:16 AM

Which terminal is that(xterm, rxvt)? Does that happen in the virtual consoles too when you press ctrl+alt+(F1-F6) and login? One of the files that define the terminal session is broken, that is for sure, but which one?

Regards

CollieJim 03-21-2013 08:04 AM

Someday I hope to be more observant. Not likely though. And more precise in the problem description...

I've found that the problem only occurs when I 'su' for a root prompt and give the root password. I know that root shells are frowned upon, but sometimes it is convenient.

Starting a shell in konsole or emacs or a vc is not a problem, and 'sudo su' with my user password is not a problem.

At least I know how to avoid the errors now.
Could it be a path problem? Or perhaps ~/.bashrc?

'su' alone gives me a shell with /root as the home directory and $USER = root, and errors
'sudo su' keeps my usual home directory and $USER = root, but no errors
'kdesu emacs' gives me /root, $USER = root, and no errors. (I start the shell automatically.)

I'll keep looking.

ukiuki 03-21-2013 09:03 AM

Quote:

Originally Posted by CollieJim (Post 4915934)
..
Could it be a path problem? Or perhaps ~/.bashrc?

'su' alone gives me a shell with /root as the home directory and $USER = root, and errors
...
I'll keep looking.

It is something in the root user config files looks like, .bashrc or .profile , look in the lines where the error messages are pointing, compare the files in other machines if you can.
Have you tried su - ? su - In Debian work as su in Ubuntu and in Debian just su work as sudo su in Ubuntu.

Regards

CollieJim 03-23-2013 03:21 AM

I've found another instance.
From konsole or the emacs shell invoking a script from /usr/local/bin which does not start with #! will give the errors.

It looks like there is a python script somewhere that cannot find modules.
/usr/bin/python is linked to python2.7.

CollieJim 03-28-2013 02:20 AM

I have put echos at the beginning and end of /etc/bash.bashrc, /etc/profile/, ~/.bashrc, and ~/.profile.

When I enter a command that is built-in, no errors
When the command is not built-in, I get the errors. None of the echos are displayed.

It appears to be internal to bash.

pan64 03-28-2013 03:29 AM

probably the SHELL variable is overwritten?
you can try set -x and strace

CollieJim 03-28-2013 04:17 AM

set returns 86 lines of variable values, and 7632 lines of function definitions!
Where do they come from? I've tried grep on /etc and /usr and nothing shows. Possibly because they are in a compressed file?

The problem code seems to be in these functions. It looks like there is something in the problem strings that case does not like.

pan64 03-28-2013 04:26 AM

see man bash and look for the login process to see what is happening

CollieJim 03-28-2013 09:21 PM

The errors are in bash_completion.d files.


All times are GMT -5. The time now is 10:45 PM.