Gentoo Wiki


Warning: The official gentoo initng installation guide maintained by the initng developers is located here: It contains the most up-to-date installation instructions, check the official guide has not been updated before reporting any problems you encounter.
--Qupada 11:01, 29 April 2006 (UTC)
This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc



Initng is a full replacement of the old and in many ways deprecated sysvinit tool. It is designed with speed in mind, doing as much as possible asynchronously. In other words: It will boot your system faster, give you more control over the boot process, and provide you with additional statistics.

The basic premise is that startup commands can be launched as soon as their dependencies are met. This limits the effect of bottlenecks like I/O operations; while one program is performing I/O, another can be utilizing the processor. Initng tracks the individual service dependencies in its configuration files.

Warning: initng is still in beta development. It would be unwise to unmerge sysvinit and attempt to rely on initng alone. Don't say you weren't warned.

Related discussion in gentoo forums here


Warning: At the moment, only ebuilds found in the initng svn repository work because we changed the URL for download. Watch Gentoo bug 125580 for when these ebuilds are commited to portage proper; until then consider the initng-9999 ebuild in the standard portage tree to be broken. initng is now modularized into two packages: initng and initng-ifiles. You'll find documentation about how to install this here

Using the standard ebuild

There is an ebuild in the portage tree for initng, but it is masked by the ~x86 keyword. (initng is still in beta). (You no longer need to put the keyword in package.keywords unless it is -*)

echo "sys-apps/initng" >> /etc/portage/package.keywords
emerge initng -av
emerge initng-ifiles -av

Using the Official InitNG overlay

The easiest way to use the official InitNG portage overlay is with layman. The InitNG overlays are slightly more up to date than the Gentoo overlays and recommended by the InitNG developers.


emerge layman
layman -f
layman -a initng

You might also need to modify make.conf to use layman's overlays, instructions should be given when you emerge layman.

Unlike the ebuild in the official portage tree, the ebuilds in the Initng overlay have several additional USE flags that can enable various plugins and some other features.

Using the Subversion Ebuild

For those who want the absolute latest, bleeding edge version, there is now a subversion ebuild in portage. This tends to be fairly stable, and to be quite a few steps ahead of the standard ebuild.


emerge =initng-9999

It is masked, but if you want to experiment, you probably already know how to handle this.

If you have old portage tree Just:

emerge initng-svn

Admittedly, it should be masked, but right now it isn't.

Warning: If you have emerged the standard ebuild, and want to change to the svn ebuild, first unmerge the standard one:

emerge -C initng
emerge initng-svn

The two should block each other, but right now, they don't.

Adding init scripts to the default runlevel

If you have used rc-update to add any services to your default runlevel, these will not work with initng, therefore you will need to use ng-update to add your services to the initng default runlevel. For example, to add gdm, you would run:

ng-update add gdm default

Configuring the Bootloader

To use initng, you will have to modify your bootloader configuration.

Be warned: If you get this wrong, your system may no longer boot.

When you create the new entry, to boot using initng, leave the old entry (booting using sysvinit) in the configuration file: initng is still in beta, and somewhat unstable. It also has a habit of crashing if an init script doesn't work. If you can't boot, you will want to be able to boot using sysvinit, so you can change the initng configuration.


If you are using Lilo as your bootloader, you will need to create a new entry in /etc/lilo.conf. Open the file in a text editor, copy your existing entry (giving it a new name), and add the following line:

append = "init=/sbin/initng"

For example:

File: /etc/lilo.conf
# Working
image = /boot/kernel-2.6.11-gentoo-r9
   root = /dev/hda2
   label = Gentoo-2.6.11-r9

# init-ng Test
image = /boot/kernel-2.6.11-gentoo-r9
   root = /dev/hda2
   label = Gentoo-2.6.11-r9-initng
   append = "init=/sbin/initng"


If you are using GRUB as your bootloader, you will need to create a new entry in /boot/grub/grub.conf. You may need to mount /boot first. Open the file in a text editor, copy your existing entry (giving it a new name), and add the following to the end of the "kernel" line:


For example:

File: /boot/grub/grub.conf
timeout 5
default 0
fallback 1

# Working
title   GNU/Linux 2.6.11-gentoo-r9
   root (hd0,0)
   kernel /kernel-2.6.11-gentoo-r9 root=/dev/hda2

# init-ng Test
title   GNU/Linux 2.6.11-gentoo-r9 (init-ng)
   root (hd0,0)
   kernel /kernel-2.6.11-gentoo-r9 root=/dev/hda2 init=/sbin/initng



ngc is used to start and stop services in initng. For example, to restart xinetd:

ngc -r daemon/xinetd

This is analgous to the old (in sysvinit):

/etc/init.d/xinetd restart

Note: The scripts in /etc/init.d/ will not work if initng was used to boot. Similarly, ngc will not work if sysvinit was used to boot.


ng-update is very similar to rc-update:

ng-update show

to show all available init scripts, and which runlevel(s) they're called by.

ng-update add xinetd default

adds xinetd to the default runlevel

Man pages

There are now man pages for initng, and its components:

man initng
man ngc
man ng-update

