weaveworks / ignite

Ignite a Firecracker microVM
https://ignite.readthedocs.org
Apache License 2.0
3.49k stars 225 forks source link

How to attach to serial console #180

Open andrewrynhard opened 5 years ago

andrewrynhard commented 5 years ago

I'm a little confused on what ignite logs is. I was expecting the console output. How would I get console output? I'm seeing:

root@dkr1:~# ignite run autonomy/talos:1e9548d-dirty \
>     --kernel-image autonomy/kernel:ebaa167 \
>     --kernel-args 'page_poison=1 slab_nomerge pti=on random.trust_cpu=on console=tty0 console=ttyS0 printk.devkmsg=on talos.platform=bare-metal talos.userdata=none' \
>     --cpus 2 \
>     --memory 1GB \
>     --interactive \
>     --name master-1
INFO[0001] Created VM with ID "d21fed088851a5c0" and name "master-1"
INFO[0002] Started Firecracker VM "d21fed088851a5c0" in a container with ID "a450defcf16e891223472a58ec895a4411fe611748422632203ec27d1bc48ccd"
d21fed088851a5c0
root@dkr1:~# ignite logs master-1
INFO[0000] Moving IP address 172.17.0.4 (255.255.0.0) from container to VM
INFO[0000] Starting DHCP server for interface br_eth0 (172.17.0.4)
INFO[0000] Called startVMM(), setting up a VMM on /var/lib/firecracker/vm/d21fed088851a5c0/firecracker.sock
INFO[0000] refreshMachineConfiguration: [GET /machine-config][200] getMachineConfigurationOK  &{CPUTemplate:Uninitialized HtEnabled:0xc0005975fc MemSizeMib:0xc0005975f0 VcpuCount:0xc0005975e8}
INFO[0000] PutGuestBootSource: [PUT /boot-source][204] putGuestBootSourceNoContent
INFO[0000] Attaching drive /dev/mapper/ignite-d21fed088851a5c0, slot 1, root true.
INFO[0000] Attached drive /dev/mapper/ignite-d21fed088851a5c0: [PUT /drives/{drive_id}][204] putGuestDriveByIdNoContent
INFO[0000] Attaching NIC vm_eth0 (hwaddr 72:b4:f8:e9:0b:34) at index 1
INFO[0000] PutGuestNetworkInterfaceByID: [PUT /network-interfaces/{iface_id}][204] putGuestNetworkInterfaceByIdNoContent
INFO[0000] startInstance successful: [PUT /actions][204] createSyncActionNoContent
root@dkr1:~#
luxas commented 5 years ago

It is serial console output. The normal kernel args include console=ttyS0. Does that help?

luxas commented 5 years ago

Try launching weaveworks/ignite-ubuntu and you'll see it in action.

andrewrynhard commented 5 years ago

Hmm. Still seeing only:

root@dkr1:~# ignite ps
VM ID           IMAGE               KERNEL                  CREATED SIZE    CPUS    MEMORY      STATE   IPS     PORTS   NAME
e5431979acbddbca    weaveworks/ignite-ubuntu:latest weaveworks/ignite-kernel:4.19.47    20s ago 4.0 GB  2   1024.0 MB   Running 172.17.0.4      my-vm
root@dkr1:~# ignite logs my-vm
INFO[0000] Moving IP address 172.17.0.4 (255.255.0.0) from container to VM
INFO[0000] Starting DHCP server for interface br_eth0 (172.17.0.4)
INFO[0000] Called startVMM(), setting up a VMM on /var/lib/firecracker/vm/e5431979acbddbca/firecracker.sock
INFO[0000] refreshMachineConfiguration: [GET /machine-config][200] getMachineConfigurationOK  &{CPUTemplate:Uninitialized HtEnabled:0xc00003609c MemSizeMib:0xc000036090 VcpuCount:0xc000036088}
INFO[0000] PutGuestBootSource: [PUT /boot-source][204] putGuestBootSourceNoContent
INFO[0000] Attaching drive /dev/mapper/ignite-e5431979acbddbca, slot 1, root true.
INFO[0000] Attached drive /dev/mapper/ignite-e5431979acbddbca: [PUT /drives/{drive_id}][204] putGuestDriveByIdNoContent
INFO[0000] Attaching NIC vm_eth0 (hwaddr ee:d2:9a:1e:3d:b9) at index 1
INFO[0000] PutGuestNetworkInterfaceByID: [PUT /network-interfaces/{iface_id}][204] putGuestNetworkInterfaceByIdNoContent
INFO[0000] startInstance successful: [PUT /actions][204] createSyncActionNoContent
root@dkr1:~#
luxas commented 5 years ago

hmm very strange. You did a normal ignite run? Does the machine have KVM enabled, etc.? Can you do an ignite inspect vm my-vm for me?

andrewrynhard commented 5 years ago

🤦‍♂ Just realized I reinstalled linux to this machine recently. KVM is not installed. Let me try again.

luxas commented 5 years ago

Such things happen. This issue inspired me to create #184. Maybe you want to help us create preflight checks so other can avoid the same mistake :wink:?

andrewrynhard commented 5 years ago

Preflight checks would be great. Still running into the same issue. I will dig some more.

andrewrynhard commented 5 years ago

Inspect output:

