My router runs Linux with embedded Busybox. I'd like to autologin and run a web browser. Here is the /etc/inittab file:

# /etc/inittab init(8) configuration for BusyBox
# Copyright (C) 1999-2004 by Erik Andersen 
# Note, BusyBox init doesn't support runlevels.  The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use sysvinit.
# Format for each entry: :::
# : WARNING: This field has a non-traditional meaning for BusyBox init!
#   The id field is used by BusyBox init to specify the controlling tty for
#   the specified process to run on.  The contents of this field are
#   appended to "/dev/" and used as-is.  There is no need for this field to
#   be unique, although if it isn't you may have strange results.  If this
#   field is left blank, it is completely ignored.  Also note that if
#   BusyBox detects that a serial console is in use, then all entries
#   containing non-empty id fields will _not_ be run.  BusyBox init does
#   nothing with utmp.  We don't need no stinkin' utmp.
# : The runlevels field is completely ignored.
# : Valid actions include: sysinit, respawn, askfirst, wait, once,
#                                  restart, ctrlaltdel, and shutdown.
#       Note: askfirst acts just like respawn, but before running the specified
#       process it displays the line "Please press Enter to activate this
#       console." and then waits for the user to press enter before starting
#       the specified process.
#       Note: unrecognised actions (like initdefault) will cause init to emit
#       an error message, and then go along with its business.
# : Specifies the process to be executed and it's command line.
# Note: BusyBox init works just fine without an inittab. If no inittab is
# found, it has the following default behavior:
         ::shutdown:/sbin/swapoff -a
         ::shutdown:/bin/umount -a -r
# if it detects that /dev/console is _not_ a serial console, it will
# also run:
#         tty2::askfirst:/bin/sh
#         tty3::askfirst:/bin/sh
#         tty4::askfirst:/bin/sh
# Boot-time system configuration/initialization script.
# This is run first except when booting in single-user mode.
# ::sysinit:/etc/init.d/rcS
# ::sysinit:/linuxrc

# /bin/sh invocations on selected ttys
# Note below that we prefix the shell commands with a "-" to indicate to the
# shell that it is supposed to be a login shell.  Normally this is handled by
# login, but since we are bypassing login in this case, BusyBox lets you do
# this yourself...
# Start an "askfirst" shell on the console (whatever that may be)


# Start an "askfirst" shell on /dev/tty2-4
# tty2::askfirst:-/bin/sh
# tty3::askfirst:-/bin/sh
# tty4::askfirst:-/bin/sh

# /sbin/getty invocations for selected ttys
# tty4::respawn:/sbin/getty 38400 tty5
# tty5::respawn:/sbin/getty 38400 tty6

# Example of how to put a getty on a serial line (for a terminal)
#::respawn:/sbin/getty -L ttyS0 115200 vt100

My router runs Linux embedded with Busybox. I'd like to autologin and run a web browser on boot. Here is the `/etc/inittab file`:
# Example how to put a getty on a modem line.
#::respawn:/sbin/getty 57600 ttyS2

# Stuff to do when restarting the init process
# ::restart:/sbin/init

# Stuff to do before rebooting
# ::ctrlaltdel:/sbin/reboot
# ::shutdown:/bin/umount -a -r
# ::shutdown:/sbin/swapoff -a
  • what have you tried ? besides inittab is of no use here. have you check ssh and keys ? have you check any of the link on the right (Related) ?
    – Archemar
    Apr 16, 2015 at 5:03
  • I tried to edit the inittab file so that when I boot up the router it can automatically login as root into the desktop mode. I aslo tried deleting the file since the inittab file said BusyBox init works just fine without an inittab. If no inittab is found, it has the following default behavior:(code listed above), but when I rebooted the system it hang at the cisco logo.
    – unixnewbie
    Apr 16, 2015 at 15:10

2 Answers 2


Probably a slightly late answer, but I've decided to add it anyway.

Hanging at the Cisco logo (or whatever else) is the expected behaviour in the case when the /etc/inittab file is empty. The answer depends on how you want to log into the machine. Uncommenting the line:

::respawn:/sbin/getty -L ttyS0 115200 vt100

allows you to provide login prompt on /dev/ttyS0. Assuming that you have connected over serial /dev/ttyS0 (be sure that this is in fact your interface, e.g., at my machine it is /dev/ttyPS0), the auto-login can be realised by adding:

ttyPS0::respawn:/bin/login -f <user>

This should auto log-in you as the <user>. The other approach that uses /sbin/getty and custom-made auto-login utility is described here.

If you want to automatically log-in using, e.g., /dev/tty3, you can modify the example. The auto-start of browser will depend on the X and the browser you use. I would modify the ~/.profile or ~/.bashrc in your ${HOME} directory (typically /home/<user>) by adding at the end something like:

google-chrome-stable &

Note, however, that if you're connected to the router over some serial/USB cable this may not work.

  • You likely want to add a leading dash -/bin/login as explained in my answer: unix.stackexchange.com/a/474733/32558 Oct 11, 2018 at 6:40
  • 1
    @CiroSantilli新疆改造中心六四事件法轮功 I'm definitely sure that Ctrl+C works without the leading dash, I've just checked it.
    – shycha
    Oct 11, 2018 at 10:17
  • Thanks for trying it out. I've tried it again and I confirm Ctrl + C does not work on my setup with ::respawn:/bin/login -f user0 without the leading dash. This is the precise setup: github.com/cirosantilli/linux-kernel-module-cheat/tree/… and this is how I modify the inittab on that setup: github.com/cirosantilli/linux-kernel-module-cheat/tree/… BusyBox 1.28.4. It would be cool to understand how our setups are different. Oct 11, 2018 at 10:26
  • 1
    @CiroSantilli新疆改造中心六四事件法轮功 Well... To be honest I didn't use Buildroot, but rather I prepared my custom bash script that downloads, builds and creates the whole tool-chain together with rootfs, custom device trees for our platform, etc. to be sure that I can always resurrect it. I used: binutils 2.27, busybox 1.24.2, musl 1.1.19 , musl 1.1.19 and linux 4.9.22. Yes, I know, Linux 4.9.22 is ancient. I reviewed your link and I think the main difference is busybox and libc versions. /etc/inittab looks similar to mine.
    – shycha
    Oct 11, 2018 at 15:32
  • Thanks for giving the specs. busybox version and config should be all that matters I think. Oct 11, 2018 at 15:35

I don't have a router to test, but at least on Buildroot + BusyBox + QEMU the following fstab entry logs you in automatically and makes everything seem to work normally:


as I've explained at: How to login automatically without typing the root username or password in Buildroot BusyBox init?

Don't forget the leading -! Otherwise TTY interaction is a bit broken, e.g. you lose the ability to do Ctrl + C to kill the foreground program.

If you want to login as another user, you can use /bin/login as mentioned at https://unix.stackexchange.com/a/434799/32558 but you likely want to add the dash in front of it as well, for the same reason as /bin/sh:

::respawn:-/bin/login -f user0

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.