Ubuntu 24.04

Prev Next

Available in VPC

This guide describes how to update a kernel on the Ubuntu 24.04 server of NAVER Cloud Platform.

This guide is written based on new servers created on NAVER Cloud Platform, so there might be differences from the user server environment. User server environments may be affected by kernel updates and server restarts due to various reasons such as security hardening tasks and various setting tasks. Therefore, be familiar with the following before you perform a kernel update.

  • Create a replicated server using Server image before updating a kernel of the actual server. Perform the kernel update on the replicated server and check if it restarts successfully. When switching to operational status after restarting, check for any issues in the server. Perform the kernel update only after thorough validation to ensure there are no issues.
  • In the case of GPU servers, the GPU driver that matches the kernel version must be installed for normal operation. If the updated kernel is incompatible with GPU drivers, the GPU server might not function normally. Therefore, check GPU driver compatibility before you perform kernel updates. For related information, see GPU driver guide.
Note

This kernel update guide will no longer provide regular updates moving forward. Therefore, when checking for the latest information or installing a different kernel version, see the relevant guide and take the necessary steps.
The kernel version specified in the guide serves as an example, so make sure to thoroughly test other kernel versions as needed before installation.

Caution
  • The user is solely responsible for performing kernel updates on their server, and NAVER Cloud Platform will not be held responsible for any issues caused by these updates.
  • Normal server usage might be unavailable during kernel updates and restarts, and recovery from this issue is not supported. In addition, server recovery is not supported when the kernel update fails.
  • Before updating the kernel, make sure to keep the backup created through Server image until it is no longer needed.
  • No separate support is provided for problems related to this guide.

Check for kernel versions available for update

To update kernels for Ubuntu 24.04 servers, follow these steps:

