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")

Lima launches Linux virtual machines on macOS, 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".

Automatic file sharing

Automatic port forwarding

Built-in support for containerd

Intel on Intel

ARM on Intel

ARM on ARM (untested)

Intel on ARM (untested)

Ubuntu

Fedora

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

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.

NOTE Privileged ports (0-1023) cannot be forwarded

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

Getting started

Requirements (Intel Mac)

  • coreutils (for realpath command) (brew install coreutils)

  • QEMU (brew install qemu)

  • Run the following commands to enable --accel=hvf:

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




    
    com.apple.vm.hypervisor
    
    
    com.apple.security.hypervisor
    


EOF

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

Requirements (ARM Mac)

NOTE Lima is not tested on ARM Mac.

Install

Download the binary archive from https://github.com/AkihiroSuda/lima/releases , and extract it under /usr/local (or somewhere else).

To install from the source, run make && make install.

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 just lima . The lima command also accepts the instance name as the environment variable $LIMA_INSTANCE.

  • Run limactl ls to show the instances.

  • Run limactl delete to delete the instance.

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

⚠️ 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.TEMPLATE.yaml.

The current default spec:

  • OS: Ubuntu 21.04 (Hirsute Hippo)
  • CPU (x86_64): Haswell v4, 4 cores
  • CPU (aarch64): Cortex A72, 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
  • Port forwarding: ssh -L, automated by watching /proc/net/tcp in the guest

Developer guide

Contributing to Lima

Help wanted

🙏

  • Test on ARM Mac
  • Performance optimization
  • Homebrew
  • More guest distros
  • Linux on Windows/Linux/BSD
  • GUI with system tray icon (Qt or Electron, for portability)
  • VirtFS to replace the current reverse sshfs (work has to be done on QEMU repo)
  • vsock to replace SSH (work has to be done on QEMU repo)

FAQs

"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 -o NoHostAuthenticationForLocalhost=yes 127.0.0.1.

"Does Lima work on ARM Mac?"

Yes, it should work, but not tested on ARM.

"Can I run non-Ubuntu guests?"

Fedora is also known to work, see ./examples/fedora.yaml. This file can be loaded with limactl start ./examples/fedora.yaml.

