Knowlege: Using vnc for Guest Installs

Disclaimer: While the following instructions are specific to Red Hat Enterprise Linux, they can be applied to other Linux distributions with a few modifications.

Starting a vnc Server for Installs

The text-based installers are usually identical in terms of supported features for most linux distributions.
However, Red Hat's RHEL graphical installer offers additional features and options to choose from. To be able to take advantage of this enriched installer on a platform like IBM Z which has no graphical console by default, a vnc server can be started during install.
To do so, run virt-install with a so-called kickstart response file, and make sure vnc is specified.
Here is an example kickstart file rh.ks:
   vnc
   install
   ignoredisk --only-use=vda
   clearpart --all
   autopart
   bootloader --location=mbr --driveorder=vda
   rootpw <your_pw>
   timezone Europe/Athens
   reboot
   %packages
   @Core
   %end
Next, trigger an install using virt-install as usual, specifying rh.ks:
   virt-install --name rhel75 --disk size=6 --memory=2000 --vcpus=2 \
   --location=/var/lib/libvirt/images/RHEL-ALT-7.5-20180308.0-Server-s390x-dvd1.iso \
   --network type=direct,source=virbr0,model=virtio --initrd-inject=rh.ks \
   --extra-args "inst.ks=file:///rh.ks"
   [...]
   Starting installer, one moment...
   [...]
   Starting VNC...
   The VNC server is now running.
   Please manually connect your vnc client to 192.168.122.63:1 to begin the install.
 

Note that the port listed in the message above can be misleading: The vnc server uses a port range starting at 5900. So while the message lists port 1 for the vnc server, in reality the port used by vnc is port 5900+1=5901. However, some clients will map port 1 to 5901 automatically, hence a connection to port 1 would work, too.

Connecting a vnc Client

Since virt-install uses NAT by default, we cannot access the private net address 192.168.122.63 directly. Instead, we have to set up SSH port forwarding to reach the guest's IP in private subnet 192.168.0.0/16 from a workstation. To avoid any conflicts, we map port 5901 to an arbitrary port (e.g. 9997) on the workstation.
Here is a sketch illustrating the setup:
To configure, proceed as follows:
  1. On the workstation,use
       ssh -L 9997:192.168.122.63:5901 <host>
    to map the guest vnc server's port to local port 9997.
    Note that you can use an arbitrary account on the host for port forwarding. Which can be helpful in case your admin disabled root logins using ssh.
  2. Then point the vnc client on the workstation to 127.0.0.1:9997.
As you can see, there are no changes on the host required at all.
You should be greeted by the installer's welcome screen:

2 comments:

  1. can't obtain dhcp address use your mentioned virt-install command.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Starting installer, one moment...
    anaconda 21.48.22.134-1 for Red Hat Enterprise Linux 7.5 started.
    * installation log files are stored in /tmp during the installation
    * if the graphical installation interface fails to start, try again with the
    inst.text bootoption to start text installation
    * when reporting a bug add logs from /tmp as separate text/plain attachments
    01:39:01 Not asking for VNC because we don't have a network
    01:39:01 Starting VNC...
    01:39:07 The VNC server is now running.
    01:39:07

    WARNING!!! VNC server running with NO PASSWORD!
    You can use the vncpassword= boot option
    if you would like to secure the server.


    01:39:07 Please manually connect your vnc client to :1 to begin the install. Switch to the shell (Ctrl-B 2) and run 'ip addr' to find the .

    01:39:07 Attempting to start vncconfig

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    What can be the reason?

    ReplyDelete
    Replies
    1. This is most likely an issue with your network setup. Note that the sample .ks file in this blog entry features the following line:
      "--network type=direct,source=virbr0,model=virtio"
      This assumes the existence of a respective Linux bridge or Open vSwitch named "virbr0". Modify this line to match your environment, and you should be good!

      Delete