Kernel boot param: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
No edit summary
m (Admin moved page Kernel kernel param to Kernel boot param over redirect)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Ubuntu team introducted a [https://wiki.ubuntu.com/Kernel/KernelBootParameters#About_Kernel_Boot_Parameters good guide for Kernel boot param]  and [[Linux]] kernel team keep update [https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html the latest available kernel boot param information]
Ubuntu team introducted a [https://wiki.ubuntu.com/Kernel/KernelBootParameters#About_Kernel_Boot_Parameters good guide for Kernel boot param]  and [[Linux]] kernel team keep update [https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html the latest available kernel boot param information]


Here are simple steps how to add boot parameter temporarily and permanent.
[https://www.kernelconfig.io/index.html kernelconfig.io] also provide comprehensive kernel parameter guide.


== Temporarily Add a Kernel Boot Parameter for Testing ==
== Perform temporary and permanent kernel parameter tuning ==
'''sysctl''' – command to configure kernel parameters at runtime
{| class="wikitable"
|+
!Purpose
!Options
!Description
|-
|
|'''a, -A'''
|Display all values currently available
|-
|Temporary Change
|'''-w'''
|Use this option when you want to change a sysctl setting
|-
|permanent Change
|
|Change/Define parameter value /etc/sysctl.conf  or crate your own file under /etc/modprobe.d
Run  sysctl -p to update the file changes
|}
 
== Add a Kernel Boot Parameter at boot time ==


# Start your system and wait for the GRUB menu to show (if you don't see a GRUB menu, press and hold the '''left Shift key''' right after starting the system).
# Start your system and wait for the GRUB menu to show (if you don't see a GRUB menu, press and hold the '''left Shift key''' right after starting the system).
Line 10: Line 32:
# Now press Ctrl + x to boot.
# Now press Ctrl + x to boot.


== Permanently Add a Kernel Boot Parameter ==
== Permanently Add a Kernel Boot Parameter to GRUB ==
Edit /etc/default/grub by adding or removing kernel boot parameter on the line of GRUB_CMDLINE_LINUX_DEFAULT  
Edit /etc/default/grub by adding or removing kernel boot parameter on the line of GRUB_CMDLINE_LINUX_DEFAULT  


Line 23: Line 45:
To permanently remove it, simply remove the parameter from GRUB_CMDLINE_LINUX_DEFAULT and run sudo update-grub again.
To permanently remove it, simply remove the parameter from GRUB_CMDLINE_LINUX_DEFAULT and run sudo update-grub again.


== Verify Your changes ==
=== Verify Your changes ===
 
To verify your changes, you can see exactly what parameters your kernel booted with by executing <syntaxhighlight lang="bash">
To verify your changes, you can see exactly what parameters your kernel booted with by executing <syntaxhighlight lang="bash">
$cat /proc/cmdline.
$cat /proc/cmdline.
</syntaxhighlight>
</syntaxhighlight>
== Notices ==
When you update the kernel in Ubuntu, it's possible that some of the kernel boot parameters may need to be reset. This is because certain kernel boot parameters are specific to the version of the kernel you are using, and when you update the kernel to a new version, these parameters may no longer be valid or may need to be updated.
== Reference ==

Latest revision as of 12:28, 3 January 2024

Ubuntu team introducted a good guide for Kernel boot param and Linux kernel team keep update the latest available kernel boot param information

kernelconfig.io also provide comprehensive kernel parameter guide.

Perform temporary and permanent kernel parameter tuning

sysctl – command to configure kernel parameters at runtime

Purpose Options Description
a, -A Display all values currently available
Temporary Change -w Use this option when you want to change a sysctl setting
permanent Change Change/Define parameter value /etc/sysctl.conf or crate your own file under /etc/modprobe.d

Run sysctl -p to update the file changes

Add a Kernel Boot Parameter at boot time

  1. Start your system and wait for the GRUB menu to show (if you don't see a GRUB menu, press and hold the left Shift key right after starting the system).
  2. Now highlight the kernel you want to use, and press the e key. You should be able to see and edit the commands associated with the highlighted kernel.
  3. Go down to the line starting with linux and add your parameter foo=bar to its end.
  4. Now press Ctrl + x to boot.

Permanently Add a Kernel Boot Parameter to GRUB

Edit /etc/default/grub by adding or removing kernel boot parameter on the line of GRUB_CMDLINE_LINUX_DEFAULT

  1. in terminal (or after pressing Alt + F2) run:
  2. sudo vi /etc/default/grub    #and enter your password.
  3. Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and append foo=bar to its end. For example:
  4. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash foo=bar"
  5. Save the file and close the editor.
  6. sudo update-grub # to update GRUB's configuration file (you probably need to enter your password).
  7. On the next reboot, the kernel should be started with the boot parameter.

To permanently remove it, simply remove the parameter from GRUB_CMDLINE_LINUX_DEFAULT and run sudo update-grub again.

Verify Your changes

To verify your changes, you can see exactly what parameters your kernel booted with by executing

$cat /proc/cmdline.

Notices

When you update the kernel in Ubuntu, it's possible that some of the kernel boot parameters may need to be reset. This is because certain kernel boot parameters are specific to the version of the kernel you are using, and when you update the kernel to a new version, these parameters may no longer be valid or may need to be updated.

Reference