An image has to satisfy the following requirements:

  • systemd
  • cloud-init
  • The following binaries to be preinstalled:
    • curl
    • sudo
  • The following binaries to be preinstalled, or installable via the package manager:
    • sshfs
    • newuidmap and newgidmap
  • apt-get or dnf (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 Podman?"

Yes, if you install it.

containerd can be stopped with systemctl --user disable --now containerd.

"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.

"QEMU crashes with HV_ERROR"

You have to add com.apple.security.hypervisor entitlement to qemu-system-x86_64 binary. See Getting started.

"QEMU is slow"

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

"Port forwarding does not work"

Privileged ports (0-1023) cannot be forwarded. e.g., you have to use 8080, not 80.

error "field SSHPubKeys must be set"

Make sure you have a ssh keypair in ~/.ssh. To create:

ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<&1 >/dev/null

error "hostkeys_foreach failed: No such file or directory"

Make sure you have a ssh known_hosts file:

touch ~/.ssh/known_hosts

error "failed to execute script ssh: [...] Permission denied (publickey)"

If you have a ~/.ssh/config with a username overwrite for all hosts, exclude 127.0.0.1 from it. Example:

Host * !127.0.0.1
        User root

"Hints for debugging other problems?"

  • Inspect logs:
    • limactl --debug start
    • /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.
  • If you have passphrases for any private key under ~/.ssh, you will need to have ssh-agent running.
Owner
Akihiro Suda
A maintainer of Moby(dockerd), BuildKit, containerd, and runc.
Akihiro Suda
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?

  • `limactl list --json` now returns an array instead of newline delimited JSON

    `limactl list --json` now returns an array instead of newline delimited JSON

    Description

    Originally reported in https://github.com/abiosoft/colima/issues/572

    I don't think this was intentional, and should be fixed before the next release, as it breaks backwards compatibility.

    And I think limactl inspect should be changed accordingly for consistency.

  • support socket_vmnet for vz driver

    support socket_vmnet for vz driver

    The support for socket_vmnet is provided as mentioned over here https://github.com/lima-vm/socket_vmnet/issues/13#issuecomment-1366410910

    Note: This is done so that we can easily support QEMU based network stack in vz as well. This might have a reduced performance due to pipe of dgram <-> unix socket connection

  • build(deps): bump golang.org/x/sys from 0.3.0 to 0.4.0

    build(deps): bump golang.org/x/sys from 0.3.0 to 0.4.0

    Bumps golang.org/x/sys from 0.3.0 to 0.4.0.

    Commits
    • b60007c unix: add Uvmexp and SysctlUvmexp for NetBSD
    • b751db5 unix: gofmt hurd files after CL 459895
    • b360406 unix: support TIOCGETA on GNU/Hurd
    • 3086868 unix: regen on OpenBSD 7.2
    • 2b11e6b unix: remove Mclpool from openbsd types
    • 7c6badc unix: convert openbsd/mips64 to direct libc calls
    • 3b1fc93 unix: avoid allocations for common uses of Readv, Writev, etc.
    • 2204b66 cpu: parse /proc/cpuinfo on linux/arm64 on old kernels when needed
    • 72f772c unix: offs2lohi should shift by bits, not bytes
    • cffae8e unix: add ClockGettime on *bsd and solaris
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 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    
    
  • Virtualization.framework low Geekbench performance

    Virtualization.framework low Geekbench performance

    Description

    I've tried running Geekbench 5.4 from here on Lima using both Virtualization.framework and QEMU and on Docker Desktop using Virtualization.framework. The performance of Docker Desktop and QEMU are pretty much aligned, but Lima with VZ consistently lags behind.

    Here are the numbers I got (in all the tests the VM has access to 4 cores and 8GB of RAM):

    • Lima QEMU:
      • Single: 1672
      • Multi: 5503
    • Lima VZ:
      • Single: 1225
      • Multi: 4191
    • Docker Desktop (Virtualization.framework):
      • Single: 1655
      • Multi: 5680

    I apologize if this is a known issue or if I missed something in the configuration

Auto-magic file organisation for your machines. :open_file_folder:
Auto-magic file organisation for your machines. :open_file_folder:

Switchboard Description Do you ever get annoyed that your Downloads folder gets cluttered with all types of files? Do you wish you could automatically

Jan 2, 2023
Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading.

Knit Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading. Example openapi: "

Sep 15, 2022
Go library for creating state machines
Go library for creating state machines

Stateless Create state machines and lightweight state machine-based workflows directly in Go code: phoneCall := stateless.NewStateMachine(stateOffHook

Jan 6, 2023
Package fsm allows you to add finite-state machines to your Go code.

fsm Package fsm allows you to add finite-state machines to your Go code. States and Events are defined as int consts: const ( StateFoo fsm.State =

Dec 9, 2022
libFFM-gp: Pure Golang implemented library for FM (factorization machines)

libFFM-gp: Pure Golang implemented library for FM (factorization machines)

Oct 10, 2022
The package manager for macOS you didn’t know you missed. Simple, functional, and fast.
The package manager for macOS you didn’t know you missed. Simple, functional, and fast.

Stew The package manager for macOS you didn’t know you missed. Built with simplicity, functionality, and most importantly, speed in mind. Installation

Mar 30, 2022
GoC2 - MacOS Post Exploitation C2 Framework
GoC2 - MacOS Post Exploitation C2 Framework

goc2 c2 client/server/paylod GoC2 - MacOS Post Exploitation C2 Framework Custom C2 for bypassing EDR and ease of use.

Dec 23, 2022
TNO MPC Lab - Shamir Secret Sharing

TNO MPC Lab - Shamir Secret Sharing The TNO MPC lab consists of generic software components, procedures, and functionalities developed and maintained

Jun 26, 2022
Let's Go is task sharing app implemented in golang.

Let's Go - A sample GO app Overview Let's Go is an HTTP server. It has various apis to play with. It is a small app that can group users of a company

Dec 13, 2021
Forklift: an API application developed with go that enables virtual server migration from vcenter virtualization environment to openstack environment
Forklift: an API application developed with go that enables virtual server migration from vcenter virtualization environment to openstack environment

What is the Forklift? Forklift is an API application developed with go that enables virtual server migration from vcenter virtualization environment t

Jan 14, 2022
Simple Golang API to demonstrate file upload to fireabase storage and retrieving url of uploaded file.

go-firebase-storage -Work in progress ??️ Simple Golang API that uses Firebase as its backend to demonstrate various firebase services using Go such a

Oct 4, 2021
Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file

About hclmergetool Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file Installation Binary Rel

Feb 6, 2022
Entitas-Go is a fast Entity Component System Framework (ECS) Go 1.17 port of Entitas v1.13.0 for C# and Unity.

Entitas-Go Entitas-GO is a fast Entity Component System Framework (ECS) Go 1.17 port of Entitas v1.13.0 for C# and Unity. Code Generator Install the l

Dec 26, 2022
A Go package to allow you to read and write from the serial port as a stream of bytes.

Serial A Go package to allow you to read and write from the serial port as a stream of bytes. Details It aims to have the same API on all platforms, i

Jan 6, 2023
Go port of Coda Hale's Metrics library

go-metrics Go port of Coda Hale's Metrics library: https://github.com/dropwizard/metrics. Documentation: http://godoc.org/github.com/rcrowley/go-metri

Dec 30, 2022
Go binding to libserialport for serial port functionality.

Go Serial Package serial provides a binding to libserialport for serial port functionality. Serial ports are commonly used with embedded systems, such

Nov 1, 2022
Minecraft Port Knock With Golang

Minecraft Port Knock A simple program that performs two duties: Monitor a Minecraft server and stop it after it has been empty for some amount of time

Jan 11, 2022
A simple tool to send binary data over a serial port. Designed for use with my retro computer systems.

Colin's Transfer Tool This is a really basic tool to transfer firmware files to my retro computer systems over a serial port. This removes the need fo

Dec 21, 2021
Record CS knowlegement with XMind, version 2.0. 使用 XMind 记录 Linux 操作系统,网络,C++,Golang 以及数据库的一些设计
Record CS knowlegement with XMind, version 2.0. 使用 XMind 记录 Linux 操作系统,网络,C++,Golang 以及数据库的一些设计

Psyduck 另一个用 XMind 记录 CS 基础问题的地方,同样提供了 .xmind 源文件以及导出的 .pdf 文件,XMind 版本为「XMind 2020」。 在 2020 年时,曾花了约 2 个月的时间整理了第一份 XMind 知识库: ZeroMind。 之所以额外创建一个 Repo

Dec 30, 2022