By cybertrapped
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!
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:
#cloud-config
write_files:
- path: /etc/default/grub.d/50-cloudimg-settings.cfg
content: |
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT ignore_loglevel debug log_buf_len=100M"
runcmd:
- update-grub
This script will create a new file under /etc/default/grub.d/ with the name 50-cloudimg-settings.cfg. The content of the file is GRUB_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 run update-grub command to regenerate the GRUB configuration file.
On the next reboot, your new kernel parameters will be in effect.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.