I would like to set kernel parameters through the droplet’s initialization script #cloud-config.
I saw your tutorials to set user related configuration https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup , but I have been unable to find information about to pass configuration setting for the kernel through the #cloud-config script
If this is possible, could you provide me with an example that shows how I would pass boot loader command parameters equivalent to "ignore_loglevel debug log_buf_len=100M "
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Heya @cybertrapped,
You can set the Kernel parameters in the GRUB configuration file and then reboot your Droplet to make the changes take effect.
With that said, yes, you can use cloud-config to update Grub and then reboot your Droplet.
The kernel parameters are typically added in the line starting with
GRUB_CMDLINE_LINUX_DEFAULT
in the/etc/default/grub
file.Here’s an example cloud-config that would append “ignore_loglevel debug log_buf_len=100M” to your kernel command line:
This script will create a new file under
/etc/default/grub.d/
with the name50-cloudimg-settings.cfg
. The content of the file isGRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT ignore_loglevel debug log_buf_len=100M"
.It’s important to note that the files in this directory are processed in alphanumeric order, and they modify the environment variables that are used in the main
/etc/default/grub
file.The
runcmd
directive will runupdate-grub
command to regenerate the GRUB configuration file.On the next reboot, your new kernel parameters will be in effect.