Mainly for test purpose, I wish to modify /etc/inittab and add a new runlevel to my system (/etc/rc7.d). I have not save my modification yet, because I'm confused by Vim behavior. Indeed, the editor seems to not recognized the new runlevel as... a new runlevel (like rc 2,3,4 and so on). Here is a screen capture :

<code>Vim</code> screen capture

As you can see, Vim hi-lights in red the number seven and it "lowlights" the address of the config file from yellow to standard green (like thing which are not particular recognized). I'm wondering why does Vim don't act with the new runlevel as it was a standard one?

2 Answers 2


It looks like Vim is smart enough to give you a clue as to what the problem is! That's interesting.

The problem is that there is no such runlevel as 7. The valid run levels are s (or S), 0, 1, 2, 3, 4, 5, and 6. According to the manpage of my copy of init there also exist also pseudo-runlevels a, b, and c though I have never heard of those before.

EDIT: It seems that runlevels 7 through 9 do actually exist, but they are undocumented. I read the init source code under Debian wheezy to confirm it's true! Thanks for pointing that out.

So it turns out that what you are trying to do should actually work. But it's no surprise that Vim doesn't know about it since it's... well... undocumented. I would add also that it might not be very portable.

  • yep, true, there is not runlevel7 by default. But I assume I can add one if I would like to? This blogpost details the easy way : deadend.wordpress.com/howtos/howto-how-to-create-a-new-runlevel I have already created the new rc7.d folder. What do you think? Commented Apr 8, 2015 at 12:54
  • Well, yeah, I guess you could create a new one, but you'd have to modify and recompile init to do it! As init exists right now, only the runlevels I stated in my answer actually exist. Read the manpages for init and inittab to see for yourself.
    – Celada
    Commented Apr 8, 2015 at 12:56
  • I just had a look at the blog post. I'm surprised someone wrote that. I believe it's complete fiction. I wonder if the author tested it at all. Runlevel 7 just doesn't exist. Adding a line in the configuration file does not magically make it exist. Or maybe it does with some variant implementation of init I'm not familiar with?
    – Celada
    Commented Apr 8, 2015 at 13:02
  • Finally in inittab manpage they tell about A,B,C (don't know neither what it is really). More interesting, in init manpage, they tell about runlevel 7 to 9 that "are available without being very documented, because traditional UNIXs don't use them". I'm on debian wheezy. I guess adding from scratch a "new" runlevel 7 before have a clear understanding on how theses kinda secret runlevels work really, is NOT a very good idea u_u thx for make me think Commented Apr 8, 2015 at 13:03
  • Thanks for correcting me about undocumented runlevels 7, 8, and 9. I edited my answer.
    – Celada
    Commented Apr 8, 2015 at 13:10

From /usr/share/vim/vim74/syntax/inittab.vim:

syn match inittabRunLevels "[0-6A-Ca-cSs]\+" contained nextgroup=inittabColonAction,inittabError

So yes, vim considers only 0-6, and both upper-and lowercase a b c s letters as valid runlevels.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .