The Short Answer
For the time being, no, there is no automated method specific to runit.
The Long Answer
There have been several approaches to resolving this.
Using Pre-Built Scripts
The first is to have a pre-built set of scripts. These can be extracted from other projects. Void Linux uses runit as its base init and supervisor, so it might be of interest. There is a project on Github called runit-scripts that might have some of what you need. And I will make a shameless plug for my own project, supervision-scripts, which has a few of them pre-baked and ready, although the project is still being developed.
Using A Framework
The second is to provide a framework that eases the transition of writing scripts. Ignite is a possibility. Also, Toki Clover's Supervision Script Framework (not to be confused with my own project) may provide what you seek as well. In this case, there are no pre-built definitions, but you get bits and pieces of shell script (and possibly other programs) to help you make this transition easier.
Borrowing Existing Scripts and Tools
The third is to borrow scripts from other projects. This means going out and really hunting for them. There are a few out there, but you have to really look.
Doing it the hard way
And finally, you sometimes just have to write it yourself. Frankly, if you're desperate, make a copy of the original /etc/init.d/(whatever) file, set it aside, and edit the file. Typically, at the bottom of a init.d script, you'll find a CASE statement & friends, and from there you can see if there are any weird baked-in command line switches that shouldn't be there but are. Don't bother with anything beyond what is inside start)
and stop)
in this because they don't apply when using a supervisor. Look around and see if it needs a /var/run/(whatever) directory set up, that's always important too (don't forget to set ownership if you create it!). And towards the top, if the author did it right, there's usually a set of environment variables that contain the real daemon name, along with its options. From there you can usually cobble together a small script quickly.
This has to do with retrocompatibility and, with the scenario where migrating from upstart
to systemd
could impose a catastrophic failure at Ubuntu 15.04. Quoting the announcement of systemd
comming to Ubuntu:
Contingency plan: If after some weeks we find that there are too many
or too big regressions, we can revert to upstart by default with two
simple uploads (ubuntu-standard and init).
The other detail here is that, Ubuntu did not "fully migrated" to systemd prior to 16.10, having the graphical login to still be managed by upstart not systemd(even with this, being the init manager of choice). Announcement here:
As discussed at UDS 1 we are moving away from using upstart to start
graphical desktop sessions, towards systemd (and D-Bus activations in
some cases where it's appropriate). Two weeks ago Sebastien Bacher,
Iain Lane, Ted Gould, and me had three-day sprint where we converted
most services of the Ubuntu session, and before/after I was working on
the necessary infrastructure in systemd and upstart, and
converted/checked most other flavors. This is now ready to land and
get wider testing.
Ubuntu was/is migrating to systemd on a very safe way, first migrating ConsoleKit related stuff back in 2013 to systemd-logind
, then migrating the init itself, and the remaining units, to avoid problems.
tl,dr: In your specific case, upstart
could be still the one managing graphical login related stuff(lightdm
)...
Best Answer
Gerrit Pape, who maintains both xyr own runit and Bernstein's daemontools packages for Debian, is one of the few developers that took the idea of "init-system neutrality" (that was much bandied about after the Debian systemd hoo-hah) really to heart and has tried hard to support running these under van Smoorenburg
init
, upstart, and systemd.The post-installation maintainer script for runit you will find unpacked on your system from the package somewhere such as
/var/lib/dpkg/info/runit.postinst
. As you can see, it tries to detect the presence of upstart and start therunsvdir
upstart job if upstart is present. It does the same with systemd andrunit.service
.Unfortunately, on Ubuntu 14 and later both systemd and upstart are installed. And so the post-installation maintainer script for the package is trying to run the upstart job with upstart's
start
command. Of course, upstart isn't (by default) the system-wide service manager in Ubuntu 15 and later, and upstart'sstart
command fails to work.The following is a rough idea of how to patch the script in order to overcome this:
This is not ideal, but it is a beginning.
runit.prerm
andrunit.postrm
likewise require some adjustments.Further reading
/etc/inittab
is a thing of the past.. Frequently Given Answers.runit.postinst
. runit source. Ubuntu Launchpad.