Lima: Linux virtual machines (on macOS, in most cases)

[ 📖 Getting started] [ FAQs & Troubleshooting]

Lima: Linux virtual machines (on macOS, in most cases)

Lima launches Linux virtual machines with automatic file sharing, port forwarding, and containerd.

Lima can be considered as a some sort of unofficial "macOS subsystem for Linux", or "containerd for Mac".

Lima is expected to be used on macOS hosts, but can be used on Linux hosts as well.

Automatic file sharing

Automatic port forwarding

Built-in support for containerd (Other container engines can be used too)

Intel on Intel

ARM on Intel

ARM on ARM

Intel on ARM

Various guest Linux distributions: Alpine, Arch Linux, CentOS, Debian, Fedora, openSUSE, Ubuntu (default), ...

Related project: sshocker (ssh with file sharing and port forwarding)

This project is unrelated to The Lima driver project (driver for ARM Mali GPUs).

Motivation

The goal of Lima is to promote containerd including nerdctl (contaiNERD ctl) to Mac users, but Lima can be used for non-container applications as well.

Adopters

Container environments:

  • Rancher Desktop: Kubernetes and container management to the desktop
  • Colima: Docker (and Kubernetes) on macOS with minimal setup

GUI:

Examples

uname

$ uname -a
Darwin macbook.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64

$ lima uname -a
Linux lima-default 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:12:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ LIMA_INSTANCE=arm lima uname -a
Linux lima-arm 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:10:16 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

Sharing files across macOS and Linux

some-file $ lima cat some-file files under /Users on macOS filesystem are readable from Linux $ lima sh -c 'echo "/tmp/lima is writable from both macOS and Linux" > /tmp/lima/another-file' $ cat /tmp/lima/another-file /tmp/lima is writable from both macOS and Linux ">
$ echo "files under /Users on macOS filesystem are readable from Linux" > some-file

$ lima cat some-file
files under /Users on macOS filesystem are readable from Linux

$ lima sh -c 'echo "/tmp/lima is writable from both macOS and Linux" > /tmp/lima/another-file'

$ cat /tmp/lima/another-file
/tmp/lima is writable from both macOS and Linux

Running containerd containers (compatible with Docker containers)

$ lima nerdctl run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine

http://127.0.0.1:8080 is accessible from both macOS and Linux.

For the usage of containerd and nerdctl (contaiNERD ctl), visit https://github.com/containerd/containerd and https://github.com/containerd/nerdctl.

Getting started

Installation

Homebrew package is available.

$ brew install lima
Manual installation steps

Install QEMU

Install recent version of QEMU. v6.1.0 or later is recommended.

On ARM Mac hosts, a patched version of QEMU has to be installed for enabling -accel hvf support.

The patch was merged into the master branch on 2021-09-21 and will be included in QEMU v6.2.0.

The patch is already cherry-picked in the Homebrew package of QEMU since 6.1.0_1 bottle.

Install Lima

brew install jq
VERSION=$(curl -fsSL https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name)
curl -fsSL https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz | tar Cxzvm /usr/local
  • To install Lima from the source, run make && make install.

NOTE Lima is not regularly tested on ARM Mac (due to lack of CI).

Usage

[macOS]$ limactl start
...
INFO[0029] READY. Run `lima` to open the shell.

[macOS]$ lima uname
Linux

Detailed usage:

  • Run limactl start to start the Linux instance. The default instance name is "default". Lima automatically opens an editor (vi) for reviewing and modifying the configuration. Wait until "READY" to be printed on the host terminal.

  • Run limactl shell to launch on Linux. For the "default" instance, this command can be shortened as lima . The lima command also accepts the instance name as the environment variable $LIMA_INSTANCE.

  • Run limactl copy ... to copy files between instances, or between instances and the host. Use : to specify a source or target inside an instance.

  • Run limactl list [--json] to show the instances.

  • Run limactl stop [--force] to stop the instance.

  • Run limactl delete [--force] to delete the instance.

  • To enable bash completion, add source <(limactl completion bash) to ~/.bash_profile.

  • To enable zsh completion, see limactl completion zsh --help

⚠️ CAUTION: make sure to back up your data

Lima may have bugs that result in loss of data.

Make sure to back up your data before running Lima.

Especially, the following data might be easily lost:

  • Data in the shared writable directories (/tmp/lima by default), probably after hibernation of the host machine (e.g., after closing and reopening the laptop lid)
  • Data in the VM image, mostly when upgrading the version of lima

Configuration

See ./pkg/limayaml/default.yaml.

The current default spec:

  • OS: Ubuntu 21.10 (Impish Indri)
  • CPU: 4 cores
  • Memory: 4 GiB
  • Disk: 100 GiB
  • Mounts: ~ (read-only), /tmp/lima (writable)
  • SSH: 127.0.0.1:60022

