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 ...
- 11-26-2011 #1Just Joined!
- Join Date
- Dec 2010
- Posts
- 66
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.
- 11-26-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
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:
Post any errors. If the file is truly missing, we can help you restore it.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
- 11-26-2011 #3Just Joined!
- Join Date
- Dec 2010
- Posts
- 66
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.
In what way should I edit the above to change how my system boots up? Thanks again.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
- 11-26-2011 #4Just Joined!
- Join Date
- Dec 2010
- Posts
- 66
I found the file, its at /etc/init/rc.conf below is what I'M getting when I open the file.
In what way whould I edit the above to change the runlevel that my system will be booting from? Thanks again.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
- 11-26-2011 #5
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:
IF you have that file, look for the env DEFAULT_RUNLEVEL setting.Code:/etc/init/rc-sysinit.conf
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.
- 11-27-2011 #6Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
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:
- 11-27-2011 #7Just Joined!
- Join Date
- Dec 2010
- Posts
- 66
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
- 11-27-2011 #8Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
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:
Nothing else needs to be in that file (if you are running CentOS 6, which you still haven't confirmed yet).Code:id:3:initdefault:
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 05:03 PM. Reason: typo


Reply With Quote