abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup
MIT License
18.64k stars 380 forks source link

virtiofs, weird behaviour with extended attributes, and amazonlinux2 docker image #1115

Open avoidik opened 3 weeks ago

avoidik commented 3 weeks ago

Description

hello,

I am trying to understand the root cause of the following issue with the amazonlinux:2 docker image. Whenever I run cp inside of a running container the command behaves differently depending on the mount-type filesystem specified. Please check the repo-steps below where I was trying to run cp -au . dst-dir in 3 different scenarios. The first one was unexpectedly failing with No data available, while the other two were working as expected, in all test-cases the cp command was the same.

Version

colima version 0.7.3
git commit: a66b375e8df84ff2860797efc683e66632bcbce3
limactl version 0.23.1
qemu-img version 9.0.2

Operating System

Output of colima status

Please check the repro-steps below.

Reproduction Steps

Prepare a sample directory structure:

$ mkdir test ; cd test
$ mkdir src ; mkdir result
$ echo 'empty file' | tee ./src/dummy

Check a negative test-case scenario (expected - success, received - failure):

$ colima start colima-arm --cpu 2 --memory 4 --disk 20 --arch aarch64 --vm-type=vz --vz-rosetta --mount-type=virtiofs
INFO[0000] starting colima [profile=arm]
INFO[0000] runtime: docker
INFO[0001] creating and starting ...                     context=vm
INFO[0012] provisioning ...                              context=docker
INFO[0013] starting ...                                  context=docker
INFO[0014] done
$ colima status colima-arm
INFO[0000] colima [profile=arm] is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] socket: unix:///Users/user.name/.colima/arm/docker.sock
$ docker run -i --rm -u 0:0 -v $(pwd)/src:/asset-input:delegated -v $(pwd)/result:/asset-output:delegated -w /asset-input amazonlinux:2 \
    bash -c 'yum install -y -q util-linux; findmnt /asset-input; cp -au . /asset-output'
Failed to get D-Bus connection: Operation not permitted
TARGET       SOURCE                              FSTYPE   OPTIONS
/asset-input mount0[/temp/test/src] virtiofs rw,relatime
/usr/bin/cp: preserving permissions for '/asset-output/.': No data available
$ echo $?
1
$ colima delete colima-arm -f

Check a positive test-case scenario (vz, expected - success, received - success):

$ colima start colima-arm --cpu 2 --memory 4 --disk 20 --arch aarch64 --vm-type=qemu --cpu-type=host --mount-type=sshfs
INFO[0000] starting colima [profile=arm]
INFO[0000] runtime: docker
INFO[0000] creating and starting ...                     context=vm
INFO[0011] provisioning ...                              context=docker
INFO[0012] starting ...                                  context=docker
INFO[0013] done
$ colima status colima-arm
INFO[0000] colima [profile=arm] is running using QEMU
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] socket: unix:///Users/user.name/.colima/arm/docker.sock
$ docker run -i --rm -u 0:0 -v $(pwd)/src:/asset-input:delegated -v $(pwd)/result:/asset-output:delegated -w /asset-input amazonlinux:2 \
    bash -c 'yum install -y -q util-linux; findmnt /asset-input; cp -au . /asset-output'
Failed to get D-Bus connection: Operation not permitted
TARGET       SOURCE                                                   FSTYPE     OPTIONS
/asset-input :/Users/user.name[/temp/test/src] fuse.sshfs rw,nosuid,nodev,relatime,user_id=502,group_id=1000,allow_other
$ echo $?
0
$ colima delete colima-arm -f

Check a positive test-case scenario (rosetta, expected - success, received - success):

$ colima start colima-arm --cpu 2 --memory 4 --disk 20 --arch aarch64 --vm-type=vz --vz-rosetta --mount-type=sshfs
INFO[0000] starting colima [profile=arm]
INFO[0000] runtime: docker
INFO[0000] creating and starting ...                     context=vm
INFO[0011] provisioning ...                              context=docker
INFO[0012] starting ...                                  context=docker
INFO[0013] done
$ colima status colima-arm
INFO[0000] colima [profile=arm] is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] socket: unix:///Users/user.name/.colima/arm/docker.sock
$ docker run -i --rm -u 0:0 -v $(pwd)/src:/asset-input:delegated -v $(pwd)/result:/asset-output:delegated -w /asset-input amazonlinux:2 \
    bash -c 'yum install -y -q util-linux; findmnt /asset-input; cp -au . /asset-output'
docker run -i --rm -u 0:0 -v $(pwd)/src:/asset-input:delegated -v $(pwd)/result:/asset-output:delegated -w /asset-input amazonlinux:2     bash -c 'yum install -y -q util-linux; findmnt /asset-input; cp -au . /asset-output'
Failed to get D-Bus connection: Operation not permitted
TARGET       SOURCE                                                   FSTYPE     OPTIONS
/asset-input :/Users/user.name[/temp/test/src] fuse.sshfs rw,nosuid,nodev,relatime,user_id=502,group_id=1000,allow_other
$ echo $?
0
$ colima delete colima-arm -f

Expected behaviour

I would like to understand what's wrong with the virtiofs file-system, and make sure that cp command works as expected.

Additional context

if I try colima 0.5.6, it doesn't have this issue

avoidik commented 3 weeks ago

probably, a coreutils bug unrelated to colima, which had been fixed a long time ago between these two versions:

I cannot explain why it does work on 0.5.6