I am interested in Linux and been digging it for a while. I just learnt to compile a Linux kernel from source and boot it with Grub which lands you with the shell of the kernel.

Now as soon as the kernel is loaded into memory it searches for the init to load it. My agenda is to bring up a shell (which a normal user can use - like bash).

So, How can I bring it in?

Do I need to configure init to load the bash shell or is there something I could do?

I am building my own distro and I just need the distro to have a shell (bash) and nothing else.


Hmm. This should not be complicated to achieve, but it's also very complex :)

You can simply do what Alexander suggested (init=/bin/bash), and you'll do fine.

The init process is what the kernel calls, and it kicks off all of your userland. Login terminal included. If your init just spawns that bash terminal, you're fine. But if that terminal crashes, or exits, init is supposed to clean up. If some of the processes you launch from terminal die, you need to clean up. If they die, then their children need a new parrent process, it'll be your init.

I highly recommend dedicating 10 minutes to read this, it's very friendly overview of what init does:


Then you'll get closer to understand what it entails to run your own init.

A relevant part of that link says:

There is only one thing we need to do: provide an initial binary to launch at any of these paths: /sbin/init, /etc/init, /bin/init, or /bin/sh. This process (init) is run as pid 1.

The init process needs to do two things:

  • Never exit (if init exits, the kernel panics)

  • Reap zombie processes

The rest of the text then implements a simple init.


"terminal" (a physical computer) and "bash" (a shell) are completely different. I'm not entirely sure what you are asking, but you can add init=/bin/bash to the kernel command line in order to boot straight into bash.

  • Thanks, I have made an edit on that. Is there any other way other than init=/bin/bash because I need my distro to take me straight to the shell every time instead of init=/bin/bash every time. – Panther Coder Feb 13 '17 at 9:44
  • You can configure grub to use init=/bin/bash every time the Linux kernel is started, if that is what you want. I would recommend using a proper init system instead, though. – Alexander Feb 13 '17 at 9:48
  • Is there any way I could configure init to start my own programs. Doing so, will I be facing any problems - in chain... – Panther Coder Feb 13 '17 at 9:53
  • 1
    Yes, if you use systemd, you can add your own program as a pretty small and clear .service file in /usr/lib/systemd/system, enable it with systemctl and it will then be started at boot. – Alexander Feb 13 '17 at 10:05
  • 1
    init=/bin/bash doesn't mean make init call bash, it means use bash instead of init. And you'll definitely need to have some other software installed, or what will your user run, from within bash? They'll only be able to run bash itself! If you want an ultra minimal distribution, I would suggest you look into what is included by default in the 'busybox' docker container, and in fact you may find it useful to try a busybox container and build your distro in a container first, so you can easily build and test it without rebooting – Chunko Feb 13 '17 at 10:34

bash isn't a terminal, is a shell.

The init process, once the boot process has finished and if the machine is running in a text-only runlevel (so without X Windows), calls eventually getty which in turn calls login. That's the process responsible for presenting the login prompt and allowing users to log in. This is what happens in all Linux distros.

What you want to do is simply to define bash as the default login shell for users (assuming you want a multi-user environment).

  • While this is the typical setup, I'd word it more carefully, since it's by far not the only possible setup. If OP only wants a shell, then a getty and login process might be undesirable. – MvG Feb 13 '17 at 14:16
  • Yes, in this case the OP should follow @Alexander's answer. – dr01 Feb 13 '17 at 14:30

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