Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch.sock: connect: no such file or directory #55

Open
wavemomo opened this issue Sep 21, 2022 · 11 comments
Open

ch.sock: connect: no such file or directory #55

wavemomo opened this issue Sep 21, 2022 · 11 comments

Comments

@wavemomo
Copy link

I used CDI to do it. But there are some problems.

  1. the Dockerfile is:
FROM ubuntu:jammy AS rootfs
RUN apt-get update -y && \
    apt-get install -y --no-install-recommends systemd-sysv udev lsb-release cloud-init sudo openssh-server && \
    rm -rf /var/lib/apt/lists/*
  1. the vm.yaml:
apiVersion: virt.virtink.smartx.com/v1alpha1
kind: VirtualMachine
metadata:
  name: test-vm
spec:
  instance:
    memory:
      size: 4Gi
    kernel:
      image: smartxworks/virtink-kernel-5.15.12
      cmdline: "console=ttyS0 root=/dev/vda rw"
    disks:
      - name: ubuntu
      - name: cloud-init
    interfaces:
      - name: pod
  volumes:
    - name: ubuntu
      persistentVolumeClaim:
        claimName: rootfs-dv
      #dataVolume:
      # volumeName: ubuntu
    - name: cloud-init
      cloudInit:
        userData: |-
          #cloud-config
          password: password
          chpasswd: { expire: False }
          ssh_pwauth: True
  networks:
    - name: pod
      pod: {}

when I apply the vm.yaml,the pod is runinng, but it would quit or block later.
I try to solve the problem.

  1. use kubectl logs -f vm-test-vm-xxx:
    it looks like successfuly, but the pod will quit later.

image

image

  1. use kubectl describe vm test-vm :

image

@fengye87
Copy link
Contributor

@wavemomo There're some missing steps between the Dockerfile and the data volume? How did you create the image for CDI to import?

@wavemomo
Copy link
Author

@fengye87 Thanks for your reply firstly. Here are my steps to create/import image.

  1. create image:
truncate -s 10G input_raw
mkfs.ext4 input_raw
mkdir rootfs
mount input_raw rootfs/
docker create --name ubuntu-rootfs ubuntu-rootfs
docker export ubuntu-rootfs | tar -xvf - -C ./rootfs/
umount ./rootfs
qemu-img convert -f raw input_raw -O qcow2 output_rootfs.qcow2
  1. import into datavolume:
curl -v --insecure -H "Authorization: Bearer $TOKEN" --data-binary @/root/virtink/rootfs.qcow2 https://$(kube ip):31001/v1alpha1/upload

@fengye87
Copy link
Contributor

@wavemomo I followed your steps but could not reproduce the same problem. Both my VM and the VM pod stayed in the Running state, but I did see the VM didn't start up normally since there's no login prompt. I think there's something missing in the Dockerfile. I'll look into it further. Could you confirm that you create and start the VM after the data volume has been completed imported? And what version of Virtink are you using?

Screen Shot 2022-09-22 at 14 31 02

@wavemomo
Copy link
Author

wavemomo commented Sep 22, 2022

@fengye87 Yes, the VM and the VM pod would stay in the Running state but it would block(but actully, I start the VM first time, the VM pod would quit after login prompt) . And the version of Virtink in my cluster is v0.10.1.
image

By the way, can you share your steps of building image and rootfs if it's different from mine?

@fengye87
Copy link
Contributor

@wavemomo I used your Dockerfile and your steps to build the image, the only difference is that I was using the http download method of CDI instead of uploading.

@wavemomo
Copy link
Author

@fengye87 But my Dockerfile is not different from the official example given?

@fengye87
Copy link
Contributor

@wavemomo There's a difference. See the highlighted line below. That could be the cause.

Screen Shot 2022-09-22 at 15 22 48

@wavemomo
Copy link
Author

@fengye87 I try to use the Dockerfile of official example, the error is :
image

@fengye87
Copy link
Contributor

@wavemomo You should use the /rootfs dir as the image's root when use the official rootfs image.

@wavemomo
Copy link
Author

@fengye87 How to use the /rootfs dir as the image's root? Can you give a sample?Thanks very much

@fengye87
Copy link
Contributor

@wavemomo You can spin up the container, run your steps inside the container (skip the docker part, just copy /rootfs to the image's mount point), and copy the qcow2 image to host. You may need to run apk add qemu-img first to install qemu-img inside the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants