How to use Linode API to set Linode distro default Kernel via Grub2?

Due to Linode 4.17+ Kernel issues outlined at https://www.linode.com/community/questions/17069, how would you go about using Linode v4 API to set in custom stackscript the profile configuration to use Boot Settings for Grub2 by default for instructions outlined at https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distribution-supplied-kernel-with-kvm/ ?

Linode v3 API docs https://www.linode.com/api/linode/linode.config.update are listed as deprecated for commands like

LINODE_APIKEY=
LINODE_ID=
CONFIG_ID=
GRUB2_ID=210

curl -4s "https://api.linode.com/?api_key=$LINODE_APIKEY&api_action=linode.config.update&LinodeID=$LINODE_ID&ConfigID=$CONFIG_ID&KernelID=$GRUB2_ID"

What is the Linode v4 API equivalent ? Is it something from https://developers.linode.com/api/v4#operation/getLinodeConfig like

LINODE_APIKEY=
LINODE_ID=
CONFIG_ID=
GRUB2_ID=210

curl -H "Content-Type: application/json" \
    -H "Authorization: Bearer $LINODE_APIKEY" \
    -X PUT -d '{
      "kernel": "$GRUB2_ID"
 }' \
 https://api.linode.com/v4/linode/instances/$LINODE_ID/configs/$CONFIG_ID

where you set appropriately

LINODE_APIKEY=
LINODE_ID=
CONFIG_ID=

2 Replies

Linode Staff

Hey there,

You can pass in the string linode/grub2 as the kernel ID when updating your configuration profile. Take a look here:

https://developers.linode.com/api/v4#operation/updateLinodeConfig

You can find the full list of kernels using the /linode/kernels API endpoint. So in this case, you can simply do:

curl -H "Content-Type: application/json" \
    -H "Authorization: Bearer $LINODE_APIKEY" \
    -X PUT -d '{
      "kernel": "linode/grub2"
 }' \
 https://api.linode.com/v4/linode/instances/$LINODE_ID/configs/$CONFIG_ID

On success, you'll get the updated config profile back as a JSON object and you should see "kernel": "linode/grub2" in the output.

thanks @mbeach

looks like linode has changed default for new linode creations to Grub2 right now probably due to the 4.17+ kernel issues, so the above isn't required right now

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct