Find the answer to your Linux question:
Results 1 to 8 of 8
I'M reading a linux training book designed to work with CentOS and I'M having trouble with run levels. The book is saying that to modify the startup file for the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Dec 2010
    Posts
    122

    run levels & VI (M)


    I'M reading a linux training book designed to work with CentOS and I'M having trouble with run levels. The book is saying that to modify the startup file for the runlevel I need to edit /etc/inittab, but there is no /etc/inittab on my Centos. I did find two folders (init & init.d) within /etc/ but no inittab editable file. So I decided to learn like any real Linux enthusiast should and use the man pages which pointed me towards the file /var/run/utmp. After locating said file I was not allowed to open it as a regular user. I tried to open it in VI from root but it was filled with "@^". Could someone please help me out here. This last point also brings me to a problem I'M having with VI. When I press Esc to enter commands my computer just gives me an error sound from the speakers. If I press it several more times it says recording at the bottom left. Thanks for any and all replies.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    The file /etc/inittab should definitely be there. What version of CentOS are you running?

    Are you trying to edit the file as root? If not you need to be. Try something like this:

    Code:
    # change to root user (you'll be prompted to enter the root password)
    su -
    
    # open the file with a console-based editor
    vi /etc/inittab
    Post any errors. If the file is truly missing, we can help you restore it.

  3. #3
    Linux Newbie
    Join Date
    Dec 2010
    Posts
    122
    drwxr-xr-x. 2 root root 4096 Dec 26 02:10 init
    lrwxrwxrwx. 1 root root 11 Jul 14 05:45 init.d -> rc.d/init.d
    -rw-r--r--. 1 root root 884 Nov 29 10:34 inittab


    these are the three I see. Which one should I be editing? Thanks.

    Okay, I found the file it's /etc/init/rc.conf below is what I'M getting.

    Code:
    # rc - System V runlevel compatibility
    #
    # This task runs the old sysv-rc runlevel scripts.  It
    # is usually started by the telinit compatibility wrapper.
    
    start on runlevel [0123456]
    
    stop on runlevel [!$RUNLEVEL]
    
    task
    
    export RUNLEVEL
    console output
    exec /etc/rc.d/rc $RUNLEVEL
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    "rc.conf" 14L, 281
    In what way should I edit the above to change how my system boots up? Thanks again.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie
    Join Date
    Dec 2010
    Posts
    122
    I found the file, its at /etc/init/rc.conf below is what I'M getting when I open the file.

    Code:
    # rc - System V runlevel compatibility
    #
    # This task runs the old sysv-rc runlevel scripts.  It
    # is usually started by the telinit compatibility wrapper.
    
    start on runlevel [0123456]
    
    stop on runlevel [!$RUNLEVEL]
    
    task
    
    export RUNLEVEL
    console output
    exec /etc/rc.d/rc $RUNLEVEL
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    ~                                                                               
    "rc.conf" 14L, 281
    In what way whould I edit the above to change the runlevel that my system will be booting from? Thanks again.

  6. #5
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,023
    I've never used CentOS, but Ubuntu doesn't use a traditional inittab anymore, either.
    Maybe that will lend a clue, so check for this file:
    Code:
    /etc/init/rc-sysinit.conf
    IF you have that file, look for the env DEFAULT_RUNLEVEL setting.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  7. #6
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    I assume you are running CentOS 6, is this right?

    I believe it uses upstart for system initialization, versus the older SysVinit and the newer systemd. On my RHEL 6 system, I have that /etc/init/rc.conf file and it looks just like yours. But I also have an /etc/inittab file, it looks like this:

    Code:
    # inittab is only used by upstart for the default runlevel.
    # (more comments)
    id:5:initdefault:

  8. #7
    Linux Newbie
    Join Date
    Dec 2010
    Posts
    122
    I placed a "3" between the following lines to try and set my CentOS to start up in CLI but now it wont start at all.

    start on runlevel [0123456]

    stop on runlevel [!$RUNLEVEL

    now:

    start on runlevel [0123456]
    3
    stop on runlevel [!$RUNLEVEL

  9. #8
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Boot into runlevel 1. Do that by rebooting, then at the grub boot prompt, make sure your desired kernel is highlighted, then press a to append to the kernel line. Add a ' 1' to the end (that is a space, followed by the number one, not a lowercase L). It should boot up and put you at a bash shell.

    Now remove your modifications to that rc.conf file. To boot into runlevel 3, try putting the following in your /etc/inittab file:

    Code:
    id:3:initdefault:
    Nothing else needs to be in that file (if you are running CentOS 6, which you still haven't confirmed yet).

    btw, both of those files belong to the package initscripts, so you can get unadulterated copies of those files from it. You just need to get ahold of that package. You can get it from your installation media or from the CentOS repos.
    Last edited by atreyu; 11-27-2011 at 06:03 PM. Reason: typo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •