1

I need to install the latest LTS Ubuntu (22.04) in KVM. Few years ago I installed 18.04 in this way and it worked:

sudo virt-install --name new_server --ram=2048 --vcpus=1 --cpu host --hvm --disk path=/var/lib/libvirt/images/new_server,size=20 --location http://gb.archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/ --graphics none --console pty,target_type=serial --extra-args 'console=ttyS0,115200n8 serial' --os-type linux --os-variant ubuntu18.04 --network network:default --hvm --force --debug

But now I got this error:

ValueError: Could not find an installable distribution at 'http://gb.archive.ubuntu.com/ubuntu/dists/jammy/main/installer-amd64/'

How I could install Ubuntu 22.04 on KVM in console mode?

3

1 Answer 1

1

I found this solution:

  1. Download the ISO image

    wget https://releases.ubuntu.com/jammy/ubuntu-22.04.2-live-server-amd64.iso

  2. Create mount point folder and mount the image:

    mkdir mnt
    sudo mount -o loop ubuntu-22.04.2-live-server-amd64.iso mnt
    
    
  3. Run virt-install with ISO image custom kernel path (it's required to pass console=ttyS0 arg, without this arg there is no console output and installation process is impossible):

    sudo virt-install --name myvm --ram=4096 --vcpus=1 --cpu host --hvm --disk path=/virt1/machines/myvm/myvm,size=40 --cdrom ubuntu-22.04.2-live-server-amd64.iso --graphics none --console pty,target_type=serial --os-type linux --network network:default --hvm --force --debug --boot kernel=mnt/casper/vmlinuz,initrd=mnt/casper/initrd,kernel_args="console=ttyS0"
    
    
  4. Install Ubuntu as usual

  5. Stop the VM

    virsh destroy myvm

  6. Remove boot options from VM configuration:

    sudo virsh edit myvm

Following lines should be removed:

<kernel>/home/user/mnt/casper/vmlinuz</kernel>
<initrd>/home/user/mnt/casper/initrd</initrd>
<cmdline>console=ttyS0</cmdline>
  1. Start the VM:

    virsh start myvm

Now use it as usual.

It seems there is a possibility to use --install option in newer versions of virsh-manager. Also I saw the kernel and the initrd params in the --location path. Maybe it also could work. But I have virsh-manager 1.5.1 and these options are unavailable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .