0

I have set up my system (Ubuntu 14.10) for a text boot up. I need to configure my ttys and boot in such a way that it shows green font for boot messages and ttys.Right now, after the grub menu(which comes in green font) loads, the messages show up all in white color and for ttys it shows up like this(all in white) after boot up :

Ubuntu 14.10 UTM tty1

UTM login :

I want to make it green in color.

What I have tried:

  1. writing setterm -foreground green -store in bashrc changes up the color to green but only after when I try to re-login (logging in and then logging out of tty).
  2. I looked up various links and found that I should modify my /etc/inittab file but as ubuntu 14.10 doesn't have a inittab file I don't know which file I should edit/create for this task.
  3. Changed the GRUB_NORMAL_COLOR=green/black in /etc/default/grub but it only changes the grub font color to green but after it loads the booting starts and all messages come up white in color.

So, my question is , Which file should I edit/create for tty's font color and how ? And also for boot text color?

2

If you take a look through /etc/init folder, the command responsible for bringing up TTY is getty. For each TTY there is a *.conf file in /etc/init , so if you want colorized prompt on every TTY, you will have to edit every single one of those files.

Now, the file responsible for the contents of that appear on the screen before logging in is /etc/issue, however, getty allows specifying custom issue file with -f flag. You can either do that, or edit original /etc/issue file. Be aware that this file will be overwritten with the next upgrade to newer Ubuntu release.

As for colorizing that text, it's pretty easy: use \[ escape sequence and the code for non-print character.

In particular , to make the prompt green, do this:

sudo bash -c 'echo -e "\033[1;32m My Laptop \n \l " > /etc/issue '

Why not sudo echo ? Because redirection is done by the shell,and unless you are logged in as root, your shell doesn't have permission to write to root-owned file (same as explained here).

Why not add \033[1;32m manually ? Because then it's treated as text.

Here's hexdump before and after editing file

CURRENT DIR:[/home/xieerqi]
$ echo -e "\033[1;33m TEST MESSAGE" > issue2                                    

CURRENT DIR:[/home/xieerqi]
$ hexdump -c issue2                                                             
0000000 033   [   1   ;   3   3   m       T   E   S   T       M   E   S
0000010   S   A   G   E  \n                                            
0000015

CURRENT DIR:[/home/xieerqi]
$ nano issue2                                                                   

CURRENT DIR:[/home/xieerqi]
$ hexdump -c issue2                                                             
0000000   ^   [   [   1   ;   3   3   m       T   E   S   T       M   E
0000010   S   S   A   G   E  \n                                        
0000016

In simple words, we want special characters there , not just text

/etc/issue is root owned, so you will need to edit it with gksu gedit /etc/issue or sudo nano /etc/issue. You can use any text editor, but the point is - you need sudo.

Once done, restart TTY1 form another terminal by running sudo service tty1 restart or if you are on 15.04 sudo systemctl restart tty1

2
  • Thanks a lot ,you did what even 50 searches could not do for me , but you didn't answer my other question which is , how can I do the same (change the text color) for boot messages which come after the grub menu ; like reading the hdd, ports and all the starting configuration messages . I appreciate your help :) – 0decimal0 Aug 29 '15 at 8:24
  • @serg I am awaiting your response . :) – 0decimal0 Aug 30 '15 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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