Install CentOS Stream 9 booting VNC installer with kexec

Lately, dedicated servers come with Remote management consoles like IPMI KVM or iLO, or DRAC, but they are still slow to initiate the process of installing a system.

main menu
kexec execute

Consider a server (dedicated or not) should be installed in a remote colocation with the help of only the server’s network. The system administrator just receives an administrative shell access and nothing more and the server should be installed with the proper and secured software, in this case, the CentOS Stream 9. Using kexec the user can boot a new kernel from a different Linux Distribution and initiate automated network installation of the system and it is not needed any Remote management consoles. The only thing needed is the ability of the current system/kernel to be able to use kexec, which is pretty standard for 8 to 10 years old Linux systems. There is a good chance the colocations’ rescue CD/DVD/USB flash drives or the PXE rescue images support kexec, because they tend to upgrade their rescue systems, which the user may boot if he has problems.
Still, using kexec to initiate another kernel or Linux Distribution like CentOS Stream 9 with VNC installer, for example, it a powerful tool to safely replace a currently running system with only shell access.
This article has chosen to start the CentOS Stream 9 VNC installer just for demonstration purposes. Booting a downloaded kernel may be used for just anything from booting a system over the network, booting an installer, booting an unattended automation installation, and so on. There are a couple of simple things to check before booting the new kernel.
This article will show just one use case – reinstalling a system with CentOS Stream 9 over the network using the CentOS VNC Install. The purpose is to show how simple, fast, and easy is to install a modern Linux system only by having console access. No scripts are required if manual installation is performed.
To boot a CentOS Stream 9 VNC Installer the kexec command needs the following options.

The kexec commands need the following options:

  • Networkingdevice interface name, IP, netmask, gateway and DNS servers
  • Kernel options – these options will initiate scripts from the initramfs.
  • inst.vnc – a kernel option, which will start a VNC server with no password on the default port and network device. Using it with another inst.vncpassword=[PASSWORD] the VNC server will require the password – [PASSWORD]. The password should be a maximum of 8 characters because the VNC server will not start if it is with more!
  • inst.repo=[HTTP/HTTPS://repository] – a kernel option, which sets the CentOS HTTP/HTTPS repository.

The kexec command to boot the CentOS Stream 9 VNC Installer is:

kexec --initrd=./initrd.img -l ./vmlinuz --command-line="bootdev=eno1 nameserver= inst.vnc inst.vncpassword=cha3hae4ahZaqueev1ee inst.repo="

The kernel (i.e. vmlinuz) and the initramfs (i.e. initrd.img) should be downloaded in the current directory before executing the above command. The above line will order the kernel to load the new kernel, but to boot it another command must be executed:

kexec -e

Here is how to prepare and use the kexec command to boot another kernel from a rescue boot system.

STEP 2) Check the current network configuration.

Using iproute tool to find out the network configuration and the udevadm to ensure the real network device name.

root@rescue ~ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether c8:60:00:bd:35:0e brd ff:ff:ff:ff:ff:ff
    altname enp3s0
    inet scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a01:555:666:7777::2/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::ca60:ff:febd:350e/64 scope link 
       valid_lft forever preferred_lft forever
root@rescue ~ # ip ro
default via dev eth0 via dev eth0 dev eth0 scope link
root@rescue ~ # udevadm test-builtin net_id /sys/class/net/eth0
Load module index
Network interface NamePolicy= disabled on kernel command line, ignoring.
Parsed configuration file /usr/lib/systemd/network/
Parsed configuration file /usr/lib/systemd/network/
Created link configuration context.
Using default interface naming scheme 'v247'.
Unload module index
Unloaded link configuration context.

So the current networking configuration is – network device name: enp3s0, IP:, network mask: 27, gateway:

STEP 2) Install KEXEC if unavailable.

Install the kexec-tools if they are not available. The name kexec-tools is universal for Ubuntu and CentOS world, so it might be the same for the rest Linux Distros.

