jump to navigation

Passing parameters to the kernel at boot time on Linux January 23, 2011

Posted by Tournas Dimitrios in Linux.
trackback

Sometimes, you might need to tune / change some of the Linux kernel behavior .There are three ways to pass parameters (options)  to the kernel and thus control its behavior:

  • When building the kernel.
  • At run-time, by writing to files in the /proc and /sys directories.
  • When starting the kernel. Usually, parameters are passed to the kernel when it is invoked from a boot file such as the GRUB or LILO configuration file.

This article will outline what options can be passed to the kernel at boot time ( temporary )  for the following reasons :

  • Password and other recovery operations
  • Troubleshoot system
  • Hardware parameters that the kernel would not able to determine on its own
  • Force kernel to override the default hardware parameters in order to increase performance or even for debugging .

The following table lists the most common options :

options at boot up
single  or  S The most common argument that is passed to the init process is the word ‘single’ which instructs init to boot the computer in single user mode, and not launch all the usual daemons
init=/bin/bash This sets the initial command to be executed by the kernel. Default is to use /sbin/init, which is the parent of all processes.
To boot system without password pass /bin/bash or /bin/sh as argument to init
root=/dev/hdb1 If you copy entire partition from /dev/hda1 to /dev/hdb1 then use
ro This argument tells the kernel to mount root file system as read-only. This is done so that fsck program can check and repair a Linux file system. Please note that you should never ever run fsck on read/write file system.
rw This argument tells the kernel to mount root file system as read and write mode.
panic=15 Specify kernel behavior on panic. By default, the kernel will not reboot after a panic, but this option will cause a kernel reboot after N seconds. For example following boot parameter will force to reboot Linux after 15 seconds
mem=2048M This is a classic parameter. Force usage of a specific amount of memory to be used when the kernel is not able to see the whole system memory or for test. For example:
debug Enable kernel debugging. This option is useful for kernel hackers and developers who wish to troubleshoot problem
selinux=[0.1] Disable or enable SELinux at boot time [1=enabled , 0= disabled].
hdb=noprobe Do not probe for hdX drive. For example, disable hdb hard disk:
initrd=/boot/initrd.img An initial ramdisk is a temporary file system used in the boot process of the Linux kernel. initrd and initramfs refer to slightly different schemes for loading this file system into memory. Both are commonly used to make preparations before the real root file system can be mounted.

How to pass these parameters :

  1. At the first 10 seconds of the boot process press any arrow key
  2. Select second line
  3. press ‘e’ to edit selected command
  4. Type any of above parameters.
  5. press ‘b’ to begin the boot process

For a more verbose list of possible parameters see this link >>>

Advertisements

Comments»

1. Passing parameters to the kernel at run-time time on Linux « Tournas Dimitrios - February 7, 2011

[…] trackback Sometimes, you might need to  change some of the Linux kernel behavior , a previous article demonstrated how to pass parameters to the kernel at boot time . At run-time we can  load / unload […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s