{"id":15694133,"url":"https://github.com/rgl/linuxkit-vagrant","last_synced_at":"2025-09-09T04:51:36.605Z","repository":{"id":139753086,"uuid":"91249094","full_name":"rgl/linuxkit-vagrant","owner":"rgl","description":"Vagrant environment for playing with LinuxKit","archived":false,"fork":false,"pushed_at":"2021-09-18T18:34:23.000Z","size":73,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T07:41:38.203Z","etag":null,"topics":["linuxkit","loki","pxe","qemu","uefi","uefi-boot","vagrant"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-14T14:32:19.000Z","updated_at":"2023-11-09T01:59:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"a12e0414-1724-4892-850b-17eb1a30792b","html_url":"https://github.com/rgl/linuxkit-vagrant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Flinuxkit-vagrant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Flinuxkit-vagrant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Flinuxkit-vagrant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Flinuxkit-vagrant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/linuxkit-vagrant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243098843,"owners_count":20236107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linuxkit","loki","pxe","qemu","uefi","uefi-boot","vagrant"],"created_at":"2024-10-03T18:53:00.472Z","updated_at":"2025-03-11T19:31:37.904Z","avatar_url":"https://github.com/rgl.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a [Vagrant](https://www.vagrantup.com/) Environment for a playing with [LinuxKit](https://github.com/linuxkit/linuxkit).\n\n# Table Of Contents\n\n* [Usage](#usage)\n* [Logs](#logs)\n  * [Log Labels](#log-labels)\n* [Network Packet Capture](#network-packet-capture)\n* [Network Booting](#network-booting)\n  * [Tested Physical Machines](#tested-physical-machines)\n* [References](#references)\n\n# Usage\n\nBuild and install the [Ubuntu Base Box](https://github.com/rgl/ubuntu-vagrant).\n\nRun `vagrant up builder --no-destroy-on-error --no-tty` to launch the environment that builds the `shared/linuxkit-example.iso` and `shared/linuxkit-example-uefi.iso` files.\n\nRun `vagrant up bios-iso --no-destroy-on-error --no-tty` to launch `shared/linuxkit-example.iso`.\n\nRun `vagrant up uefi-iso --no-destroy-on-error --no-tty` to launch `shared/linuxkit-example-uefi.iso`.\n\nThen access a linuxkit instance with, e.g.:\n\n```bash\nvagrant ssh builder\nsudo ssh bios-iso # or uefi-iso\nexit\n```\n\nYou can also launch the iso with one of:\n\n```bash\n(cd shared \u0026\u0026 ./linuxkit run qemu -gui -iso linuxkit-example.iso)\n(cd shared \u0026\u0026 ./linuxkit run vbox -gui -iso linuxkit-example.iso)\n```\n\nYou can also directly launch the kernel and initrd in qemu:\n\n```bash\n(cd shared \u0026\u0026 ./linuxkit run qemu -gui -kernel linuxkit-example)\n(cd shared \u0026\u0026 cp /usr/share/ovmf/OVMF.fd . \u0026\u0026 ./linuxkit run qemu -gui -uefi -fw ./OVMF.fd -kernel linuxkit-example)\n```\n\nYou can list the contents of the initramfs with:\n\n```bash\nzcat shared/linuxkit-example-initrd.img | cpio --list --numeric-uid-gid --verbose | less\n```\n\nYou can execute docker containers with:\n\n```bash\n# enter the builder machine.\nvagrant ssh builder\n\n# switch to root.\nsudo -i\n\n# enter the bios-iso machine.\nssh bios-iso\n\n# verify the dockerd configuration.\ncat /hostroot/etc/docker/daemon.json\n\n# open a shell in the docker service.\nctr tasks exec --exec-id shell -t docker ash\n\n# execute a docker container.\ndocker run \\\n  -d \\\n  --restart unless-stopped \\\n  --name hello-docker \\\n  --label worker_id=123 \\\n  alpine:3.14 \\\n    /bin/sh \\\n    -c \\\n    'while true; do echo hello docker $(date); sleep 1; done'\n\n# tail the logs.\n# NB at the builder machine, you can tail then with:\n#     logcli query --tail '{source=\"hello-docker\"}'\ndocker logs -f hello-docker\n\n# interact with containerd.\nexport CONTAINERD_ADDRESS=/var/run/docker/containerd/containerd.sock\nexport CONTAINERD_NAMESPACE=moby\nctr namespaces list\nctr containers list\nctr --namespace plugins.moby containers list\n```\n\n## Logs\n\nYou can read individual logs at `/var/log` as separate files. These log files are managed by the `logwrite` service.\n\nYou can dump (and then follow) all the logs with `logread -F`. This reads the logs from the `memlogd` managed named socket at `/var/run/memlogdq.sock`.\n\nThe logs are also sent to the `builder` machine.\n\nYou can explore them with Grafana at:\n\nhttp://10.1.0.2:3000/explore\n\nYou can also explore them with `logcli`:\n\n```bash\nvagrant ssh builder\n\n# list all series/streams.\nlogcli series '{}' | sort\n\n# list all labels.\nlogcli labels -q | sort\n\n# list all sources.\nlogcli labels -q source | sort\n\n# get all the containerd logs.\n# NB you might want to add --forward --limit 1000 to see the logs from\n#    oldest to newer.\nlogcli query '{source=\"containerd\"}'\n\n# tail all the containerd logs.\nlogcli query --tail '{source=\"containerd\"}'\n\n# raw tail all the containerd logs.\nlogcli query --tail --output raw '{source=\"containerd\"}'\n\n# tail all sources.\nlogcli query --tail --limit 1000 '{source=~\".+\"}'\n\n# tail all sources looking for errors.\nlogcli query --tail --limit 1000 '{source=~\".+\"} |~ \"error\"'\n```\n\n### Log Labels\n\nAvailable log labels:\n\n| Label    | Description                                 |\n|----------|---------------------------------------------|\n| `host`   | hostname of the host that captured the log  |\n| `job`    | name of the collector that captured the log |\n| `source` | name of the source that produced the log    |\n\nAvailable job label instances:\n\n| Job          | Description                                 |\n|--------------|---------------------------------------------|\n| `containerd` | logs read from containerd log files         |\n| `container`  | logs read from each docker container        |\n| `logwrite`   | logs read from logwrite generated log files |\n\nAvailable source label instances:\n\n| Source         | Description                     |\n|----------------|---------------------------------|\n| `containerd`   | `containerd` service            |\n| `dhcpcd`       | `dhcpcd` service                |\n| `docker`       | `docker` service                |\n| `hello`        | `hello` service                 |\n| `hello-docker` | `hello-docker` docker container |\n| `kmsg`         | linux kernel                    |\n| `memlogd`      | `memlogd` service               |\n| `promtail`     | `promtail` service              |\n| `rngd`         | `rngd` service                  |\n| `rngd1`        | `rngd` onboot service           |\n| `sshd`         | `sshd` service                  |\n\n## Network Packet Capture\n\nYou can easily capture and see traffic from the host with the `wireshark.sh`\nscript, e.g., to capture the traffic from the `eth1` interface:\n\n```bash\n./wireshark.sh builder eth1\n```\n\n## Network Booting\n\nThis environment can also PXE/iPXE/UEFI-HTTP boot LinuxKit.\n\nTo PXE boot a BIOS Virtual Machine with PXE/TFTP/iPXE/HTTP run:\n\n```bash\nvagrant up bios-pxe --no-destroy-on-error --no-tty\n```\n\nTo PXE boot a UEFI Virtual Machine with PXE/TFTP/iPXE/HTTP run:\n\n```bash\nvagrant up uefi-pxe --no-destroy-on-error --no-tty\n```\n\nTo boot Physical Machines you have to:\n\n* Create a Linux Bridge that can reach a Physical Switch that connects to\n  your Physical Machines.\n  * This environment assumes you have a setup like [rgl/ansible-collection-tp-link-easy-smart-switch](https://github.com/rgl/ansible-collection-tp-link-easy-smart-switch).\n  * To configure it otherwise you must modify the `Vagrantfile`.\n* Add your machines to `machines.json`.\n* Configure your machines to PXE boot.\n\n### Tested Physical Machines\n\nThis was tested on the following physical machines and boot modes:\n\n* [Seeed Studio Odyssey X86J4105](https://github.com/rgl/seeedstudio-odyssey-x86j4105-notes)\n  * It boots using [UEFI/HTTP/PXE](https://github.com/rgl/seeedstudio-odyssey-x86j4105-notes/tree/master/network-boot#uefi-http-pxe).\n* [HP EliteDesk 800 35W G2 Desktop Mini](https://support.hp.com/us-en/product/hp-elitedesk-800-35w-g2-desktop-mini-pc/7633266)\n  * It boots using UEFI/TFTP/PXE.\n  * This machine can be remotely managed with [MeshCommander](https://www.meshcommander.com/meshcommander).\n    * It was configured as described at [rgl/intel-amt-notes](https://github.com/rgl/intel-amt-notes).\n\n# References\n\n* LinuxKit\n  * [Configuration Reference](https://github.com/linuxkit/linuxkit/blob/master/docs/yaml.md)\n  * [Logging (memlogd/init/logwrite)](https://github.com/linuxkit/linuxkit/blob/master/docs/logging.md)\n* Linux\n  * [Kernel Parameters Index](https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.rst)\n  * [Kernel Parameters List](https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt)\n  * [Booloader Parameters List (AMD64)](https://www.kernel.org/doc/Documentation/x86/x86_64/boot-options.txt)\n* Promtail\n  * [Configuring Promtail](https://grafana.com/docs/loki/latest/clients/promtail/configuration/)\n  * [Pipelines](https://grafana.com/docs/loki/latest/clients/promtail/pipelines/)\n    * [Pipeline Stages](https://grafana.com/docs/loki/latest/clients/promtail/stages/)\n  * [Troubleshooting Promtail](https://grafana.com/docs/loki/latest/clients/promtail/troubleshooting/)\n* Loki Docker Driver\n  * [Configuring the Docker Driver](https://grafana.com/docs/loki/latest/clients/docker-driver/configuration/)\n* Loki:\n  * [LogQL: Log Query Language](https://grafana.com/docs/loki/latest/logql/)\n* iPXE:\n  * [Scripting](https://ipxe.org/scripting)\n  * [Command reference](https://ipxe.org/cmd)\n  * [Settings reference](https://ipxe.org/cfg)\n* Matchbox:\n  * [PXE-enabled DHCP](https://github.com/poseidon/matchbox/blob/master/docs/network-setup.md#pxe-enabled-dhcp)\n  * [Proxy-DHCP](https://github.com/poseidon/matchbox/blob/master/docs/network-setup.md#proxy-dhcp)\n* Dynamic Host Configuration Protocol (DHCP):\n  * [Parameters / Options](https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml)\n* [Building the Simplest Possible Linux System by Rob Landley](https://www.youtube.com/watch?v=Sk9TatW9ino)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Flinuxkit-vagrant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Flinuxkit-vagrant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Flinuxkit-vagrant/lists"}