cypress-docker-images icon indicating copy to clipboard operation
cypress-docker-images copied to clipboard

dbus warnings with 9.0.0 image

Open jimfm opened this issue 3 years ago • 37 comments

Switching from 8.7.0 to 9.0.0 image breaks our current Jenkins build with the following errors:

12:46:08  > cypress run "--config-file" "config/ci.json" "--headless" "--browser" "chrome" "--record" "--key=****"
12:46:08  
12:46:09  [126:1117/194609.299483:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
12:46:09  [126:1117/194609.300787:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
12:46:09  [126:1117/194609.300812:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
12:46:09  [126:1117/194609.302689:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 316: Permission denied (13)
12:46:09  [316:1117/194609.311910:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 
12:46:11  [OperationalError: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'
12:46:11  
12:46:11  ] {
12:46:11    cause: [Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'
12:46:11    
12:46:11    ] {
12:46:11      errno: -13,
12:46:11      code: 'EACCES',
12:46:11      syscall: 'mkdir',
12:46:11      path: '/root/.config/Cypress/cy/production/proxy'
12:46:11    },
12:46:11    isOperational: true,
12:46:11    errno: -13,
12:46:11    code: 'EACCES',
12:46:11    syscall: 'mkdir',
12:46:11    path: '/root/.config/Cypress/cy/production/proxy'
12:46:11  }
12:46:11  Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'```

The warnings fail the build.

If I run the image locally as specified in the readme docker run -it -v $PWD:/e2e -w /e2e cypress/included:9.0.0

I get the following warnings, though the tests still run:

% docker run -it -v $PWD:/e2e -w /e2e cypress/included:9.0.0
[18:1117/205925.216129:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[18:1117/205925.219185:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[18:1117/205925.219244:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[186:1117/205925.244039:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 
[18:1117/205928.199477:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon

Looking around for solutions indicates the dbus line ENV DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus but I"m not that familiar with it to tell if that's the reason.

jimfm avatar Nov 17 '21 21:11 jimfm

Hi

I can confirm this behavior on az devops agent (Environment: ubuntu-20.04 Version: 20211108.1 Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20211108.1/images/linux/Ubuntu2004-README.md Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20211108.1)

But on my work machine a windows 10 with Docker 4.2.0 with WSL 2 backend enabled, I get the following output:

[21:1118/092743.529997:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[21:1118/092743.532867:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[21:1118/092743.532906:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[185:1118/092743.584386:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        9.0.0                                                                          │
  │ Browser:        Electron 94 (headless)                                                         │
  │ Node Version:   v16.5.0 (/usr/local/bin/node)                                                  │
[...]

so perhaps an on linux problem?

CommCody avatar Nov 18 '21 09:11 CommCody

Seeing same failure as @jimfm with the latest docker image (9.0.0) - Jenkins CI with docker as an agent.

jvavre avatar Nov 19 '21 22:11 jvavre

Hello

I'm seeing the same problem on our CI going from Cypress v8.7.0 to v9.1.0.

[103:1124/102734.333572:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[103:1124/102734.334954:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[103:1124/102734.335062:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[103:1124/102734.375814:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 290: Permission denied (13)
[290:1124/102734.375928:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 
[OperationalError: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

] {
  cause: [Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'
  
  ] {
    errno: -13,
    code: 'EACCES',
    syscall: 'mkdir',
    path: '/root/.config/Cypress/cy/production/proxy'
  },
  isOperational: true,
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/root/.config/Cypress/cy/production/proxy'
}
Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

It seems this docker image only works when launching the command as a root user, which is a huge regression.

ulrik59 avatar Nov 24 '21 13:11 ulrik59

Same here: =(

Using cypress.json configuration:
Spec files:  cypress/integration/**/*.feature
[62:1124/193107.945289:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[62:1124/193107.951901:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[62:1124/193107.951946:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[231:1124/193107.976475:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 
[OperationalError: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

] {
  cause: [Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'
  
  ] {
    errno: -13,
    code: 'EACCES',
    syscall: 'mkdir',
    path: '/root/.config/Cypress/cy/production/proxy'
  },
  isOperational: true,
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/root/.config/Cypress/cy/production/proxy'
}
Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

drenatus avatar Nov 24 '21 19:11 drenatus

Same issue here as well. Any suggestion or solution?

Using cypress.json configuration:
Spec files:  cypress/features/**/*.feature
[119:1201/121902.100138:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[119:1201/121902.103411:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[119:1201/121902.103813:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
[119:1201/121902.114437:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 292: Permission denied (13)
[292:1201/121902.130933:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 
[OperationalError: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

] {
  cause: [Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'
  
  ] {
    errno: -13,
    code: 'EACCES',
    syscall: 'mkdir',
    path: '/root/.config/Cypress/cy/production/proxy'
  },
  isOperational: true,
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/root/.config/Cypress/cy/production/proxy'
}
Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

omersomuncu avatar Dec 01 '21 12:12 omersomuncu

@flotwig Any chance someone can check on this? I'm seeing other tickets with similar descriptions.
For me, this just started with 9+ Cypress, if I downgrade to 8.7.* I no longer get the error.

jimfm avatar Dec 06 '21 22:12 jimfm

same here. After I downgraded 8.7, problem disappeared.

omersomuncu avatar Dec 07 '21 08:12 omersomuncu

for now i'm using the 8.7 image and update cypress before running the build

drenatus avatar Dec 09 '21 13:12 drenatus

Those of you seeing this issue, can you please share the OS being used & the docker command being ran that produced this error? It would be helpful to link to any builds as a reference as well.

emilyrohrbough avatar Dec 09 '21 16:12 emilyrohrbough

Hi @emilyrohrbough,

OS: Ubuntu 20.04 Docker: 20.10.11 Command:

docker run \
       --rm \
       --pull always \
       --env CYPRESS_BASE_URL=https://foo.local \
       --entrypoint sh \
       --volume ${PWD}/e2e:/e2e \
       --workdir /e2e \
       cypress/included:9.0.0 \
       -c "npm install -y && cypress run --spec 'cypress/integration/**/*.ts'"

vincentchalamon avatar Dec 09 '21 16:12 vincentchalamon

SO: Ubuntu 20.04

FROM cypress/included:9.1.1 WORKDIR /app ENV COMMAND="test:headless-plataforma" ENTRYPOINT npm install && npm run ${COMMAND}

drenatus avatar Dec 09 '21 17:12 drenatus

OS: CentOS 7.0 Docker: 20.10.2, build 2291f61 Used image: cypress/included:9.0.0 (same error 9.1.0 and 9.1.1) Command (within docker -c): NO_COLOR=1 npx cypress run

jvavre avatar Dec 13 '21 18:12 jvavre

Same here:

  cypress:server:server-e2e createServer connecting to server +0ms
  cypress:server:server-base Server listening on  { address: '127.0.0.1', family: 'IPv4', port: 33005 } +9ms
  cypress:server:appdata path: /root/.config/Cypress/cy/production/proxy +2s
  cypress:server:file get values from /root/.config/Cypress/cy/production/cache +0ms
  cypress:server:file attempt to get lock on /root/.config/Cypress/cy/production/cache +0ms
  cypress:server:file getting lock succeeded or failed for /root/.config/Cypress/cy/production/cache +3ms
  cypress:server:file read /root/.config/Cypress/cy/production/cache +1ms
  cypress:server:file read succeeded or failed for /root/.config/Cypress/cy/production/cache +0ms
  cypress:server:file attempt to unlock /root/.config/Cypress/cy/production/cache +0ms
  cypress:server:file get values from /root/.config/Cypress/cy/production/cache +2ms
  cypress:server:file unlock succeeded or failed for /root/.config/Cypress/cy/production/cache +0ms
  cypress:server:api request to url: POST https://api.cypress.io/exceptions with params: {"body":{"err":{"name":"Error","message":"EACCES: permission denied, mkdir <stripped-path>proxy'","stack":"Error: EACCES: permission denied, mkdir <stripped-path>proxy'\n\n"},"version":"9.2.0","osName":"linux","osVersion":"Debian - 10.11","osCpus":[{"model":"Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz","speed":2499,"times":{"user":156226950,"nice":23060,"sys":96793660,"idle":5031019140,"irq":0}},{"model":"Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz","speed":2499,"times":{"user":157508390,"nice":23310,"sys":96658260,"idle":5033473390,"irq":0}},{"model":"Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz","speed":2499,"times":{"user":203386430,"nice":19080,"sys":96800880,"idle":4992580310,"irq":0}},{"model":"Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz","speed":2499,"times":{"user":203692880,"nice":18860,"sys":95624250,"idle":4993402220,"irq":0}}],"osMemory":{"free":388730880,"total":16515055616}},"headers":{"x-os-name":"linux","x-cypress-version":"9.2.0"}} and token: undefined +0ms
  cypress:network:agent addRequest called { isHttps: true, href: 'https://api.cypress.io/exceptions' } +0ms
  cypress:network:connect beginning getAddress { hostname: 'api.cypress.io', port: 443 } +0ms
[OperationalError: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

] {
  cause: [Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'
  
  ] {
    errno: -13,
    code: 'EACCES',
    syscall: 'mkdir',
    path: '/root/.config/Cypress/cy/production/proxy'
  },
  isOperational: true,
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/root/.config/Cypress/cy/production/proxy'
}
Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'


  cypress:server:browsers browsers.kill called with no active instance +1s

FROM cypress/included:9.2.0

cport93 avatar Jan 05 '22 20:01 cport93

Hi @emilyrohrbough,

any known workarounds other than running as root (regression and not greatest option to go for I'd say) or recommended to stay on 8.7.0 until resolved?

Thanks!

jvavre avatar Jan 05 '22 21:01 jvavre

Hmm, when I go back to 8.7.0 using the above advice, i still get the same error output. Am running off Docker (Linux)

jbird21 avatar Jan 10 '22 15:01 jbird21

According to Google Chrome headless needs a temporary --disable-gpu (see here). And it seems this is also required for Linux (see here)

But I guess this is better reported to cypress repo

russoale avatar Jan 13 '22 11:01 russoale

Hm... Duplicate? https://github.com/cypress-io/cypress-docker-images/issues/543

BurhanH avatar Jan 21 '22 20:01 BurhanH

Hm... Duplicate? #543

Warnings in the 8.7.0 do not fail the whole build/run, which they do with 9.0.0 img

jvavre avatar Jan 26 '22 18:01 jvavre

Hm... Duplicate? #543

Warnings in the 8.7.0 do not fail the whole build/run, which they do with 9.0.0 img

Try to use the latest image 9.3.1 for the build/run

BurhanH avatar Jan 26 '22 22:01 BurhanH

Hm... Duplicate? #543

Warnings in the 8.7.0 do not fail the whole build/run, which they do with 9.0.0 img

Try to use the latest image 9.3.1 for the build/run

Getting same output as on 9.0.0

jvavre avatar Jan 26 '22 22:01 jvavre

@jvavre Are you able to execute the test scenarious?

Unfortunately, I did not find yet any proper solution to fix or suppress those messages in the Docker:

[40:0125/141303.227644:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [40:0125/141303.229198:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon [40:0125/141303.229233:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon [40:0125/141303.234094:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon [227:0125/141303.247145:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is [40:0125/141304.982156:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [40:0125/141304.984311:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon [40:0125/141304.984354:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon [228:0125/141305.000558:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is

But our tests are OK to run with the latest image 9.3.1 except for those annoying messages.

BurhanH avatar Jan 26 '22 23:01 BurhanH

@jvavre Are you able to execute the test scenarious?

Hey! Can't, still failing with latest image (9.3.1) as mentioned above - I assume root permission might work, but can't do that with the policy set up in CI

jvavre avatar Jan 31 '22 18:01 jvavre

Also confirmed in 9.3.1 image. Using Mac OS 11.6 and Docker desktop 4.4.2 (73305). Also get while running the tests [19:0131/221005.330335:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon. In addition to the above mentioned three lines.

bode-praetorian avatar Jan 31 '22 22:01 bode-praetorian

I'm on 9.4.1 and I'm still getting

Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

I believe it is running in root, when I run it as user 'node' I get different errors about not being able to write to the video directory because it doesn't have root permissions

This isn't just warnings, the test fails and exits with error code 1

I'm not seeing this issue when running cypress in docker locally, I'm only seeing this use when running cypress on docker via a github action.

Develliot avatar Feb 03 '22 21:02 Develliot

~~This might be a node 14 only error~~, when I update to node 16,

I get a different error, this happens across all jobs not just the cypress one.

EACCES: permission denied, mkdir '/root/.cache/Cypress'

E2A when I update to node 16 I need to set the cypress cash CYPRESS_CACHE_FOLDER then I am stuck with the

Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

Develliot avatar Feb 04 '22 09:02 Develliot

I have got further but still no cigar.

So the main issue:

Error: EACCES: permission denied, mkdir '/root/.config/Cypress/cy/production/proxy'

I never see locally I only see on github actions when running docker-compose calling cypress, so here is my docker-compose file:

version: "3.7"

services:
  npm:
    user: root
    image: node:16
    volumes:
      - .:/app:delegated
    working_dir: /app
    environment:
      CYPRESS_CACHE_FOLDER: ./cy-cache-here
    entrypoint: "/usr/local/bin/npm install"
  cypress:
    user: root
    networks:
      network:
    image: cypress/included:9.4.1
    working_dir: /app
    volumes:
      - .:/app:delegated
    entrypoint: npx cypress run-ct

networks:
  network:

I'm not convinced user: root does a thing

Here is what my git hub action looks like

name: "Test"
on:
  pull_request:
    branches:
      - develop
      - master

jobs:
  Cypress:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout cruk-react-components
        uses: actions/[email protected]
      - name: npm install
        run: docker-compose run npm ci
      - name: Test
        run: docker-compose run cypress

It always fails at the Test step. However when I set the user on the github action (the last line from above) to:

run: docker-compose run -u node cypress
      

It sort of works, it actually starts the test, but because I'm not root, and cypress needs root to save to /vidoes and /snpashots it errors at that bit like this:

Screenshot 2022-02-04 at 16 49 23

I also tried user '1001' based on another thread I think it was the cypress github actions repo issues people are experiencing similar problems their and are saying use user 1001 here https://github.com/cypress-io/github-action/issues/446 clutching at straws now so I tried this:

run: docker-compose run -u "1001" cypress
      

Then I get a new error probably because that user doesn't exist:

Screenshot 2022-02-04 at 16 56 59

It doesn't matter what user stuff I put in the docker-compose file, the only thing that seems to have a bearing on this is the user set when running the docker compose from the github action workflow.

Develliot avatar Feb 04 '22 16:02 Develliot

I've just had a look at the generated docker files for

cypress/included:9.4.1

and anything before cypress/included:9.0.0. so 8.7 and under

where this issue doesn't exist and the only difference I can see is the jump from node 14 to node 16, or npm from 6 to >7

I also checked that when I updated my project to node 16 with all my docker images on node 16 except for the cypress, kept that at 8.7.0 (node 14) as long as I defined the CYPRESS_CACHE_FOLDER as an env var everything was fine.

The moment I use cypress/included:9.0.0 + which has node 16, I see the issue. So i don't think it's an issue with github actions + docker + node 16, this is definitely a cypress/included specific issue.

Develliot avatar Feb 04 '22 18:02 Develliot

Ah ha! A colleague figured it out, it's when the host machine is Ubuntu which is what GitHub Actions uses and I assume other CI products also. You need to be explicit about the entry point location

/my_root_dir_name/node_modules/cypress/bin/cypress run-ct

It worked locally with docker-compose because either the host OS is different or it was different or it was using a different flavour of debian.

I think there are issues with different services on the same container talking to each other and their permissions with Unbuntu and NPM >7, especially when using npx

So we simplified my multistage build which had a services based on node 16 image that ran npm ci and another service image based on cypress/included:9.4.1 image with an entry point of npx cypress run-ct

We now have one service based on the cypress/included:9.4.1 that does everything and there were no EACCES issues

so docker compose just looks like this:

version: "3.7"

services:
  cypress:
    networks:
      network:
    image: cypress/included:9.4.1
    working_dir: /app
    volumes:
      - .:/app:delegated
    entrypoint: /app/node_modules/cypress/bin/cypress run-ct

networks:
  network:

Now npx didn't work but pointing to the run-ctscript from the actual location works, almosts as if 'npx' was ignoring all the envionment variables which gave the user permissions to do stuff

and the git hub action like this

name: "Test"
on:
  pull_request:
    branches:
      - develop
      - master

jobs:
  Cypress:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout cruk-react-components
        uses: actions/[email protected]
      - name: npm install
        run: docker-compose run --entrypoint=npm cypress ci
      - name: Test
        run: docker-compose run cypress
      - name: Work around our usage of Github storage
        if: failure()
        run: |
          mkdir output
          tar cvfj output/videos.tar.bz2 -C cypress/videos .
          tar cvfj output/screenshots.tar.bz2 -C cypress/screenshots .
          tar cvfj output/snapshots.tar.bz2 -C cypress/snapshots .
      - name: Upload Cypress output
        if: failure()
        uses: actions/[email protected]
        with:
          name: output
          path: output

so the thing to note here is that the cypress/included:9.4.1 image is where npm ci runs and then runs the other entry point with run-ct all in the same services and the node-modules are loaded into a location where this service user definitely has permissions

There is the caveat that I'm now installing cypress when before I didn't have I just used the one on the cypress/included image but at least it works.

Develliot avatar Feb 08 '22 16:02 Develliot

One solution came up for us running Cypress >= 9.0.0 using the docker containers in our CI system, running the official images in Kubernetes.
In setting up the pod, add the following configuration:

spec:
  securityContext:
    runAsUser: 1000
    runAsGroup: 3000
    fsGroup: 2000

This fixed the permissions issues I had going on. I'm not sure what difference this is related to, but it fixed my issue. Hopefully it can helps someone else.

jimfm avatar Feb 10 '22 20:02 jimfm

This fixed it for me after a LOT of tries, without setting root permissions: https://github.com/cypress-io/cypress/issues/2821#issuecomment-444109124 - I've found it buried there after going through a LOT of threads regarding this issue. I've just set these two env vars in Jenkinsfile.

jvavre avatar Feb 11 '22 20:02 jvavre