Wednesday, August 11, 2010
12:25 AM

Modifying the run level in Ubuntu 10.04

If you are running ubuntu 10.04 and are looking for the file /etc/inittab, you most probably will not find it. That is because ubuntu has changed a little the files that are read during the system boot.
The runlevel is now set by the file /etc/init/rc-sysinit.conf.
The default Runlevel is set to "2" which is the normal graphical mode.
If you have used any previous versions of linux you would be used to Graphical level being the run level 5, but that is again changed in ubuntu.

If you want change this run level you can set it as follows


1. Open a terminal
2. Run the command "sudo gedit /etc/init/rc-sysinit.conf"

3. In the file that opens search for the line
 env DEFAULT_RUNLEVEL=
4. After "=" enter the new runlevel number you want  and save the file.
5. Let  say we want to boot into text mode every time, so put "3" after the "=" and save the file
6. Now to start in text mode we need to stop gdm from loading , open the file gdm.conf using
"sudo gedit /etc/init/gdm.conf
7. You will see the following set of lines


start on (filesystem
          and started dbus
          and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
               or stopped udevtrigger))
stop on runlevel [016]

Change it to
start on (filesystem
          and started dbus
          and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
               or stopped udevtrigger))
     and runlevel[!3] 
stop on runlevel [016]


and runlevel[!3]   was the new line added.

Save the edited file and restart, it should boot in text mode.

Another way of changing to text mode is to pass the argument "text" to the kernel while booting.
we can do this as follows

1. While the sytem boots hold the "shift" key so that the gurb menu gets displayed
2. Move to the line that has the kernel you boot, some thing like

Ubuntu, with Linux 2.6.32-28-generic

3. Press "e"
4. Move to the line that starts with "linux"
5. Press e again to edit and at the end of this line add the word "text" and press enter.
6. Press cntrl+x to boot the system in text mode.

You can also add a permanent option in your grub menu for the text mode which can be done as follows.
1. Open the file /boot/grub/grub.cfg  using "sudo gedit /boot/grub/grug.cfg"
2. Go to the section that starts with "BEGIN /etc/grub.d/10_linux"
3. Copy the menuentry of the kernel you want to boot in text mode.
4. Open the file /etc/grub.d/40_custom using "sudo gedit /etc/grub/40_custom"
5. Paste the entry copied from grub.cfg at the end of this file.
6. In menuentry add the string "text" at the end of the line that starts with "linux" and save the file
7. Run the command "sudo update-grub2"
8. Now restart the system and hold shift to see the grub menu.
9. You should see a new entry at the end, which if selected should boot into the text mode.


0 comments:

Post a Comment