How it works

  • Hypervisor: QEMU with HVF accelerator
  • Filesystem sharing: reverse sshfs (likely to be replaced with 9p or Samba in future)
  • Port forwarding: ssh -L, automated by watching /proc/net/tcp and iptables events in the guest

Developer guide

Contributing to Lima

Help wanted

🙏

FAQs & Troubleshooting

Generic

Generic

"What's my login password?"

Password is disabled and locked by default. You have to use limactl shell bash (or lima bash) to open a shell.

Alternatively, you may also directly ssh into the guest: ssh -p 60022 -i ~/.lima/_config/user -o NoHostAuthenticationForLocalhost=yes 127.0.0.1.

"Does Lima work on ARM Mac?"

Yes, it should work, but not regularly tested on ARM (due to lack of CI).

"Can I run non-Ubuntu guests?"

Alpine, Arch Linux, CentOS, Debian, Fedora, and openSUSE are also known to work. See ./examples/.

An image has to satisfy the following requirements:

  • systemd or OpenRC
  • cloud-init
  • The following binaries to be preinstalled:
    • sudo
  • The following binaries to be preinstalled, or installable via the package manager:
    • sshfs
    • newuidmap and newgidmap
  • apt-get, dnf, apk, pacman, or zypper (if you want to contribute support for another package manager, run git grep apt-get to find out where to modify)

"Can I run other container engines such as Docker and Podman? What about Kubernetes?"

Yes, any container engine should work with Lima.

Container runtime examples:

Container orchestrator examples:

The default Ubuntu image also contains LXD. Runlima sudo lxc init to set up LXD.

See also third party containerd projects based on Lima:

  • Rancher Desktop: Kubernetes and container management to the desktop
  • Colima: Docker (and Kubernetes) on macOS with minimal setup

"Can I run Lima with a remote Linux machine?"

Lima itself does not support connecting to a remote Linux machine, but sshocker, the predecessor or Lima, provides similar features for remote Linux machines.

e.g., run sshocker -v /Users/foo:/home/foo/mnt -p 8080:80 @ to expose /Users/foo to the remote machine as /home/foo/mnt, and forward localhost:8080 to the port 80 of the remote machine.

"Advantages compared to Docker for Mac?"

Lima is free software (Apache License 2.0), while Docker for Mac is not. Their EULA even prohibits disclosure of benchmarking result.

On the other hand, Moby, aka Docker for Linux, is free software, but Moby/Docker lacks several novel features of containerd, such as:

QEMU

"QEMU crashes with HV_ERROR"

If you have installed QEMU v6.0.0 or later on macOS 11 via homebrew, your QEMU binary should have been already automatically signed to enable HVF acceleration.

However, if you see HV_ERROR, you might need to sign the binary manually.

com.apple.security.hypervisor EOF codesign -s - --entitlements entitlements.xml --force /usr/local/bin/qemu-system-x86_64 ">
cat >entitlements.xml <<EOF



   

   
    
   
    com.apple.security.hypervisor
   
    
   


EOF

codesign -s - --entitlements entitlements.xml --force /usr/local/bin/qemu-system-x86_64

Note: Only on macOS versions before 10.15.7 you might need to add this entitlement in addition:

    
   
    com.apple.vm.hypervisor
   
    
   

"QEMU is slow"

  • Make sure that HVF is enabled with com.apple.security.hypervisor entitlement. See "QEMU crashes with HV_ERROR".
  • Emulating non-native machines (ARM-on-Intel, Intel-on-ARM) is slow by design.

error "killed -9"

  • make sure qemu is codesigned, See "QEMU crashes with HV_ERROR".
  • if you are on macOS 10.15.7 or 11.0 or later make sure the entitlement com.apple.vm.hypervisor is not added. It only works on older macOS versions. You can clear the codesigning with codesign --remove-signature /usr/local/bin/qemu-system-x86_64 and start over.

"QEMU crashes with vmx_write_mem: mmu_gva_to_gpa XXXXXXXXXXXXXXXX failed"

This error is known to happen when running an image of RHEL8-compatible distribution such as CentOS 8 on Intel Mac. A workaround is to set environment variable QEMU_SYSTEM_X86_64="qemu-system-x86_64 -cpu Haswell-v4".

https://bugs.launchpad.net/qemu/+bug/1838390

SSH

"Port forwarding does not work"

Prior to Lima v0.7.0, Lima did not support forwarding privileged ports (1-1023). e.g., you had to use 8080, not 80.

Lima v0.7.0 and later supports forwarding privileged ports on macOS hosts.

On Linux hosts, you might have to set sysctl value net.ipv4.ip_unprivileged_port_start=0.

stuck on "Waiting for the essential requirement 1 of X: "ssh"

