Documentation Index

Fetch the complete documentation index at: https://guide.ncloud-docs.com/llms.txt

Use this file to discover all available pages before exploring further.

Ubuntu 22.04

Prev Next

Available in VPC

This guide describes how to update a kernel on the Ubuntu 22.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 other setting tasks. Therefore, review 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 no longer provide regular updates. 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
  • Kernel updates are performed at your own risk, and you are responsible for managing any issues that arise during the update process.
  • You can work safely by using a server image to create a backup copy before updating the kernel.
  • NAVER Cloud Platform does not provide separate technical support regarding this guide and kernel updates.

Check kernel versions available for update

To update kernels for Ubuntu 22.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.
To quickly apply the latest patches, we recommend switching to an external Public Mirror site. 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@ubuntu2204:~# apt-cache search linux-image-5.15.0 | grep -E 'linux-image-5\.15\.0-1+.*generic'
    linux-image-5.15.0-100-generic - Signed kernel image generic
    linux-image-5.15.0-101-generic - Signed kernel image generic
    linux-image-5.15.0-102-generic - Signed kernel image generic
    linux-image-5.15.0-105-generic - Signed kernel image generic
    linux-image-5.15.0-106-generic - Signed kernel image generic
    linux-image-5.15.0-107-generic - Signed kernel image generic
    linux-image-5.15.0-112-generic - Signed kernel image generic
    linux-image-5.15.0-113-generic - Signed kernel image generic
    linux-image-5.15.0-116-generic - Signed kernel image generic
    linux-image-5.15.0-117-generic - Signed kernel image generic
    linux-image-5.15.0-118-generic - Signed kernel image generic
    linux-image-5.15.0-119-generic - Signed kernel image generic
    linux-image-5.15.0-121-generic - Signed kernel image generic
    linux-image-5.15.0-122-generic - Signed kernel image generic
    linux-image-5.15.0-124-generic - Signed kernel image generic
    

Update kernel

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

Note

This guide provides an example of upgrading the kernel version to 5.15.0-124-generic on a Ubuntu 22.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@ubuntu2204:~# uname -r
    5.15.0-94-generic
    
  3. Check the repository information connected to the server.
    root@ubuntu2204:~# grep ^deb /etc/apt/sources.list  
    deb http://repo.ncloud.com/ubuntu jammy main restricted
    deb http://repo.ncloud.com/ubuntu jammy-updates main restricted
    deb http://repo.ncloud.com/ubuntu jammy universe
    deb http://repo.ncloud.com/ubuntu jammy-updates universe
    deb http://repo.ncloud.com/ubuntu jammy multiverse
    deb http://repo.ncloud.com/ubuntu jammy-updates multiverse
    deb http://repo.ncloud.com/ubuntu jammy-backports main restricted universe multiverse
    deb http://repo.ncloud.com/ubuntu jammy-security main restricted
    deb http://repo.ncloud.com/ubuntu jammy-security universe
    deb http://repo.ncloud.com/ubuntu jammy-security multiverse
    
  4. Check the kernel version provided by the repository.
    root@ubuntu2204:~# rm -rf /var/cache/apt/archives/*
    root@ubuntu2204:~# rm -rf /var/lib/apt/lists/*
    root@ubuntu2204:~# apt clean
    root@ubuntu2204:~# apt update 
    Hit:1 http://repo.ncloud.com/ubuntu jammy InRelease
    Get:2 http://repo.ncloud.com/ubuntu jammy-updates InRelease [128 kB]
    Get:3 http://repo.ncloud.com/ubuntu jammy-backports InRelease [127 kB]
    Get:4 http://repo.ncloud.com/ubuntu jammy-security InRelease [129 kB]
    
    ... Omitted ...  
    
    Fetched 11.1 MB in 2s (5,400 kB/s)                                
    Reading package lists... Done  
    
    root@ubuntu2204:~# apt policy linux-image-5.15.0-124-generic
    linux-image-5.15.0-124-generic:
      Installed: (none)
      Candidate: 5.15.0-124.134
      Version table:
         5.15.0-124.134 500
            500 http://repo.ncloud.com/ubuntu jammy-updates/main amd64 Packages
            500 http://repo.ncloud.com/ubuntu jammy-security/main amd64 Packages
    
  5. Install the reviewed 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@ubuntu2204:~# apt install linux-{image,headers}-5.15.0-124-generic
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      eatmydata libeatmydata1 python-babel-localedata python3-babel python3-certifi python3-jinja2 python3-json-pointer python3-jsonpatch python3-jsonschema python3-markupsafe python3-pyrsistent python3-requests python3-tz python3-urllib3
    Use 'apt autoremove' to remove them.
    The following additional packages will be installed:
      linux-headers-5.15.0-124 linux-modules-5.15.0-124-generic
    Suggested packages:
      fdutils linux-doc | linux-source-5.15.0 linux-tools linux-modules-extra-5.15.0-124-generic
    The following NEW packages will be installed:
      linux-headers-5.15.0-124 linux-headers-5.15.0-124-generic linux-image-5.15.0-124-generic linux-modules-5.15.0-124-generic
    0 upgraded, 4 newly installed, 0 to remove and 176 not upgraded.
    Need to get 49.4 MB of archives.
    After this operation, 231 MB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    
    ... Omitted ...   
    
    Found linux image: /boot/vmlinuz-5.15.0-124-generic
    Found initrd image: /boot/initrd.img-5.15.0-124-generic
    Found linux image: /boot/vmlinuz-5.15.0-94-generic
    Found initrd image: /boot/initrd.img-5.15.0-94-generic
    Found linux image: /boot/vmlinuz-5.15.0-92-generic
    Found initrd image: /boot/initrd.img-5.15.0-92-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.
    done
    Scanning processes...                                                                                                                                                                                                                                                                       
    Scanning linux images...                                                                                                                                                                                                                                                                    
    
    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@ubuntu2204:~# dpkg -l | grep linux-image | grep ii
     ii  linux-image-5.15.0-124-generic        5.15.0-124.134                          amd64        Signed kernel image generic
     ii  linux-image-5.15.0-92-generic         5.15.0-92.102                           amd64        Signed kernel image generic
     ii  linux-image-5.15.0-94-generic         5.15.0-94.104                           amd64        Signed kernel image generic
    
  7. Configure it so that the most recent kernel version can be selected as the default when booting.
    root@ubuntu2204:~# sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g' /etc/default/grub
    
    root@ubuntu2204:~# grep "GRUB_DEFAULT" /etc/default/grub
    GRUB_DEFAULT=saved
    
    root@ubuntu2204:~# grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-124-generic"
    
    root@ubuntu2204:~# grub-editenv list
    saved_entry=Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-124-generic   
    
    root@ubuntu2204:~# update-grub
    Sourcing file `/etc/default/grub'
    Sourcing file `/etc/default/grub.d/init-select.cfg'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-5.15.0-124-generic
    Found initrd image: /boot/initrd.img-5.15.0-124-generic
    Found linux image: /boot/vmlinuz-5.15.0-94-generic
    Found initrd image: /boot/initrd.img-5.15.0-94-generic
    Found linux image: /boot/vmlinuz-5.15.0-92-generic
    Found initrd image: /boot/initrd.img-5.15.0-92-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.
    done
    
  8. Reboot the server to activate the latest kernel version.
    root@ubuntu2204:~# 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@ubuntu2204:~# uname -r
    5.15.0-124-generic
    
    Note

    To check if the updated kernel is properly applied, see Check kernel update to check the kernel installation status.

