0

I download qcow2 ubuntu 18.04 img from here: https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img

I want to add some packages into qcow2 image before use it as a base img to create vms on it.

This command to update repos give success:

> virt-customize -a ubuntu18.04-zsh.img --run-command 'apt update -y'
[   0.0] Examining the guest ...
[   4.7] Setting a random seed
virt-customize: warning: random seed could not be set for this type of
guest
[   4.7] Running: apt update -y
[  65.5] Finishing off

But when I try to install zsh, it fail to connect to internet:

> virt-customize -a ubuntu18.04-zsh.img --install zsh
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/z/zsh/zsh-common_5.4.2-3ubuntu3.1_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/z/zsh/zsh_5.4.2-3ubuntu3.1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
virt-customize: error:
        export DEBIAN_FRONTEND=noninteractive
        apt_opts='-q -y -o Dpkg::Options::=--force-confnew'
        apt-get $apt_opts update
        apt-get $apt_opts install 'zsh'
      : command exited with an error

If reporting bugs, run virt-customize with debugging enabled and include
the complete output:

  virt-customize -v -x [...]

There's no vm is running on ubuntu18.04-zsh.img. Is there a way to customize qcow2 img?

Tuyen Pham
  • 111
  • 5

1 Answers1

1
quanlm@quan-laptop:/works/home/quan/Downloads$ sudo virt-customize -a xenial-server-cloudimg-amd64-disk01.img --run-command 'sudo apt update -y'
[   0,0] Examining the guest ...
[   2,1] Setting a random seed
[   2,1] Running: sudo apt update -y
[  14,3] Finishing off
quanlm@quan-laptop:/works/home/quan/Downloads$ sudo virt-customize -a xenial-server-cloudimg-amd64-disk01.img --install htop
[   0,0] Examining the guest ...
[   2,1] Setting a random seed
[   2,1] Installing packages: htop
[  30,8] Finishing off
quanlm@quan-laptop:/works/home/quan/Downloads$ sudo virt-customize -a xenial-server-cloudimg-amd64-disk01.img --install zsh
[   0,0] Examining the guest ...
[   2,2] Setting a random seed
[   2,2] Installing packages: zsh
[  43,2] Finishing off

Are you sure that zsh have different package name in ubuntu18.04 This image is 16.04 And try the command with sudo too ?

  • I'm not quite sure about 16.04, will try if I had time but for now I upload it instead of going online. – Tuyen Pham Nov 04 '19 at 10:24
  • I tried with ubuntu 16.04 LTS, still fail to connect to internet. Did I have to config static ip address inside qcow2 img before make it able to connect to internet? – Tuyen Pham Nov 05 '19 at 03:45
  • 1
    I'm not sure about that. My image got download directly from ubuntu clound image website Have you try with sudo ? – Lê Minh Quân Nov 05 '19 at 03:55
  • `virt-customize: warning: random seed could not be set for this type of guest` I think this is the problems from the start – Lê Minh Quân Nov 05 '19 at 04:00
  • Can you help to give link of your downloaded image? – Tuyen Pham Nov 05 '19 at 04:01
  • I'm using this link: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img and believe the same as yours. – Tuyen Pham Nov 05 '19 at 04:06