libslirp v4.6.0 used by QEMU is known to be broken. If you have libslirp v4.6.0 in /usr/local/Cellar/libslirp, you have to upgrade it to v4.6.1 or later (brew upgrade).

"permission denied" for limactl cp command

The copy command only works for instances that have been created by lima 0.5.0 or later. You can manually install the required identity on older instances with (replace INSTANCE with actual instance name):

< ~/.lima/_config/user.pub limactl shell INSTANCE sh -c 'tee -a ~/.ssh/authorized_keys'

Networking

"Cannot access the guest IP 192.168.5.15 from the host"

The default guest IP 192.168.5.15 is not accessible from the host and other guests.

To add another IP address that is accessible from the host and other virtual machines, enable vde_vmnet.

See ./docs/network.md.

"Hints for debugging other problems?"

  • Inspect logs:
    • limactl --debug start
    • $HOME/.lima/ /serial.log
    • /var/log/cloud-init-output.log (inside the guest)
    • /var/log/cloud-init.log (inside the guest)
  • Make sure that you aren't mixing up tabs and spaces in the YAML.
Owner
Linux Machines
Linux virtual machines, on macOS
Linux Machines
Comments
  • Add virtfs/9p mounts, instead of sshocker/sshfs

    Add virtfs/9p mounts, instead of sshocker/sshfs

    This PR allows selecting mount type, as "9p"

    The default mount type is still as it was before.

    ~~Add mount option variable, for "rw" vs "ro"~~

    Add mount type, for "reverse-sshfs" vs "9p"

    Issue #20

    ~~QEMU with 9p-darwin patches available here:~~ ~~https://github.com/afbjorklund/homebrew-core/blob/qemu-9p-darwin/Formula/qemu.rb~~ ~~Patches from: https://github.com/willcohen/qemu/commits/v6.2.0-9p-darwin (or use HEAD)~~ ~~You can also use the latest/greatest QEMU HEAD.~~

    EDIT: The qemu in brew now supports virtfs, also for darwin systems.


    Example mount when booting with "sshfs":

    :/tmp/lima on /tmp/lima type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,allow_other)

    Example mount when booting with "9p":

    mount1 on /tmp/lima type 9p (rw,sync,dirsync,relatime,access=client,msize=131072,trans=virtio)

  • Allow RHEL-like distros below version 8

    Allow RHEL-like distros below version 8

    This MR allows you create VMs using CentOS 7

    My centos7.yaml file:

    images:
    - location: "https://cloud.centos.org/altarch/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2"
      arch: "x86_64"
      digest: "sha256:e38bab0475cc6d004d2e17015969c659e5a308111851b0e2715e84646035bdd3"
    - location: "https://cloud.centos.org/altarch/7/images/CentOS-7-aarch64-GenericCloud-2009.qcow2"
      arch: "aarch64"
      digest: "sha256:51c0222aa4bc7d966fc044eb6ce9182993a1dc398eaa595e58abd0d361439baf"
    containerd:
      system: false
      user: false
    mounts:
    - location: "~"
    - location: "/tmp/lima"
      writable: true
    firmware:
      legacyBIOS: true
    cpuType:
      # Workaround for "vmx_write_mem: mmu_gva_to_gpa XXXXXXXXXXXXXXXX failed" on Intel Mac
      # https://bugs.launchpad.net/qemu/+bug/1838390
      x86_64: "Haswell-v4
    
  • [Ubuntu on M1] Lima VM will not start (`EFI stub: ERROR: FIRMWARE BUG: kernel image not aligned on 64k boundary`)

    [Ubuntu on M1] Lima VM will not start (`EFI stub: ERROR: FIRMWARE BUG: kernel image not aligned on 64k boundary`)

    EDIT by @AkihiroSuda

    Update (Mar 14, 2022)

    :warning: Running recent Linux guests on M1 macOS needs Homebrew's QEMU 6.2.0_1 or later.

    Run brew upgrade to upgrade QEMU.

    Intel macOS users are NOT affected by this issue.

    For the further information, see https://github.com/lima-vm/lima/pull/734 and https://github.com/Homebrew/homebrew-core/pull/96743 .

    Old information

    Ubuntu kernel 5.13.0-35.40 (5.4.0-103.117 for 20.04 LTS) released in March 2022 is not bootable on ARM hosts:

    (~/.lima/default/serial.log)
    ...
    EFI stub: Booting Linux Kernel...
    EFI stub: ERROR: FIRMWARE BUG: kernel image not aligned on 64k boundary
    EFI stub: Using DTB from configuration table
    EFI stub: Exiting boot services and installing virtual address map...
    SetUefiImageMemoryAttributes - 0x000000013F500000 - 0x0000000000040000 (0x0000000000000008)
    SetUefiImageMemoryAttributes - 0x000000013C190000 - 0x0000000000040000 (0x0000000000000008)
    SetUefiImageMemoryAttributes - 0x000000013C140000 - 0x0000000000040000 (0x0000000000000008)
    SetUefiImageMemoryAttributes - 0x000000013F4C0000 - 0x0000000000030000 (0x0000000000000008)
    SetUefiImageMemoryAttributes - 0x000000013C0F0000 - 0x0000000000040000 (0x0000000000000008)
    SetUefiImageMemoryAttributes - 0x000000013BCB0000 - 0x0000000000040000 (0x0000000000000008)
    SetUefiImageMemoryAttributes - 0x000000013BB00000 - 0x0000000000030000 (0x0000000000000008)
    SetUefiImageMemoryAttributes - 0x000000013BAC0000 - 0x0000000000030000 (0x0000000000000008)
    (hangs here)
    

    Until the issue gets resolved, it is HIGHLY RECOMMENDED to run the following command inside the Ubuntu shell to avoid upgrading the kernel:

    sudo apt-mark hold linux-image-$(uname -r)
    

    (Make sure to unhold it when we get the fix)

    If your kernel was already upgraded and the VM does not boot, try running Lima with the following environment variable to show the video display:

    export QEMU_SYSTEM_AARCH64="qemu-system-aarch64 -display cocoa"
    

    After the display is shown, press the Esc key several times to show the GRUB prompt for choosing an older kernel. You can also mount the disk image from another instance to modify the GRUB config or rescue the data inside the image. https://github.com/lima-vm/lima/issues/712#issuecomment-1065266828

    See also https://gitlab.com/qemu-project/qemu/-/issues/899

    :pray: Help wanted for testing

    This QEMU patch may fix the issue: https://github.com/AkihiroSuda/homebrew-core/commit/177d583c741f4f50a12f326f632c54dbf169d37b (from https://gitlab.com/qemu-project/qemu/-/issues/899)

    Download qemu.rb and run brew install --build-from-source ./qemu.rb to apply the patch.

    Below is the original post by @mateka


    Description

    Today I was working in lima VM (Ubuntu 20.04; Mac M1). After a while, it has lost connection (as it often does), so I had tried to restart it. Old VM and even brand new will not start and return an error after:

    Waiting for the essential requirement 1 of 5: "ssh"

    limactl --debug start VM-name prints:

    DEBU[0171] [hostagent] executing ssh for script "ssh": /usr/bin/ssh [ssh -F /dev/null -o IdentityFile="/Users/matek/.lima/_config/user" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o Ciphers="^[email protected],[email protected]" -o User=matek -o ControlMaster=auto -o ControlPath="/Users/matek/.lima/test/ssh.sock" -o ControlPersist=5m -p 52070 127.0.0.1 -- /bin/bash] DEBU[0246] [hostagent] stdout="", stderr="kex_exchange_identification: read: Connection reset by peer\r\nConnection reset by 127.0.0.1 port 52070\r\n", err=failed to execute script "ssh": stdout="", stderr="kex_exchange_identification: read: Connection reset by peer\r\nConnection reset by 127.0.0.1 port 52070\r\n": exit status 255

    Rancher Desktop seems to work.

  • Set instance name while starting

    Set instance name while starting

    Running limactl start foo.yml automatically sets the instance name to foo. It would be nice to be able to set a name different than the file name. Ex. running limactl start foo.yml --name bar would create an instance named bar.

  • Support for Virtualization.Framework for macOS 13

    Support for Virtualization.Framework for macOS 13

    This PR provides support for using Virtualization.Framework as a optional driver.

    The following are the changes done related to using drivers,

    • [x] Driver interface
    • [x] Migrate current QEMU implementation to driver
    • [x] New driver vz for Virtualization.Framework

    The following are the features of lima, the vz driver should provide support for below,

    • [x] Running VM (Using both disk img and iso)*
    • [x] Slirp network for guest to host communication (uses gvisor-tap-vsock)
    • [x] Host to guest network (uses vz NAT gateway)*
    • [x] Directory sharing, supports reverse-sshfs and virtiofs (newly added)
    • [x] Port forwarding
    • [x] Host DNS resolver
    • [ ] Display (Deferring it for now as it requires runtime.LockOsThread() to be called in the beginning of hostagent start cmd)

    Notes

    • Vz driver internally converts qcow to raw image using (qemu-img convert). This is because vz only supports raw disk
    • Need to provide yaml configuration for NAT

    Know Issues

    • Serial log doesn't contain system boot logs
    • Gvisor-tap-vsock will throw some errors like [e.connection](tcpproxy:) during start-up (This is because of port 22 Forwards being tried before VM is ready) [Not a failure/blocker just info message thrown, but we can look into fixing in a follow-up to call ssh forward manually]
    • When vz vm stops, it doesn't trigger hostagent stop [Fixed]

    Testing Tested the following templates with driver: vz. All test are done on macOS 13 intel as of now.

    • [x] almalinux.yaml
    • [x] alpine.yaml
    • [x] apptainer.yaml
    • [ ] archlinux.yaml
    • [x] buildkit.yaml
    • [ ] centos-stream.yaml
    • [x] debian.yaml
    • [x] docker.yaml
    • [x] faasd.yaml
    • [x] fedora.yaml
    • [x] k3s.yaml
    • [x] k8s.yaml
    • [x] nomad.yaml
    • [ ] opensuse.yaml
    • [ ] oraclelinux.yaml
    • [x] podman.yaml
    • [ ] rocky.yaml
    • [x] ubuntu.yaml
    • [x] vmnet.yaml
  • `host.lima.internal` should be defined *inside* running containers

    `host.lima.internal` should be defined *inside* running containers

    A note though - host.lima.internal should be defined inside running containers. That's what docker desktop has always done, it provides that name resolution. People don't really want to get to the host just from inside the lima container, they want to get to the host from inside containers they're running.

    Originally posted by @rfay in https://github.com/lima-vm/lima/discussions/389#discussioncomment-1855625

  • Replace reverse SSHFS with Samba

    Replace reverse SSHFS with Samba

    🔴 Current blocker: nls_utf8.ko is missing in openSUSE 15.3 https://bugzilla.opensuse.org/show_bug.cgi?id=1190797 🔴 I also have to rewrite this PR to make Samba non-default (https://github.com/lima-vm/lima/pull/188#discussion_r718677030)


    Replace previous PR #118 Fix #20 (Filesystem sharing)

    See the changes of docs/internal.md for the design.

    • On macOS hosts, /usr/local/sbin/samba-dot-org-smbd is used as the smbd binary. This binary can be installed with brew install samba. Apple's version of /usr/sbin/smbd cannot be used. The binary path can be overridden with $SMBD env var.

    • smbd is connected to QEMU via smb's stdio. The samba address 192.168.5.4:445 is only accessible from the guest, not from the host.

    • When the host's hostname is not present in /etc/hosts on the host filesystem, the Lima hostagent launches a mDNS to help looking up the hostname. Otherwise starting Samba takes 25 secs with "getaddrinfo failed" error. See the pkg/samba/getaddrinfoworkaround package for the further information.

  • How to install containerd with alpine-lima

    How to install containerd with alpine-lima

    It's not fully clear how to add containerd to alpine, since the scripts require systemd:

    ERRO[0018] [1 error occurred:
    	* failed to satisfy the optional requirement 1 of 2 "systemd must be available": systemd is required to run containerd, but does not seem to be available.
    Make sure that you use an image that supports systemd. If you do not want to run
    containerd, please make sure that both 'container.system' and 'containerd.user'
    are set to 'false' in the config file.
    

    Installing containerd is quite simple, but packages for "nerdctl" and "buildkit" are missing...

    provision:
      - mode: system
        script: |
          #!/bin/bash
          set -eux -o pipefail
          command -v containerd >/dev/null 2>&1 && exit 0
          apk add runc containerd cni-plugins
          sudo rc-update add containerd default
          sudo service containerd start
    

    They can be added from the tarballs, but there doesn't seem to be any support available ?

    That is, the current support is for nerdctl-full only (and not for nerdctl and buildkit archives)


    Would it be better to make custom aports, or perhaps to add support for extra archives ?

    containerd

    • https://github.com/containerd/containerd/archive/v1.5.8.tar.gz
    • https://github.com/alpinelinux/aports/tree/3.14-stable/community/containerd

    nerdctl

    • nerdctl-0.15.0-linux-amd64.tar.gz
    • nerdctl-0.15.0-linux-arm64.tar.gz

    buildkit

    • buildkit-v0.9.3.linux-amd64.tar.gz
    • buildkit-v0.9.3.linux-arm64.tar.gz
    • buildkit.confd
    • buildkit.initd

    Both lima sudo nerdctl run and lima sudo nerdctl build seem to be doing just fine...

    init-+-acpid
         |-7*[getty]
         |-sshd.pam---sshd.pam---sshd.pam-+-pstree
         |                                `-2*[sshfs---3*[{sshfs}]]
         |-supervise-daemo---lima-guestagent---7*[{lima-guestagent}]
         |-supervise-daemo---containerd---10*[{containerd}]
         |-supervise-daemo---buildkitd---8*[{buildkitd}]
         |-syslogd
         |-udevd
         `-udhcpc
    
  • vmnet: Support socket_vmnet; deprecate vde_vmnet

    vmnet: Support socket_vmnet; deprecate vde_vmnet

    socket_vmnet is similar to vde_vmnet but does not depend on VDE.

    https://github.com/lima-vm/socket_vmnet

    See docs/network.md for how to create networks.yaml with socketVMNet. When both socketVMNet and vdeVMNet (deprecated) are present in the YAML, socketVMNet is chosen.


    iperf3 benchmark (host -> guest)

    Mode | Shared (NAT) | Bridged ---------------|--------------|---------- socket_vmnet | 0.66 Gbps | 1.23 Gbps vde_vmnet | 0.27 Gbps | 0.31 Gbps

    Tested on MacBook Pro 2020 (Intel), macOS 12 Lima commit 8db31e8087272da1c848d5d6d23f680004ad7d45 , socket_vmnet v1.0.0-alpha.0, vde_vmnet v0.6.0

    Known issue: the throughput of the Shared (NAT) interface can be slower when both the Shared (NAT) and the Bridged interfaces are configured

  • [M1 macOS] Help wanted for testing Lima with QEMU@master

    [M1 macOS] Help wanted for testing Lima with QEMU@master

    Help wanted for testing https://github.com/lima-vm/lima/pull/703 on M1 macOS

    1. Install Lima v0.9.0-beta.0 or later (brew install --HEAD lima, or git clone https://github.com/lima-vm/lima.git && cd lima && make && make install)
    2. Install QEMU v6.2.0 (brew install qemu)
    3. Create instances with the following memory: 8 GiB, 4 GiB, 2 GiB.
    $ limactl start
    ? Creating an instance "default"  [Use arrows to move, type to filter]
      Proceed with the current configuration
    > Open an editor to review or modify the current configuration
      Choose another example (docker, podman, archlinux, fedora, ...)
      Exit
    
    (Change "memory: null" to "memory: 8 GiB" in the editor, and confirm that the instance works)
    $ limactl delete -f defaut
    
    1. Install QEMU master (brew install --HEAD qemu)
    2. Repeat the step 3
  • Enable trimming of the `diffdisk`

    Enable trimming of the `diffdisk`

    The diffdisk starts out small, but grows quickly as users create and delete container images. This can become an issue on laptops with limited free space.

    I tried to enable trim support just for Alpine, for testing, but couldn't get it to work. Here is the patch I tried:

    --- pkg/cidata/cidata.TEMPLATE.d/boot/05-persistent-data-volume.sh
    +++ pkg/cidata/cidata.TEMPLATE.d/boot/05-persistent-data-volume.sh
    @@ -14,7 +14,7 @@ DATADIRS="/etc /home /tmp /usr/local /var/lib"
     if [ "$(awk '$2 == "/" {print $3}' /proc/mounts)" == "tmpfs" ]; then
            mkdir -p /mnt/data
            if [ -e /dev/disk/by-label/data-volume ]; then
    -               mount -t ext4 /dev/disk/by-label/data-volume /mnt/data
    +               mount -t ext4 -o discard /dev/disk/by-label/data-volume /mnt/data
            else
                    # Find an unpartitioned disk and create data-volume
                    DISKS=$(lsblk --list --noheadings --output name,type | awk '$2 == "disk" {print $1}')
    @@ -32,7 +32,7 @@ if [ "$(awk '$2 == "/" {print $3}' /proc/mounts)" == "tmpfs" ]; then
                                    echo 'type=83' | sfdisk --label dos /dev/"${DISK}"
                                    PART=$(lsblk --list /dev/"${DISK}" --noheadings --output name,type | awk '$2 == "part" {prin
                                    mkfs.ext4 -L data-volume /dev/"${PART}"
    -                               mount -t ext4 /dev/disk/by-label/data-volume /mnt/data
    +                               mount -t ext4 -o discard /dev/disk/by-label/data-volume /mnt/data
                                    for DIR in ${DATADIRS}; do
                                            DEST="/mnt/data$(dirname "${DIR}")"
                                            mkdir -p "${DIR}" "${DEST}"
    --- pkg/qemu/qemu.go
    +++ pkg/qemu/qemu.go
    @@ -261,7 +261,7 @@ func Cmdline(cfg Config) (string, []string, error) {
                    args = appendArgsIfNoConflict(args, "-boot", "order=c,splash-time=0,menu=on")
            }
            if diskSize, _ := units.RAMInBytes(cfg.LimaYAML.Disk); diskSize > 0 {
    -               args = append(args, "-drive", fmt.Sprintf("file=%s,if=virtio", diffDisk))
    +               args = append(args, "-drive", fmt.Sprintf("file=%s,if=virtio,discard=unmap", diffDisk))
            } else if !isBaseDiskCDROM {
                    args = append(args, "-drive", fmt.Sprintf("file=%s,if=virtio", baseDisk))
            }
    

    I've created some files via dd if=/dev/urandom of=1.bin bs=64M count=64 iflag=fullblock etc and verified the growth in diffdisk size.

    I then deleted the *.bin files and ran:

    lima-alpine:~$ sudo fstrim -v /mnt/data
    /mnt/data: 105074479104 bytes trimmed
    lima-alpine:~$ sudo fstrim -v /mnt/data
    /mnt/data: 0 bytes trimmed
    

    But the size of the disk never shrinks.

    I wonder if this is a macOS limitation, that qemu doesn't implement the sparse file logic for APFS.

    Thoughts?

  • VirtualBox driver, for legacy compatibility and portability

    VirtualBox driver, for legacy compatibility and portability

    Description

    Once upon a time, there was something called Docker Machine and it was running on VirtualBox.

    It did have some other drivers, like qemu, but the virtualbox driver was the portable and default...

    Now that Lima has a driver framework, it could be useful to have a "vbox" driver next to the "qemu" ?

    It does support features like host networking and shared folders, that QEMU is still struggling with.


    Pros: might run on more platforms, such as legacy releases or other operating systems

    Cons: only supports Intel images, no support for COW images (resulting in larger files)

    But the biggest advantage is having another driver that also works on non-Mac hosts.

    And it can help to improve the driver API, if testing with more different implementations

  • Lima get stuck when certain frequency of DNS resolution occurs

    Lima get stuck when certain frequency of DNS resolution occurs

    Description

    Actual Behavior

    When I continue to execute nslookup/ping/dig or any other DNS name resolution operations within Lima, Lima get stuck after a certain number of times (lasting about 4 minutes). This issue also occurs inside Docker container when using Rancher Desktop, so this is critial issue for any system that uses container linking, like Apache+PHP and MySQL.

    Steps to Reproduce

    1. Login to Lima and keep running nslookup.
    $ rdctl shell
    lima-rancher-desktop:/Users/xxx$ while true; do nslookup www.google.co.jp; done
    
    1. While the above process is running, show a list of UDP open files that qemu-system-aarch64 handles on host OS.
    $ lsof -p $(pgrep qemu-system-aarch64) | grep "UDP"
    ...
    qemu-syst 6788 xxxx  119u  IPv4 0x2c6ecf140850ff5f         0t0                 UDP *:63544
    qemu-syst 6788 xxxx  120u  IPv4 0x2c6ecf140851762f         0t0                 UDP *:63398
    
    1. A number of UDP open files keep increasing and after it reaches to FD=1024u, Lima get stuck.
    $ lsof -p $(pgrep qemu-system-aarch64) | grep "UDP"
    ...
    qemu-syst 6788 xxxx  1023u  IPv4 0x2c6ecf14085191bf         0t0                 UDP *:54486
    qemu-syst 6788 xxxx  1024u  IPv4 0x2c6ecf140852088f         0t0                 UDP *:62934
    
    1. If you wait about 4 minutes, all UDP open files get released and Lima starts running again.

    Workaround

    If you set hostResolver.enabled=false , this issue doesn't occur.

    hostResolver:
      enabled: false
    

    Versions

    • Lima 0.14.2
    • Rancher Desktop 1.7.0

    Operating System / Build Version / CPU

    • MacOS Monterey 12.6 (M1 2020)
    • MacOS Ventura 13.0.1 (Intel Core i5, 2019)
  • Hostagent should have separate binary (at least on Windows hosts)

    Hostagent should have separate binary (at least on Windows hosts)

    Description

    On Windows hosts host agent should be linked as a GUI application for correct background processing, but limactl should still be console application.

    Example of this could be found here.

    Example of the actual issue. If Ctrl-C is sent to the terminal, where limactl was launched, which in order started limactl host agent, it will kill the host agent. Or if you close the console window it will also terminate the HA, which is not expected behavior.

    Related to https://github.com/lima-vm/lima/issues/909

  • `limactl inspect --format json` and `limactl ls --format json` produces the exactly same output

    `limactl inspect --format json` and `limactl ls --format json` produces the exactly same output

    Noticed that limactl inspect --format json and limactl ls --format json produces the exactly same output now.

    Probably, limactl ls isn't expected to print the config field?

    Originally posted by @AkihiroSuda in https://github.com/lima-vm/lima/issues/1249#issuecomment-1372978716

  • Support for VBox driver

    Support for VBox driver

    This is a legacy driver for Oracle VirtualBox, x86_64 only.

    It also has support for shared folders and hostonly networks, but they are not implemented just yet (sshfs and nat only)

    Deletion does not work properly, due to the VM "registry".

  • visualize qemu vm statistics in real-time

    visualize qemu vm statistics in real-time

    Description

    We (w/@dentrax) thought it'd be good to create a sub-command like stats which would display the VM statistics in real-time as the docker's stats command.

    # can take a VM name as an argument or will list all the VM stats if no VM name is given
    $ limactl stats <VM>
    NAME     CPUS    MEMORY    DISK
    vbox     %13     %27       %31    
    
Virtual-Operating-System - Virtual Operating System Using Golang And Fyne Implemented Gallery app
Virtual-Operating-System - Virtual Operating System Using Golang And Fyne Implemented Gallery app

Virtual Operating System Virtual Operating System Using Golang And Fyne Implemen

Jan 1, 2022
A bytecode-based virtual machine to implement scripting/filtering support in your golang project.

eval-filter Implementation Scripting Facilities Types Built-In Functions Conditionals Loops Functions Case/Switch Use Cases Security Denial of service

Dec 30, 2022
Forth virtual machine in Go

forego - A Forth implementation in Go ===================================== Why? ---- For ego. This is me learning the language. Both of them. So

Sep 9, 2022
A customisable virtual machine written in Go

== About GoLightly == GoLightly is a lightweight virtual machine library implemented in Go, designed for flexibility and reuse. Traditionally popular

Nov 16, 2022
A simple virtual machine - compiler & interpreter - written in golang

go.vm Installation Build without Go Modules (Go before 1.11) Build with Go Modules (Go 1.11 or higher) Usage Opcodes Notes The compiler The interprete

Dec 17, 2022
Expr – a tiny stack-based virtual machine written in Go

Expr – a tiny stack-based virtual machine written in Go The executor is designed to interpret a simple expression language and it's useful in delegati

Nov 11, 2022
This is a Virtual Operating System made by using GOLANG and FYNE.
This is a Virtual Operating System made by using GOLANG and FYNE.

Virtual-Operating-System This is a Virtual Operating System made by using GOLANG and FYNE. Hello! All In this project I have made a virtual Operating

Nov 1, 2021
Virtual Operating System Using Golang
Virtual Operating System Using Golang

Virtual Operating System Virtual Operating System Using Golang And Fyne Installation 1.Install Go 2.Install Gcc 3.Install Fyne Using This Command:- g

Jun 5, 2022
Weave Ignite is an open source Virtual Machine (VM) manager with a container UX and built-in GitOps management.
Weave Ignite is an open source Virtual Machine (VM) manager with a container UX and built-in GitOps management.

Weave Ignite is an open source Virtual Machine (VM) manager with a container UX and built-in GitOps management.

Nov 16, 2021
OperatingSys-GO - A Virtual Operating System made by using GOLANG and FYNE

Operating-System This is a Virtual Operating System made by using GOLANG and FYN

Jan 2, 2022
Lima launches Linux virtual machines on macOS, with automatic file sharing, port forwarding, and containerd.

Lima: Linux-on-Mac ("macOS subsystem for Linux", "containerd for Mac")

Jan 8, 2023
Run your MapReduce workloads as a single binary on a single machine with multiple CPUs and high memory. Pricing of a lot of small machines vs heavy machines is the same on most cloud providers.

gomap Run your MapReduce workloads as a single binary on a single machine with multiple CPUs and high memory. Pricing of a lot of small machines vs he

Sep 16, 2022
go-macos-pkg was built out of a desire to generate and sign macOS pkgs on non-macOS OSs.

About go-macos-pkg was built out of a desire to generate and sign macOS pkgs on non-macOS OSs. Caveats Right now most of the heavy lifting is done by

Aug 18, 2022
Create virtual machines and run Linux-based operating systems in Go using Apple Virtualization.framework.

vz - Go binding with Apple Virtualization.framework vz provides the power of the Apple Virtualization.framework in Go.

Jan 9, 2023
Convenience of containers, security of virtual machines

Convenience of containers, security of virtual machines With firebuild, you can build and deploy secure VMs directly from Dockerfiles and Docker image

Dec 28, 2022
The smart virtual machines manager. A modern CLI for Vagrant Boxes.
The smart virtual machines manager.  A modern CLI for Vagrant Boxes.

The smart virtual machines manager Table of Contents: What is Vermin Install Vermin Usage Contributors TODO What is Vermin Vermin is a smart, simple a

Dec 22, 2022
Kubernetes Virtualization API and runtime in order to define and manage virtual machines.
Kubernetes Virtualization API and runtime in order to define and manage virtual machines.

Kubernetes Virtualization API and runtime in order to define and manage virtual machines.

Jan 5, 2023
LazySSH is an SSH server that acts as a jump host only, and dynamically starts temporary virtual machines.

LazySSH is an SSH server that acts as a jump host only, and dynamically starts temporary virtual machines. If you find yourself briefly starti

Dec 11, 2022
Run your workloads on ephemeral Virtual Machines

vm-spinner Run your workloads on ephemeral Virtual Machines. Descriprion A simple tool that spawns an arbitrary number of VMs in parallel, runs the sa

Jan 21, 2022
Custom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain.
Custom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain.

pinentry-touchid Custom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain. Macbook Pro devic

Jan 1, 2023