Check kernel update

To check if the kernel update was successfully applied:

  1. Access the server remotely.
  2. Check if the kernel package is installed.
    root@ubuntu2204:~# dpkg -l | grep linux-image-5.15.0-124-generic
    ii  linux-image-5.15.0-124-generic        5.15.0-124.134                          amd64        Signed kernel image generic
    
  3. Check if the initramfs file and vmlinuz file are created in the /boot directory.
    root@ubuntu2204:~# ls -l /boot/initrd.img-5.15.0-124-generic
    -rw-r--r-- 1 root root 46553441 Oct 23 14:48 /boot/initrd.img-5.15.0-124-generic
    
    root@ubuntu2204:~# ls -l /boot/vmlinuz-5.15.0-124-generic
    -rw------- 1 root root 11700328 Sep 28 03:47 /boot/vmlinuz-5.15.0-124-generic
    
  4. Check if the latest kernel settings are registered in the grub.cfg file.
    root@ubuntu2204:~# awk -F"--class" '/menuentry/ && /with Linux/ {print $1}' /boot/grub/grub.cfg | awk '{print i++ " : " $5,$6,$7,$8}' | sed -e "s/'/ /g"
    0 : 5.15.0-124-generic   
    1 : 5.15.0-124-generic (recovery mode) 
    2 : 5.15.0-94-generic   
    3 : 5.15.0-94-generic (recovery mode) 
    4 : 5.15.0-92-generic   
    5 : 5.15.0-92-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 the Single mode. For more information on how to run reboot in the Single mode, see Server recovery guide.

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

  2. Click the Server menu.

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

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

    • Ubuntu 22.04 grub booting interface
      kernel-update-kvm-ubuntu22_console01

      kernel-update-kvm-ubuntu22_console02

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

    root@ubuntu2204:~# uname -r
    5.15.0-94-generic
    
  6. Check the kernel version that is currently active.

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

    root@ubuntu2204:~# sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g' /etc/default/grub
    
    root@ubuntu2204:~# grep "GRUB_DEFAULT" /etc/default/grub
    GRUB_DEFAULT=saved
    
    root@ubuntu2204:~# grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-94-generic"
    
    root@ubuntu2204:~# grub-editenv list
    saved_entry=Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-94-generic    
    
    root@ubuntu2204:~# update-grub
    Sourcing file `/etc/default/grub'
    Sourcing file `/etc/default/grub.d/init-select.cfg'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-5.15.0-124-generic
    Found initrd image: /boot/initrd.img-5.15.0-124-generic
    Found linux image: /boot/vmlinuz-5.15.0-94-generic
    Found initrd image: /boot/initrd.img-5.15.0-94-generic
    Found linux image: /boot/vmlinuz-5.15.0-92-generic
    Found initrd image: /boot/initrd.img-5.15.0-92-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.
    done
    
  8. (Optional) Reboot the server to check whether the server boots up normally with the updated kernel version.

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

    root@ubuntu2204:~# uname -r
    5.15.0-94-generic