By default, the repository URL is set to NCP Repo(http://repo.ncloud.com). However, in environments with a public IP or a private subnet configured with NAT, you may use an external public mirror site instead of NCP Repo.

Note

NCP repo is a repository provided by NAVER Cloud Platform to support user environments like VPC private subnets where external access is limited.
Since NCP repo synchronizes only 4 times a year, it is recommended to switch to an external public mirror site to apply the latest patches promptly. For more information, see Linux OS repository configuration checklist guide.

  1. Access the server you want to apply the kernel update to remotely.

  2. Check the kernel version to apply to the server.

    root@ubuntu2404:~# apt-cache search linux-image-6.8.0 | grep generic
    linux-image-6.8.0-31-generic - Signed kernel image generic
    linux-image-6.8.0-35-generic - Signed kernel image generic
    linux-image-6.8.0-36-generic - Signed kernel image generic
    linux-image-6.8.0-38-generic - Signed kernel image generic
    linux-image-6.8.0-39-generic - Signed kernel image generic
    linux-image-6.8.0-40-generic - Signed kernel image generic
    linux-image-6.8.0-41-generic - Signed kernel image generic
    linux-image-6.8.0-44-generic - Signed kernel image generic
    linux-image-6.8.0-45-generic - Signed kernel image generic
    linux-image-6.8.0-47-generic - Signed kernel image generic
    linux-image-6.8.0-48-generic - Signed kernel image generic
    linux-image-6.8.0-49-generic - Signed kernel image generic
    linux-image-6.8.0-50-generic - Signed kernel image generic
    linux-image-6.8.0-51-generic - Signed kernel image generic
    linux-image-6.8.0-52-generic - Signed kernel image generic
    linux-image-6.8.0-53-generic - Signed kernel image generic
    linux-image-6.8.0-54-generic - Signed kernel image generic
    
    Note

    If the latest kernel information is not updating, run the apt update command and try again.
    This command refreshes the OS repository's metadata and is recommended before executing any apt commands.

Update kernel

To update kernels for Ubuntu 24.04 servers, follow these steps:

Note

This guide provides an example of upgrading the kernel version to 6.8.0-54-generic on a Ubuntu 24.04 server.
The kernel versions available for installation at the time of referencing the guide may vary, so thoroughly test other versions before installation.

  1. Access the server you want to apply the kernel update to remotely.

  2. Check the kernel version of the server.

    root@ubuntu2404:~# uname -r
    6.8.0-52-generic
    
  3. Check the repository information connected to the server.

    root@ubuntu2404:~# cat /etc/apt/sources.list.d/ubuntu.sources
    Types: deb
    URIs: http://repo.ncloud.com/ubuntu/
    Suites: noble noble-updates noble-backports
    Components: main restricted universe multiverse
    Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
    
    Types: deb
    URIs: http://repo.ncloud.com/ubuntu/
    Suites: noble-security
    Components: main restricted universe multiverse
    Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
    
  4. Check the kernel version provided by the repository.

    root@ubuntu2404:~# rm -rf /var/cache/apt/archives/*
    root@ubuntu2404:~# rm -rf /var/lib/apt/lists/*
    root@ubuntu2404:~# apt clean
    root@ubuntu2404:~# apt update 
    Get:1 http://repo.ncloud.com/ubuntu noble InRelease [256 kB]
    Get:2 http://repo.ncloud.com/ubuntu noble-updates InRelease [126 kB]
    Get:3 http://repo.ncloud.com/ubuntu noble-backports InRelease [126 kB]
    Get:4 http://repo.ncloud.com/ubuntu noble-security InRelease [126 kB]
    Get:5 http://repo.ncloud.com/ubuntu noble/main amd64 Packages [1,401 kB]
    
    ... Omitted ...  
    
    Get:59 http://repo.ncloud.com/ubuntu noble-security/multiverse Translation-en [4,308 B]
    Get:60 http://repo.ncloud.com/ubuntu noble-security/multiverse amd64 Components [212 B]
    Get:61 http://repo.ncloud.com/ubuntu noble-security/multiverse amd64 c-n-f Metadata [356 B]
    Fetched 35.2 MB in 6s (5,890 kB/s)                                       
    Reading package lists... Done 
    
    root@ubuntu2404:~# apt policy linux-image-6.8.0-54-generic
    linux-image-6.8.0-54-generic:
      Installed: (none)
      Candidate: 6.8.0-54.56
      Version table:
         6.8.0-54.56 500
            500 http://repo.ncloud.com/ubuntu noble-updates/main amd64 Packages
            500 http://repo.ncloud.com/ubuntu noble-security/main amd64 Packages
    
  5. Install the viewed version of the kernel.
    Carefully review the list of packages being newly installed, updated, or removed. If everything is in order, enter Y to complete the installation.

    root@ubuntu2404:~# apt install linux-{image,headers}-6.8.0-54-generic
    Reading package lists... Done
    Building dependency tree... Done
    The following additional packages will be installed:
      linux-headers-6.8.0-54 linux-libc-dev linux-modules-6.8.0-54-generic linux-tools-common
    Suggested packages:
      fdutils linux-tools linux-modules-extra-6.8.0-54-generic
    The following NEW packages will be installed:
      linux-headers-6.8.0-54 linux-headers-6.8.0-54-generic linux-image-6.8.0-54-generic linux-modules-6.8.0-54-generic
    The following packages will be upgraded:
      linux-libc-dev linux-tools-common
    2 upgraded, 4 newly installed, 0 to remove and 192 not upgraded.
    Need to get 74.3 MB of archives.
    After this operation, 169 MB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    
    ... Omitted ...   
    
    Pending kernel upgrade!
    Running kernel version:
      6.8.0-52-generic
    Diagnostics:
      The currently running kernel version is not the expected kernel version 6.8.0-54-generic.
    
    Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting.
    
    No services need to be restarted.
    
    No containers need to be restarted.
    
    No user sessions are running outdated binaries.
    
    No VM guests are running outdated hypervisor (qemu) binaries on this host.
    
  6. After the installation is complete, check all bootable kernel versions.

     root@ubuntu2404:~# dpkg -l | grep linux-image | grep ii
     ii  linux-image-6.8.0-48-generic         6.8.0-48.48                             amd64        Signed kernel image generic
     ii  linux-image-6.8.0-52-generic         6.8.0-52.53                             amd64        Signed kernel image generic
     ii  linux-image-6.8.0-54-generic         6.8.0-54.56                             amd64        Signed kernel image generic
    
  7. Configure it so that the most recent kernel version can be selected as the default when booting.

    root@ubuntu2404:~# sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g' /etc/default/grub
    
    root@ubuntu2404:~# grep "GRUB_DEFAULT" /etc/default/grub
    GRUB_DEFAULT=saved
    
    root@ubuntu2404:~# grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-54-generic"
    
    root@ubuntu2404:~# grub-editenv list
    saved_entry=Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-54-generic
    
    root@ubuntu2404:~# update-grub
    Sourcing file `/etc/default/grub'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-6.8.0-54-generic
    Found initrd image: /boot/initrd.img-6.8.0-54-generic
    Found linux image: /boot/vmlinuz-6.8.0-52-generic
    Found initrd image: /boot/initrd.img-6.8.0-52-generic
    Found linux image: /boot/vmlinuz-6.8.0-48-generic
    Found initrd image: /boot/initrd.img-6.8.0-48-generic
    Warning: os-prober will not be executed to detect other bootable partitions.
    Systems on them will not be added to the GRUB boot configuration.
    Check GRUB_DISABLE_OS_PROBER documentation entry.
    Adding boot menu entry for UEFI Firmware Settings ...
    done
    
  8. Reboot the server to activate the latest kernel version.

    root@ubuntu2404:~# sync;reboot
    
    Note

    If the server reboot fails, it means the kernel update was not successfully applied. In this case, see Restore kernel update to revert to the previous kernel version.

  9. Log in to the server again and check if the new kernel is activated.

    root@ubuntu2404:~# uname -r
    6.8.0-54-generic
    
    Note

    To check if the updated kernel is properly applied, see Checking kernel updates to check the kernel installation status.

Check kernel update

To check if the kernel update was successfully applied, follow these steps:

  1. Access the server remotely.
  2. Check if the kernel package is installed.
    root@ubuntu2404:~# dpkg -l | grep linux-image-6.8.0-54-generic
    ii  linux-image-6.8.0-54-generic         6.8.0-54.56                             amd64        Signed kernel image generic
    
  3. Check if the initramfs file and vmlinuz file are created in the /boot directory.
    root@ubuntu2404:~# ls -l /boot/initrd.img-6.8.0-54-generic
    -rw-r--r-- 1 root root 43681971 Mar  5 18:49 /boot/initrd.img-6.8.0-54-generic
    
    root@ubuntu2404:~# ls -l /boot/vmlinuz-6.8.0-54-generic
    -rw------- 1 root root 14985608 Feb  8 07:01 /boot/vmlinuz-6.8.0-54-generic
    
  4. Check if the latest kernel settings are registered in the grub.cfg file.
    root@ubuntu2404:~# awk -F"--class" '/menuentry/ && /with Linux/ {print $1}' /boot/grub/grub.cfg | awk '{print i++ " : " $5,$6,$7,$8}' | sed -e "s/'/ /g"
    0 : 6.8.0-54-generic    
    1 : 6.8.0-54-generic (recovery mode)  
    2 : 6.8.0-52-generic    
    3 : 6.8.0-52-generic (recovery mode)  
    4 : 6.8.0-48-generic    
    5 : 6.8.0-48-generic (recovery mode)
    

Restore kernel update

If the server fails to restart properly after a kernel update, you must revert to the previous kernel before the update. You can revert it to one of the many installed kernel versions, and this guide describes how to revert the kernel to the version immediately before the update.

Note

To resolve server restart issues, you can attempt server recovery by entering single mode. For more information on how to run reboot in Single Mode, see Server recovery guide.

  1. In the VPC environment of the NAVER Cloud Platform console, navigate to i_menu > Services > Compute > Server.

  2. Click the Server menu.

  3. Select the server to recover from the server image list, and then click the [Server connection console] button.

  4. Select the previous version as the booting kernel from the grub booting page and reboot.

    • Ubuntu 24.04 grub boot page
      kernel-update-kvm-ubuntu24_console01

      kernel-update-kvm-ubuntu24_console02

  5. After booting is complete, check the kernel version of the server.

    root@ubuntu2404:~# uname -r
    6.8.0-52-generic
    
  6. Check the kernel version that is currently active.

    root@ubuntu2404:~# awk -F"--class" '/menuentry/ && /with Linux/ {print $1}' /boot/grub/grub.cfg | awk '{print i++ " : " $5,$6,$7,$8}' | sed -e "s/'/ /g"
    0 : 6.8.0-54-generic    
    1 : 6.8.0-54-generic (recovery mode)  
    2 : 6.8.0-52-generic    
    3 : 6.8.0-52-generic (recovery mode)  
    4 : 6.8.0-48-generic    
    5 : 6.8.0-48-generic (recovery mode)
    
  7. Reset the default kernel version to the previous kernel version when booting.

    root@ubuntu2404:~# sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g' /etc/default/grub
    
    root@ubuntu2404:~# grep "GRUB_DEFAULT" /etc/default/grub
    GRUB_DEFAULT=saved
    
    root@ubuntu2404:~# grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-52-generic"
    
    root@ubuntu2404:~# grub-editenv list
    saved_entry=Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-52-generic
    
    root@ubuntu2404:~# update-grub
    Sourcing file `/etc/default/grub'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-6.8.0-54-generic
    Found initrd image: /boot/initrd.img-6.8.0-54-generic
    Found linux image: /boot/vmlinuz-6.8.0-52-generic
    Found initrd image: /boot/initrd.img-6.8.0-52-generic
    Found linux image: /boot/vmlinuz-6.8.0-48-generic
    Found initrd image: /boot/initrd.img-6.8.0-48-generic
    Warning: os-prober will not be executed to detect other bootable partitions.
    Systems on them will not be added to the GRUB boot configuration.
    Check GRUB_DISABLE_OS_PROBER documentation entry.
    Adding boot menu entry for UEFI Firmware Settings ...
    done
    
  8. (Optional) Reboot the server to check whether the server boots up normally with the updated kernel version.

    root@ubuntu2404:~# sync;reboot
    
  9. (Optional) Log back into the server to check the booting status and the kernel version.

    root@ubuntu2404:~# uname -r
    6.8.0-52-generic