Init scripts

Few developers of software packages and daemons are releasing their own initng scripts. This means that the majority of initng scripts you'll be using are maintained by the initng community.

User contributed scripts are often placed in the svn repository fairly quickly (and into the ebuild soon thereafter). If you can't find the script you need in /etc/initng or one of its subdirectories, please consider creating your own and posting it in the official initng forum or e-mailing it to the author.


First run etc-update or dispatch-conf to ensure that you have the most up-to-date scripts.

Then run the following script which will:

ls -1 /etc/runlevels/ | while read RUNLEVEL
   do ls -1 /etc/runlevels/${RUNLEVEL}/ | while read DAEMON
      do HAS_D=`find /etc/initng -iname ${DAEMON}.i`
         if [ ! -n "$HAS_D" ]; then
            echo -en '\E[47;31m'"\033[1mERROR\033[0m: ${DAEMON}.i not found.\n"
         if [ -n "$HAS_D" ]; then
            if [ "$RUNLEVEL" = "boot" ]; then
            elif [ "$RUNLEVEL" = "single" ]; then
            DAEMON_NAME=`echo ${HAS_D} | sed -e 's/\/etc\/initng\/\(.*\)\.i/\1/'`
            ng-update add ${DAEMON_NAME} ${NG_LEVEL}

Or if you aren't ready to migrate but want to know what scripts you would need to create yourself just run this part of the above script:

ls -1 /etc/runlevels/ | while read RUNLEVEL
   do ls -1 /etc/runlevels/${RUNLEVEL}/ | while read DAEMON
      do HAS_D=`find /etc/initng -iname ${DAEMON}.i`
         if [ ! -n "$HAS_D" ]; then
            echo "${DAEMON}"

Or you could also compare the output of

rc-update -s > sysinitv.all
ng-update s > initng.all
diff sysinitv.all initng.all

Missing a script?

If you have a service you want to run, that doesn't have an initng script yet, do the following:

1. Check the initng forum to see if someone else has written it already.

2. If not, you'll have to write it yourself:

3. Or... Check out initng's plugins at initng plugins page. These can execute bash scripts and more. Some are still under development.

Some example scripts

This is an example of a customized network interface script:

File: eth0 init script
# eth0 is static.
service net/eth0 {
    depends = system/initial system/checkroot system/modules
    use = system/static-modules system/coldplug
    start {
        echo "Starting net/$NAME now"
        ifconfig $NAME netmask
        route add -net gw
    stop {
        echo "Stopping net/$NAME now"
        ifconfig $NAME down

This is an example of a script for an uptime daemon:

File: uptimed init script
service daemon/uptimed {
    need = system/initial system/checkroot
    daemon = /usr/sbin/uptimed
    pid_file = /var/run/uptimed

This is an example of a netplugd initialization script:

File: netplugd init script
daemon daemon/netplugd/* {
        need = system/mountfs system/modules;

        use = system/static-modules system/coldplug;
        exec daemon = /sbin/netplugd;
        exec_args daemon = -D -i ${NAME} -c /dev/null -P -p /var/run/netplugd.${NAME}.pid;
        pid_file = /var/run/netplugd.${NAME}.pid;

service daemon/netplugd {

        need = system/mountfs system/modules;

        use = system/static-modules system/coldplug;

        script start = {
for IF in `cat /proc/net/dev | awk 'BEGIN { FS=":" } /eth|wlan/ { gsub(/\W/,"",$1); print $1;}' ` ; do
    /sbin/ngc -u daemon/netplugd/$IF &> /dev/null

        script stop = {
for IF in `cat /proc/net/dev | awk 'BEGIN { FS=":" } /eth|wlan/ { gsub(/\W/,"",$1); print $1;}'` ; do
    /sbin/ngc -d daemon/netplugd/$IF &> /dev/null


Problems with Xorg and nVidia Cards

If you are having trouble starting X and you have an nVidia card, it may be that the necessary device files are not being created.

Note that this is not a problem with initng: the same is the case with sysvinit except that by default /etc/conf.d/rc is set to tarball all your device files on shutdown and reload them on startup from this archive.

File: /etc/conf.d/rc

Since initng does not pay any attention to this you do not have your device files saved from some previous boot. You would have trouble starting X if you changed this option to no with sysvinit as well.

The solution is to run /sbin/ on startup when appropriate by adding something like the following to /etc/conf.d/local.start:

File: Example /etc/conf.d/local.start
if [ ! -e /dev/nvidia0 ]; then

Finally, if you're still having problems because this isn't done before your login manager has started, add "system/local" (without the quotes) to the line of your login manager's init script that begins "need =" (for example: /etc/initng/daemon/kdm.i). This will ensure that your nVidia device files have been created and are ready for use when X starts.

Problem with alsasound

In order to get alsasound working you need to have coldplug added to the system runlevel:

ng-update add coldplug system

or just add system/alsasound/cards to the default runlevel (it loads the modules your sound card need).

Usefull links



talk:HOWTO Initng

Retrieved from ""

Last modified: Fri, 05 Sep 2008 08:48:00 +0000 Hits: 62,564