Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wonder if it would be possible to create a custom boot menu entry in grub under Ubuntu (11.04), that boots the system into terminal instead of the login screen.

The effect should be something like the root shell in (rescue mode) boot menu entry, one that gives me access to a root shell or a less privileged shell, without the need to select "root shell" explicitly.

If possible, I also would like to customize the shell started by, most preferably by specifying a shell script to run so that I can start something other than bash, like vim.

My intention is to create a "fast" boot mode to give me a usable system within seconds (to take notes, for instance) without needing to start GUI. Therefore, it is preferred that the silent option is turned on.

Note: There is a requirement: that no existing feature of the system is removed. That is to say, the gnome desktop (and Unity) should remain intact, and is only disabled when I choose this mode.

share|improve this question
    
you could try askubuntu.com (another SE site) for your future questions. –  chrisjlee Aug 30 '11 at 18:18
    
@Chris J. Lee: Oh, thanks. looks like I didn't look through the stackexchange websites too carefully. Plus, I've never had a good impression about forums, which incidentally, includes ubuntuforums. Possibly gave me a biased view. –  Interarticle Aug 31 '11 at 16:12

2 Answers 2

up vote 0 down vote accepted

I would test it on a VM or something first if I were you (GRUB2 a scary scary thing) but according to this blog post it shouldn't be harder than changing

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

to

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash text”

in /etc/default/grub. This has the side effect of forcing you to run startx in order to start x.

Another solution I found would be simply to disable gdm from Ubuntu's services list in Preferences.

share|improve this answer
    
good idea, and I was wondering if I should use kernel switches. I'll try this then. And thanks for the warning, but I think I've used ubuntu long enough to get myself out of a grub configuration disaster. I've got a lot of sysrescuecd's around. I think I'll use a custom menunentry instead of modifying the default (/etc/grub.d/40_Custom). –  Interarticle Aug 7 '11 at 9:43

This is the best I can get to solve the problem based on one answer.

The final solution is:

  1. Create a custom menuentry in /etc/grub.d/40_Custom with the kernel option text turn on to prevent auto-start of gdm as I wish, therefore boosting start up speed.
  2. Create a under-privileged user <user name> (I personally chose to block its access to my home directory using acl, strip it of administrative permissions and use a bogus password that no one can remember.)
  3. Edit /etc/init/tty2.conf to enable auto log in:

    1. Change exec /sbin/getty -8 38400 tty2 to exec /sbin/getty -l <path to logon script> -8 38400 tty2
    2. In file <path to logon script> add the following lines:

      #!/bin/sh
      login -f <user name>
      
    3. Execute sudo chown root:root <path to logon script>
    4. Execute sudo chmod 755 <path to logon script>
  4. If you'd like to rapidly take notes with vim in tty2, then (skip if you don't know what vim is)

    1. Install vim
    2. Install the notes.vim plugin for vim
    3. Log in as <user name> and add the following lines to ~/.bashrc

      vim -c :RecentNotes
      

Remember to replace the things in angular brackets with corresponding values.

share|improve this answer

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.