I am working on creating a real time kernel with RT-PREEMPT patch. I have created this kernel without graphic desktop. It comes up in the terminal mode with login prompt. The requirement is, it should boot and directly go to the shell prompt with root permission, without asking for login. How can this be done? Can you help me?


source: http://linux.koolsolutions.com/2009/04/30/autologin-linux-console-mode.

I have gotten it to work, but it is slightly different on Ubuntu.

  1. First install mingetty:

    sudo apt-get install mingetty
  2. Edit /etc/init/tty1.conf:


    exec /sbin/getty -8 38400 tty1


    exec /sbin/mingetty --autologin root --noclear tty1
  3. Reboot and test.

This worked for me on Ubuntu 12.04, if this works for you and you need more tty's to autologin start changing tty2.conf - tty6.conf and you should be good to go.

  • Testing it in a VM as we speak. Jul 27 '12 at 7:06
  • 2
    You'll want the exec .
    – geirha
    Jul 27 '12 at 7:14
  • D'oooh. You are absolutely right. I will edit :P Jul 27 '12 at 7:31
  • working for ubuntu-server 14.04 also. Jun 25 '14 at 20:16
  • 1
    /sbin/getty seems to supporting --auto-login argument as of in Ubuntu 14.04.02 now
    – VarunAgw
    Aug 19 '15 at 14:31

In the modern world of systemd, here are the steps I took to get this working:

  1. apt install mingetty

  2. mkdir -p /etc/systemd/system/getty@tty1.service.d

  3. Now run the following script:

     cat > /etc/systemd/system/getty@tty1.service.d/override.conf <<- "_EOF_"
     ExecStart=-/sbin/mingetty --autologin root --noclear tty1
  4. systemctl enable getty@tty1.service

The above seems to be the cleanest option for systems that use Systemd that I could find. As an added bonus, if something breaks in the future, you can just run something like the following from a recovery live ISO (after mounting the root partition of course), to restore default behavior:

rm /mnt/root/etc/systemd/system/getty@tty1.service.d/override.conf

You can do this without any additional software

sudo vim /etc/inittab

comment out

1:2345:respawn:/sbin/getty 115200 tty1

and replace it with

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

so you are left with this

#1:2345:respawn:/sbin/getty 115200 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
  • How does this differ against "1:2345:respawn:/sbin/getty --noclear --autologin root 38400 tty1" ?
    – Orphans
    Aug 22 '17 at 6:55

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.