[Howto] Upstart on Fedora

fedora-logo-bubble
This howto describes how to set up and run the init replacement Upstart on Fedora.

The current init system has quite some disadvantages, therefore several distributions search for a way to extend or replace the current system. One well known replacement is initng which I already tested on Fedora. Another way to improve the system is Upstart which was introduced by Ubuntu. Since it is Open Source it can be used on Fedora as well.

Prelude

You can find the newest version of this howto directly at the Upstart wiki. This post is more or less just a snapshot of the current state of the wiki howto.
Also: I used a stripped down version of Fedora 6: no X, no NFS services, no avahi, no SELinux, etc. I deactivated all that stuff to make the boot process faster – and believe me, I had to reboot quite some time till I had everything running.
And of course I used a Fedora installation inside of a virtual machine (Virtual Box in this case) because otherwise I would have gone insane.

And, last but not least: this howto can seriously damage your system! Don’t try this if you not exactly know what you’re doing.
Enough said, lets get down to business.

Install

As you can imagine there are no rpms provided at the moment, so you have to compile everything by hand. Get the upstart archive and the example-jobs from the download section of the upstart wiki.

The configuration of the sources can be done in two ways: fully replacing all init files, or installing upstart to /opt/ (see also these information). Of course we will take the second way since that is sufficient for testing. The configure line is:
./configure --prefix=/opt/upstart --sysconfdir=/etc --enable-compat=sysv
The installation afterwards is the usual make && make install.

Configuring Upstart

First of all the set of example jobs have to be extracted to /etc/event.d/. These examples make sure that upstart can boot your Fedora exactly like the old init does – this is called compat mode.
However, the example jobs need some work since they are all written for Ubuntu. Everything which is a comment starts with a #.

  • The PATH variable have to be modified so that the new init system calls the right executables:
    perl -pi -e 'undef $/; s/script\n/script\n export PATH=\/opt\/upstart\/sbin:\$PATH\n/' /etc/event.d/rc*
  • rc sysinit script
    Fedora has a very important boot rc script which should be executed only once, directly after the start. Therefore, add it to the rcS script:
    script
    export PATH=/opt/upstart/sbin:$PATH # This was added in the last step
    exec /etc/rc.d/rc.sysinit # ADD THIS LINE
    runlevel --set S >/dev/null || true
    :
  • The tty* files contain the command /sbin/getty. Fedora uses /sbin/mingetty, change that for all tty* files:
    perl -pi -e 's/getty 38400/mingetty/' tty*
  • The rc* files call the executable /etc/init.d/rc – Fedora, however, has this at /etc/rc.d/rc. Change that for all rc* files.
    perl -pi -e 's/\/etc\/init.d\/rc/\/etc\/rc.d\/rc/' rc*
  • There is no runlevel rcS in Fedora – therefore, change /etc/event.d/rcS:
    exec /etc/init.d/rcS must be changed to exec /etc/init.d/rc S

  • Also, the script /etc/event.d/control-alt-delete has to be modified like this:
    script
    export PATH=/opt/upstart/sbin:$PATH # ADD THIS LINE
    exec shutdown -r now "Control-Alt-Delete pressed" # REMOVE /sbin/ FROM THIS LINE
    end script

Boot the system with Upstart

To boot with upstart you have to create a modified grub entry. Therefore, open /boot/grub/grub.conf and create a copy of your current entry. Afterwards, change the ”init” parameter of the kernel line to:
init=/opt/upstart/sbin/init
If you want to enter the debug mode, you should also add --debug afterwards.

Benchmarking with bootstart

Of course you can also use bootchart with upstart to benchmark the init system. To do so you have to modify a normal kernel line in grub.conf in this way:
init=/sbin/bootchartd bootchart_init=/opt/upstart/sbin/init
The first parameter tells the kernel to start bootchart instead of the default init system, and the second parameter tells bootchart to start Upstat instead of the usual init system.

I haven’t done any bootchart testing (yet) because I only tested Upstart in a virtual machine. If I bring it up on my normal machine I will post some statistics about the performance.

6 thoughts on “[Howto] Upstart on Fedora”

  1. rc sysinit script
    Fedora has a very important boot rc script which should be executed only once, directly after the start. Therefore, add it to the rcS script:
    script
    export PATH=/opt/upstart/sbin:$PATH # This was added in the last step
    exec /etc/rc.d/rc.sysinit # ADD THIS LINE
    runlevel –set S >/dev/null || true

    This part don’t make sence to me, but I’m a Linux beginner.

    root@localhost#script
    Some sort of script start

    root@localhost#exec /etc/rc.d/rc.sysinit
    And the computer reboot’s

  2. Stian, if you are a Linux beginner you should not try to deal with Upstart on Fedora at all – the Prelude says it definitely enough:
    this howto can seriously damage your system! Don’t try this if you not exactly know what you’re doing.
    And you are by no means asked to enter any of the lines in this howto into the command line! These are descriptions how to alter system specific core programs. You should really only deal with them if you know exactly what you are doing.

  3. So where am I suposed to enter them?
    I know it can harm my system and I want to try to get upstart and bootsplash working on fedora befour I get the system they way I want it. If I damage it at this point it won’t mather since I can just to a new fresh install since I do not have annything I’m scared of loosing yet.

  4. So if you really want to bring up Upstart on Fedora, read the howto as it is:
    “the example jobs need some work” – the points mentioned above show you where you have to change the example jobs!

    Still, learn at least running before you start flying – how can your dream system include Upstart when you hardly know what it is?
    If you want a faster boot-up, use InitNG – Upstart on Fedora is a prove of concept which makes your system less usable, slower and much more unstable.

  5. I tested initNG some time ago and I lost the info about batterypower in kpowersave.
    It aslo refused to boot if I disabled SElinux and it only cut my boot time from 1:20 to 1:00 minute.
    I asked how do I ad those lines to the script and nothing else. How am I suposed to learn without failing?

  6. Stian, it might be better to try to learn something where you can actually expect results in the end.
    To repeat: the idea of this howto is to show that it is possible – not to show that you can create a working system!

    Anyhow, enough warnings, the rest is up to you😉 About where to enter what: the best would be to have a look at the wiki page of this howto because this howto has some unfortunate line breaks.
    There you see that the things you have to enter into the shell are usually the “perl” lines. The others (containing “ADD THIS LINE” comments) show files you have to edit.

    The exec thing hast to be changed inside of the file rcS.

Comments are closed.