root@rescue ~ # cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION="11 (bullseye)"
root@rescue ~ # apt update
Hit:1 bullseye InRelease
Get:2 bullseye-updates InRelease [44.1 kB]                                        
Get:3 bullseye-security InRelease [48.4 kB]                                       
Hit:4 focal InRelease                                 
Hit:5 bullseye InRelease                                                                       
Get:6 bullseye-security InRelease [48.4 kB]                                                      
Get:7 bullseye-updates InRelease [44.1 kB]                                                     
Get:8 bullseye-updates/main amd64 Packages [14.8 kB]
Get:9 bullseye-security/main amd64 Packages [245 kB]
Get:10 bullseye-security/main Sources [201 kB]
Get:11 bullseye-security/main amd64 Packages [245 kB]
Get:12 bullseye-updates/main Sources [5084 B]
Get:13 bullseye-updates/main amd64 Packages [14.8 kB]
Fetched 909 kB in 1s (1273 kB/s)      
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@rescue ~ # apt install kexec-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 83.7 kB of archives.
After this operation, 285 kB of additional disk space will be used.
Get:1 bullseye/main amd64 kexec-tools amd64 1:2.0.20-2.1 [83.7 kB]
Fetched 83.7 kB in 0s (7291 kB/s)      
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_TIME = "bg_BG.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Preconfiguring packages ...
Selecting previously unselected package kexec-tools.
(Reading database ... 63757 files and directories currently installed.)
Preparing to unpack .../kexec-tools_1%3a2.0.20-2.1_amd64.deb ...
Unpacking kexec-tools (1:2.0.20-2.1) ...
Setting up kexec-tools (1:2.0.20-2.1) ...
Generating /etc/default/kexec...
Processing triggers for man-db (2.9.4-2) ...

STEP 3) Use the KEXEC to boot the CentOS Stream 9 VNC Installer.

First, download the kernel and initramfs. They are part of the installation disk and of the repository. The kernel is and the initramfs is

root@rescue ~ # wget
--2023-05-31 13:38:32--
Resolving ( 2600:9000:206f:8800:6:ec71:f900:93a1, 2600:9000:206f:4600:6:ec71:f900:93a1, 2600:9000:206f:4a00:6:ec71:f900:93a1, ...
Connecting to (|2600:9000:206f:8800:6:ec71:f900:93a1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12482312 (12M)
Saving to: 'vmlinuz'

vmlinuz                     100%[=========================================>]  11.90M  --.-KB/s    in 0.1s    

2023-05-31 13:38:32 (94.0 MB/s) - 'vmlinuz' saved [12482312/12482312]

root@rescue ~ # wget
--2023-05-31 13:38:36--
Resolving ( 2600:9000:206f:8800:6:ec71:f900:93a1, 2600:9000:206f:4600:6:ec71:f900:93a1, 2600:9000:206f:4a00:6:ec71:f900:93a1, ...
Connecting to (|2600:9000:206f:8800:6:ec71:f900:93a1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 99411964 (95M) [application/octet-stream]
Saving to: 'initrd.img'

initrd.img                  100%[=========================================>]  94.81M   107MB/s    in 0.9s    

2023-05-31 13:38:37 (107 MB/s) - 'initrd.img' saved [99411964/99411964]

Then use the networking information and replace it with the user’s current one and boot up the new kernel:

root@rescue ~ # kexec --initrd=./initrd.img -l ./vmlinuz --command-line="bootdev=enp3s0 nameserver= inst.vnc inst.vncpassword=cha3hae4 inst.repo="
root@rescue ~ # kexec -e
client_loop: send disconnect: Broken pipe
myuser@mydesktop ~ $ 

The ssh session brokes after a couple of seconds, right after the new kernel boots and the network is initialized. There is ping to the

Using the VNC viewer of the user’s choice will show the first step of the CentOS Stream 9 network installer:

myuser@mydesktop ~ $ vncviewer

TigerVNC Viewer 64-bit v1.9.0
Built on: 2021-09-30 01:44
Copyright (C) 1999-2018 TigerVNC Team and many others (see README.rst)
See for information on TigerVNC.

Wed May 31 15:01:20 2023
 DecodeManager: Detected 4 CPU core(s)
 DecodeManager: Creating 4 decoder thread(s)
 CConn:       connected to host port 5901
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8
 CConnection: Choosing security type VncAuth(2)

Wed May 31 15:01:33 2023
 CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888
 CConn:       Using Tight encoding
 CConn:       Enabling continuous updates

SCREENSHOT 1) The first screen of the CentOS Stream 9 Installer

main menu
VNC installer first screen

SCREENSHOT 2) Installation source and Network & Host Name are set from the kernel parameters, but may be changed.

main menu
installation summary

Leave a Reply

Your email address will not be published. Required fields are marked *