Setting the default runlevel in Opensuse 12.3…

It really shouldn’t be this hard.  Or this silly.

So you want to change your Opensuse machine to default runlevel 3 from runlevel 5, and that’s all.  Seems easy enough.  in fact, it used to be as easy as vi /etc/inittab, change the 5 to a 3, and save.  Easy-peezy.

Do I hate change?  No (yes).  Do I resist change?  Sometimes (always).  Can I deal with change?  Yes (yes).

Now with all the new systemd nonsense in Opensuse 12.3 (and all of them, for that matter), you need to know how to disable the GUI and use your Linux box like it was *meant* to be used:  COMMANDS!

The thing is, the *concepts* behind runlevels are different now; in fact, the equivalents are now called “targets”.  You need to understand that you basically have two choices by name: 1.) multi-user, and 2.) graphical — and they are represented by the following two files:

/usr/lib/systemd/system/multi-user.target (a. k. a. runlevel 2, 3, or 4)

/usr/lib/systemd/system/graphical.target (a. k. a. runlevel 5)

In the folder /etc/systemd/system, you have a file called default.runlevel that points to the appropriate runlevel/target file.  Check it now, with:

ls -l /etc/systemd/system/default.target

…to see which target file the default file links.  It might point to a runlevelX.target file too, which again just links to the same multi-user.target and graphical.target files.
And if it’s the wrong one, you can follow these commands to change:

To change to boot into the equivalent of runlevel 2, 3, or 4 (the non-graphical, multi-user level):

ln -sf /usr/lib/systemd/system/multi-user.target /etc/systemd/system/default.target

To change to boot into the equivalent of runlevel 5 (the graphical, GUI level):

ln -sf /usr/lib/systemd/system/graphical.target /etc/systemd/system/default.target

There are other concepts involved, like the equivalents of runlevels 0, 1, and 6, but that’s for another time.  The good news is that they follow the same concepts, so you probably get it by now.  But did it have to be that hard?  I guess I’ll get used to it…

😎

 

UPDATE, 20150510: See the comments from RaulTrujillo below for advice on the normal way to make this change.

14 Comments

  1. daniel

    Really!!

    WTF is SUSE doing? Honestly, I haven’t been feeling the love from Novell for a few years now. I’ve replaced all my linux installs with CentOS except my iFolder server for obvious reasons. Things I miss: Yast, Zypper,… Things I don’t miss: Novell’s craziness.

    Thanks for the post Jeremy, you rock!!

    best,
    dan

  2. peter

    @daniel

    It has nothing to do with SUSE, you need to read some docs about systemd, runlevels are gone..
    http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions/

  3. Chris Guiver

    Thank you HEAPS for post.

    I’d changed my default runlevel to 3 on my openSuSE 13.1 (x86_64) desktop; no idea how but probably a typo [systemctl..] logged in as root when too tired to think clearly…

    I’ve now returned it easily to 5 (gui), so thanks.

  4. Adam Smith

    Great explanation.

    thank you a lot.

  5. Cedric

    Thanks a lot !

  6. Tricia

    Oh Thanks!! helped a lot!!!

  7. alireza

    Thanks man. You helped me . no idea why they have changed it whatsoever

  8. Kim

    All the younger blood coming up … They feel like they have to stick their own DNA on this, which would explain deviating from what has been the standard for 20 years. (It’s not just this OS)

  9. RaulTrujillo

    While the above “ln -sf” command works for some, it wasn’t working for me. I googled and found nothing. However, after fiddling with the “systemctl” command, this worked for me (which I believe is the proper way):

    # Lets you see which is your default:
    systemctl get-default

    # Sets the init level to 3 (multi-user, non-graphical level)
    systemctl set-default multi-user.target

    # Sets the init level to 5 (graphical, multi-user level)
    systemctl set-default graphical.target

    # Now try it out (on a test or personal system)
    reboot

    Cheers…

  10. Jeremy Pavlov

    @RaulTrujillo
    Thanks for that follow up. By the way, this is kind of an old post, going on 2+ years old as I write this response.
    But you know how it goes, sometimes when changes occur, you just hack at something until you figure it out; that’s the case with this post. The things I describe in this post should work, because they are the mechanics behind the change. Of course, I’m always glad to hear about the “correct” way, so thanks for that. And I suppose it should go without saying that people should be careful about following advice they read on the Internet… 😉
    -Jeremy

  11. Dave

    Thanks for the explanation of the changes from “init” to systemd, and for the
    explanation of how to fix things (both the direct symlink solution as well as
    the later “correct” way). Even 2+ years later, this is still helping.

    And, no, I have no idea how my default runlevel got changed in the first place.
    Grr. Cost me almost an entire day until I found this thread.

  12. Jeremy Pavlov

    @ Dave –
    Wow, that’s cool. Sometimes I wonder if I should take down old posts, but I’m glad this helped a bit. I often vent my frustrations and write a post based upon my initial assumptions and discovery, and of course time passes and I learn more, change opinions, etc. I really should go back and follow-up on these things, but life gets in the way and I rarely do…
    Anyway, thanks Dave, glad it helped…

  13. John Doh

    That’s what comments are for 🙂

    Helped me too, cheers!

  14. BG

    Still helpful in March 2018. The documented way by SuSE didn’t work for me, but @RaulTrujillo’s comment did the trick! Thanks to you both.

Leave a Comment

Your email address will not be published. Required fields are marked *