How to set the running level and boot loader path in Ubuntu

Source: Internet
Author: User
Linux operating level 7: 0: direct system shutdown 1: Single User Mode 2: Consistent with Level 3, but no NFS service 3: complete plain text mode with network functions 4: system reserved function 5: similar to running level 3, but XWindow6: system restart can be seen from the above 7 levels, we can set the running level to only 1, 2, 3, and 5. I don't need to explain the values 0 and 6. If it is set to 4, the system will continue to shut down or restart automatically. By default, to modify the default running level, modify/etc/in.

Linux has a total of 7 levels:

0: The system shuts down directly.
1: single-user mode
2: Same as Level 3, but no NFS service
3: complete plain text mode with network functions
4: System retention
5: similar to running level 3, but using X Window
6. system restart

We can see from the above 7 levels that we can set the running level only to set 1, 2, 3, 5. I don't need to explain the values 0 and 6. If it is set to 4, the system will continue to shut down or restart automatically.

By default, to modify the default running level, modify the/etc/inittab file. However, Ubuntu does not have this file. But you need to change the/etc/init/rc-sysinit.conf file:

  1. Description "System V initialisation compatibility"
  2. Author "Scott James Remnant<Scott@ Netsplit.com>"
  3. Start on filesystem
  4. Stop on runlevel
  5. # Default runlevel, this may be overriden on the kernel command-line
  6. # Or by faking an old/etc/inittab entry
  7. EnvDEFAULT_RUNLEVEL=3
  8. # There can be no previous runlevel here, but there might be old
  9. # Information in/var/run/utmp that we pick up, and we don't want
  10. # That.
  11. #
  12. # These override that
  13. EnvRUNLEVEL=
  14. Env PREVLEVEL=
  15. Task
  16. Script
  17. # Check for default runlevel in/etc/inittab
  18. If [-r/etc/inittab]
  19. Then
  20. Eval "$ (sed-nre's/^ [^ #] [^:] * :( [0-6sS]): initdefault :.*/DEFAULT_RUNLEVEL="\ 1";/P'/etc/inittab | true )"
  21. Fi
  22. # Check kernel command-line for typical arguments
  23. For ARG in $ (cat/proc/cmdline)
  24. Do
  25. Case "$ {ARG}" in
  26. -B | emergency)
  27. # Emergency shell
  28. [-N "$ {FROM_SINGLE_USER_MODE}"] | sulogin
  29. ;;
  30. [0123456sS])
  31. # Override runlevel
  32. DEFAULT_RUNLEVEL="$ {ARG }"
  33. ;;
  34. -S | single)
  35. # Single user mode
  36. [-N "$ {FROM_SINGLE_USER_MODE}"] |DEFAULT_RUNLEVEL=S
  37. ;;
  38. Esac
  39. Done
  40. # Run the system initialisation scripts
  41. [-N "$ {FROM_SINGLE_USER_MODE}"] |/etc/init. d/rcS
  42. # Switch into the default runlevel
  43. Telinit "$ {DEFAULT_RUNLEVEL }"
  44. End script

SeeEnv DEFAULT_RUNLEVEL = 3This line does not exist, right. Here is the default running level of the system. You can modify the running level by modifying the value here.

View the running level of the system: runlevel

Switch system running level: init 0 ~ 6

========================================================== ======================================

I directly set env DEFAULT_RUNLEVEL to 1, that is, after entering the single-user mode, the system will not be able to move to the selection user interface. The solution is to restart the system. Press the shirt key to go to The Boot Loader selection page, select the first boot menu, and press the e key, then press ctrl + X as prompted to use root to enter the command-only mode. Change the previously modified value back to the original value, restart, OK !!

By default, the boot/grub/menu. lst file is modified for the bootstrap loader, but Ubuntu does not. Instead, the file/boot/grub. cfg is modified...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.