# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

4 Answers
4

Workaround

First, I think that you refer about when you go in tty1 - Ctrl + Alt + F1.

Now, I think is happening what you said most likely because you have a strange character like ♦ (diamond suit character or the special badge for an askubuntu moderator) in ~/.bashrc or ~/.profile file or other file that contain various initialization commands.

As you can see in next image, I edited ~/.bashrc file puting inside ♦ character on a single line. As result, when I open the terminal it get the problem described by you:

Now, the only thing what you have to do is to put next line at the begining of the file /etc/profile (sudo -H gedit /etc/profile):

source '/home/<user_name>/bin/lib.trap.sh'

Change <user_name> with your user name. Like this, all the files that contain initialization commands when a shell is invoked will pass through the "trap".

To test if there is a wrong command in /etc/profile for example, run in terminal next commands:

bash
source /etc/profile

If something is wrong, like in this case, the result will be:

So, now we know for sure that there is a problem (command not found) in /etc/profile file at line 32 (it is not at the line 31 as above because we have inserted a new line at the beginning of the file).

@VitalyZdanevich You should check all the files that contain initialization commands (.bash_aliases, .pam_environment, etc) for somenthing strange inside, not necessarily exactly this character.
– Radu RădeanuJun 18 '13 at 15:14

2

Yes, the problem is on the line 31 from /etc/profile. You have something very strange there. Just delete everithing betwen fi and JAVA_HOME, after press one or two 'Enter' and everything should be ok after. Modify the file with sudo gedit /etc/profile
– Radu RădeanuJun 19 '13 at 20:16

For debugging the initialization scripts of bash, run the following (after having logged in at the virtual console).

PS4='+ $BASH_SOURCE:$LINENO:' bash -xlic ''

The above runs bash in interactive (-i) login (-l) mode, the same as the login program does when you log into a virtual console. -c '' makes it exit immediately after running through the initialization scripts, and the -x and PS4=... makes it output each command, before it runs them, along with the filename and line number of that command. That should help determining which line of which file that invalid command resides.

On a side note, ♦ is the symbol the default font for the virtual console uses to print characters it does not have a symbol for.

While searching your initialization files, it may be helpful to look for the hexadecimal used for outputting the ♦. The hex code for ♦ is 2666, according to Unicode Character 'BLACK DIAMOND SUIT' . Note: There is at least one other hex code, 25C6, which produces the same or similar looking symbol. See the search results for "diamond". Unicode Character Search

Perhaps something like \u2666 is in one of the scripts. From Bash Reference Manual for echo - "\uhhhh the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHH (one to four hex digits)"

It depends on the character encoding used, so you may want to search the most likely ones first. echo $LC_CTYPE should return the character encoding used by your shell. See How to get terminal's Character Encoding

-1 because in ~/.bash_history are stored the commands runned interactive on PS1.
– Radu RădeanuJun 19 '13 at 10:54

Thank you for confirming. I have removed it. Should I have added the rest as a comment to your answer, Radu?
– iyrinJun 19 '13 at 16:12

Oh, I don't understand - what I need to do? Where in Lubuntu initialization files? I tried full-text search for \u2666 and ♦ in Catfish (Lubuntu search) - nothing. I sow history - nothing. I see this message only in tty only after login. After echo $LC_CTYPE I get empty line.
– Vitaly ZdanevichJun 19 '13 at 18:58

Running locale should show the LC_CTYPE. locale
– iyrinJun 19 '13 at 22:00

Try Radu's answer before this one! If we narrow down the character set used in your tty, you can search for the occurrence of the corresponding character code for the solid diamond. This search would prove to be fruitless if Radu's RLO find is cause tho.
– iyrinJun 19 '13 at 22:09