root@dkr1:~# ignite inspect vm my-vm
{
  "kind": "VM",
  "apiVersion": "ignite.weave.works/v1alpha1",
  "metadata": {
    "name": "my-vm",
    "uid": "595384225d681b54",
    "created": "2019-07-15T21:32:02Z"
  },
  "spec": {
    "image": {
      "ociClaim": {
        "type": "Docker",
        "ref": "weaveworks/ignite-ubuntu:latest"
      }
    },
    "kernel": {
      "ociClaim": {
        "type": "Docker",
        "ref": "weaveworks/ignite-kernel:4.19.47"
      },
      "cmdLine": "console=ttyS0"
    },
    "cpus": 2,
    "memory": "1GB",
    "diskSize": "4GB",
    "network": {
      "mode": "docker-bridge"
    },
    "ssh": true
  },
  "status": {
    "state": "Running",
    "ipAddresses": [
      "172.17.0.2"
    ],
    "image": {
      "id": "sha256:f8032a6738fdb372eb7e64734c9481f873b57e0ea72b610e0189f0a329283173",
      "size": "231256502B",
      "repoDigests": [
        "weaveworks/ignite-ubuntu@sha256:ad984fa5f6f2db55a0a48860d263a02a0f77aee3bbefa0d71648b4bc287ac13c"
      ]
    },
    "kernel": {
      "id": "sha256:5e5165af3e5dda9371abce633189eed1f80f9c493635e37264c6783fd5e0f6c9",
      "size": "51377512B",
      "repoDigests": [
        "weaveworks/ignite-kernel@sha256:18ee1005bb3881faf09059038eca8b298d9d7598cde675c4a900e275fe0a2454"
      ]
    }
  }
}

logs:

root@dkr1:~# ignite logs my-vm
INFO[0000] Moving IP address 172.17.0.2 (255.255.0.0) from container to VM
INFO[0000] Starting DHCP server for interface br_eth0 (172.17.0.2)
INFO[0000] Called startVMM(), setting up a VMM on /var/lib/firecracker/vm/595384225d681b54/firecracker.sock
INFO[0000] refreshMachineConfiguration: [GET /machine-config][200] getMachineConfigurationOK  &{CPUTemplate:Uninitialized HtEnabled:0xc000129b7c MemSizeMib:0xc000129b70 VcpuCount:0xc000129b68}
INFO[0000] PutGuestBootSource: [PUT /boot-source][204] putGuestBootSourceNoContent
INFO[0000] Attaching drive /dev/mapper/ignite-595384225d681b54, slot 1, root true.
INFO[0000] Attached drive /dev/mapper/ignite-595384225d681b54: [PUT /drives/{drive_id}][204] putGuestDriveByIdNoContent
INFO[0000] Attaching NIC vm_eth0 (hwaddr 42:1d:98:d4:ca:8d) at index 1
INFO[0000] PutGuestNetworkInterfaceByID: [PUT /network-interfaces/{iface_id}][204] putGuestNetworkInterfaceByIdNoContent
INFO[0000] startInstance successful: [PUT /actions][204] createSyncActionNoContent
root@dkr1:~#

Just realized that AMD CPU support is alpha. I am running AMD FWIW.

luxas commented 5 years ago

"cmdLine": "console=ttyS0" looks very odd. Many more options are expected in order for FC to boot the machine correctly I think. Why not use the default console=ttyS0 reboot=k panic=1 pci=off ip=dhcp kernel args? (omit the --kernel-args flag)

andrewrynhard commented 5 years ago

I have tried both. That was the one I just happened to paste here.

root@dkr1:~# ignite inspect vm my-vm
{
  "kind": "VM",
  "apiVersion": "ignite.weave.works/v1alpha1",
  "metadata": {
    "name": "my-vm",
    "uid": "f4a1f951c5d79389",
    "created": "2019-07-16T13:16:44Z"
  },
  "spec": {
    "image": {
      "ociClaim": {
        "type": "Docker",
        "ref": "weaveworks/ignite-ubuntu:latest"
      }
    },
    "kernel": {
      "ociClaim": {
        "type": "Docker",
        "ref": "weaveworks/ignite-kernel:4.19.47"
      },
      "cmdLine": "console=ttyS0 reboot=k panic=1 pci=off ip=dhcp"
    },
    "cpus": 2,
    "memory": "1GB",
    "diskSize": "4GB",
    "network": {
      "mode": "docker-bridge"
    },
    "ssh": true
  },
  "status": {
    "state": "Running",
    "ipAddresses": [
      "172.17.0.2"
    ],
    "image": {
      "id": "sha256:f8032a6738fdb372eb7e64734c9481f873b57e0ea72b610e0189f0a329283173",
      "size": "231256502B",
      "repoDigests": [
        "weaveworks/ignite-ubuntu@sha256:ad984fa5f6f2db55a0a48860d263a02a0f77aee3bbefa0d71648b4bc287ac13c"
      ]
    },
    "kernel": {
      "id": "sha256:5e5165af3e5dda9371abce633189eed1f80f9c493635e37264c6783fd5e0f6c9",
      "size": "51377512B",
      "repoDigests": [
        "weaveworks/ignite-kernel@sha256:18ee1005bb3881faf09059038eca8b298d9d7598cde675c4a900e275fe0a2454"
      ]
    }
  }
}
luxas commented 5 years ago

Report an issue in the Firecracker repo maybe? It could be an AMD-related issue...