Error: EACCES: permission denied while running selenium-side-runner in Jenkins - jenkins

I run my jenkins build (executing shell on ubuntu) and get this error:
+ selenium-side-runner -c goog:chromeOptions.args=[--start-maximize, --headless] browserName=chrome --output-directory=results --output-format=junit cabinetTesting.side --filter LandingTab
[32minfo[39m: Running cabinetTesting.side
/usr/lib/node_modules/selenium-side-runner/node_modules/rimraf/rimraf.js:321
throw er
^
Error: EACCES: permission denied, unlink 'side-suite-cabinetTesting/CabinetExistingUser.test.js'
at Object.unlinkSync (node:fs:1720:3)
at rimrafSync (/usr/lib/node_modules/selenium-side-runner/node_modules/rimraf/rimraf.js:314:17)
at /usr/lib/node_modules/selenium-side-runner/node_modules/rimraf/rimraf.js:350:5
at Array.forEach (<anonymous>)
at rmkidsSync (/usr/lib/node_modules/selenium-side-runner/node_modules/rimraf/rimraf.js:349:26)
at rmdirSync (/usr/lib/node_modules/selenium-side-runner/node_modules/rimraf/rimraf.js:342:7)
at Function.rimrafSync [as sync] (/usr/lib/node_modules/selenium-side-runner/node_modules/rimraf/rimraf.js:312:9)
at runProject (/usr/lib/node_modules/selenium-side-runner/dist/index.js:238:19)
at runAll (/usr/lib/node_modules/selenium-side-runner/dist/index.js:345:10)
at Object.<anonymous> (/usr/lib/node_modules/selenium-side-runner/dist/index.js:390:3) {
errno: -13,
syscall: 'unlink',
code: 'EACCES',
path: 'side-suite-cabinetTesting/CabinetExistingUser.test.js'
}
Following advices, i changed ownership of /usr/lib/node_modules folder to jenkins group.
ls -l /usr/lib/node_modules/
total 16
drwxr-xr-x 5 jenkins jenkins 4096 Mar 14 16:26 chromedriver
drwxr-xr-x 4 jenkins jenkins 4096 Mar 14 16:15 corepack
drwxr-xr-x 8 jenkins jenkins 4096 Mar 14 16:15 npm
drwxr-xr-x 4 jenkins jenkins 4096 Mar 15 09:53 selenium-side-runner
But the problem still persists. Any suggestion how to fix this?

Related

docker ADD with symlinks

When I do sudo docker build -t test -f 7.1/Dockerfile . docker fails on step 8/10:
Step 8/10 : ADD etc/php /usr/local/etc/php
ADD failed: file not found in build context or excluded by .dockerignore: stat etc/php: file does not exist
I don't understand. etc/php is symlinked to another directory. Shouldn't that work?
If I do ls -latr etc/php I get this:
lrwxrwxrwx 1 scbn scbn 43 Sep 11 17:48 etc/php -> /home/neubert/devops/containers/common/etc/php
If I do cd etc/php && ls -latr I get this:
total 84
drwxr-xr-x 2 scbn scbn 4096 Jan 3 2021 conf.d
drwxr-xr-x 5 scbn scbn 4096 Jan 3 2021 ..
-rw-r--r-- 1 scbn scbn 70125 Jan 26 2021 php.ini
drwxr-xr-x 3 scbn scbn 4096 Jan 26 2021 .
$ docker build --help
Usage: docker build [OPTIONS] PATH | URL | -
Here, PATH | URL | - is so called build context, you usually use ., but it could be other path. When docker build, it will tar all the contents in build context, then pass it to docker engine. So, the COPY in Dockerfile could just reference the item in build context.
For your scenario:
lrwxrwxrwx 1 scbn scbn 43 Sep 11 17:48 etc/php -> /home/neubert/devops/containers/common/etc/php
Above I guess the symbol link etc/php is in your build context, while the real folder /home/neubert/devops/containers/common/etc/php not, so build fail, you have to in some way assure the real targe also in build context.

How to solve EACCES: permission denied, mkdir 'build/..' - Docker + Ubuntu

I am using this docker file to setup a server at Digital Ocean. I am getting the following errors
EACCES: permission denied, mkdir 'build/emails'
api_1_5a1c41662228 | EACCES: permission denied, mkdir 'build/routes'
api_1_5a1c41662228 | EACCES: permission denied, mkdir 'build/schema'
api_1_5a1c41662228 | EACCES: permission denied, mkdir 'build/utils'
api_1_5a1c41662228 | EACCES: permission denied, open 'build/Context.js'
and so on for a long time.
I have tried the following things
Chown almost everything there is to be.
Tried it on the different versions of OS
Read various blogs about Docker and giving it root access and tried those solutions.
I am using the most recent version of docker.
P.S. It runs perfectly on Mac. Sadly there are no Mac servers.
More info
ls -ltr on the folder
[root#relay-server-centos fusionauth-relay]# ls -ltr /usr/src/
total 0
drwxr-xr-x. 2 1001 1001 6 Apr 11 2018 kernels
drwxr-xr-x. 2 1001 1001 6 Apr 11 2018 debug
drwxr-xr-x. 3 1001 1001 19 Apr 5 11:24 app
I was able to resolve it right now using the root user, which is a really horrible way to do it. But I am out of ideas right now and any help would be welcomed.

Error on docker run

i'm having a problem when i do docker run on a image that i created using this dockerfile:
FROM node
WORKDIR /Saiph
EXPOSE 3000
ENTRYPOINT ["npm", "start"]
COPY . /Saiph
RUN npm install
The error is this:
PS D:\saiph> docker run 1ba8ca0d9b3b
npm info it worked if it ends with ok
npm info using npm#5.3.0
npm info using node#v8.4.0
npm info lifecycle saiph#1.0.0~prestart: saiph#1.
npm info lifecycle saiph#1.0.0~start: saiph#1.0.0
> saiph#1.0.0 start /Saiph
> cd server && node server
sh: 1: cd: can't cd to server
npm info lifecycle saiph#1.0.0~start: Failed to e
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! saiph#1.0.0 start: `cd server && node server`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the saiph#1.0.0 start script.
I've tried to understand the error but i didn't understand it,
Sorry about my bad english,
Thanks
You issue is the difference between Windows and Linux file system. In windows if a folder named Server exists then you can use cd server or cd Server and it would work.
Linux is case sensitive. So either change your script to use the specific case or rename the folder from Server to server. You will need to do the same thing in code also to rename requires and other file related things to exact case
#TarunLalwani
PS D:\seith> docker run 15027498053c ls -al
total 72
drwxr-xr-x 1 root root 4096 Sep 9 19:15 .
drwxr-xr-x 1 root root 4096 Sep 9 19:16 ..
drwxr-xr-x 7 root root 4096 Sep 9 00:41 .git
-rwxr-xr-x 1 root root 6222 Sep 9 00:40 .gitignore
drwxr-xr-x 4 root root 4096 Sep 9 16:29 .vs
drwxr-xr-x 2 root root 4096 Sep 8 22:55 Client
drwxr-xr-x 3 root root 4096 Sep 9 00:38 Database
-rwxr-xr-x 1 root root 92 Sep 9 19:15 Dockerfile
-rwxr-xr-x 1 root root 1089 Sep 9 00:37 LICENSE
drwxr-xr-x 3 root root 4096 Sep 9 00:38 Server
drwxr-xr-x 76 root root 4096 Sep 9 16:29 node_modules
-rwxr-xr-x 1 root root 18807 Sep 9 19:15 package-lock.json
-rwxr-xr-x 1 root root 368 Sep 9 16:29 package.json

Error Resolving User Permissions + Zsh Command Not Found

This is the list of user permissions after logging them to the terminal:
➜ ~ ls -ld / /usr /usr/bin /usr/bin/manpath
drwxr-xr-x 33 root wheel 1190 Nov 14 08:49 /
drwxr-xr-x# 11 root wheel 374 Nov 7 09:12 /usr
drwxr-xr-x 1055 root wheel 35870 Nov 12 11:34 /usr/bin
lrwxr-xr-x 1 root wheel 3 Nov 5 18:13 /usr/bin/manpath -> man
And this is the error I receive when trying to update the permissions:
➜ ~ chmod 755 / /usr /usr/bin /usr/bin/*
chmod: Unable to change file mode on /usr/bin/apropos: Operation not permitted
chmod: Unable to change file mode on /usr/bin/at: Operation not permitted
This all began as an effort to debug the following zsh error:
zsh: command not found
I have tried resetting my $PATH variable to no avail. I've uninstalled and reinstalled zsh, run brew doctor, reinstalled node, etc. and am unsure where to proceed from here. The problems I am trying to fix are two-fold:
fix the PATH so that I can use commands (e.g.: ionic) from the
terminal
fix the permissions so I don't encounter any further
errors as I troubleshoot going forward
Can anyone offer guidance? Been trying to debug this for hours.
This my current PATH:
➜ ~ echo $PATH
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Debug docker script more efficiently

I'm getting started on my first docker script and i'm trying to debug the last step and it's very slow debugging b/c the steps before it take a few minutes to run so if i have a typo, i have to re run the entire script.
Is there a more efficient way to debug a docker script? or do i have to rebuild the whole thing every time?
#FROM ubuntu:14.04
FROM node:0.10.40
#FROM mongo:2.6.11
# The port we're running the server on
EXPOSE 10645
# Set this as the working directory
WORKDIR /myproject/hapi
# Move the myproject files to /myproject in the docker container
ADD . /myproject/hapi
# Install the server dependencies
RUN pwd && ls -al && npm install
# Start everything up
CMD npm start
Log output:
^CR5033505:myproject m089269$ docker build -t myproject-hapi .
Sending build context to Docker daemon 932.2 MB
Step 0 : FROM node:0.10.40
---> a7d8016a6fdb
Step 1 : EXPOSE 10645
---> Running in ebc4f8ebbf7b
---> 701320586e6a
Removing intermediate container ebc4f8ebbf7b
Step 2 : WORKDIR /myproject/hapi
---> Running in 1998f97b252a
---> 1414baf38920
Removing intermediate container 1998f97b252a
Step 3 : ADD . /myproject/hapi
---> c80e665da20b
Removing intermediate container f6904fab79ce
Step 4 : RUN pwd && ls -al && npm install
---> Running in a3ef28ed70ae
/myproject/hapi
total 68
drwxr-xr-x 9 root root 4096 Oct 30 18:35 .
drwxr-xr-x 3 root root 4096 Oct 30 18:35 ..
-rw-r--r-- 1 root root 509 Apr 10 2015 .editorconfig
drwxr-xr-x 8 root root 4096 Oct 30 18:33 .git
-rw-r--r-- 1 root root 491 Oct 20 15:09 .gitignore
drwxr-xr-x 8 root root 4096 Aug 19 14:51 .idea
-rw-r--r-- 1 root root 1781 Apr 10 2015 .jscsrc
-rw-r--r-- 1 root root 6164 Apr 10 2015 .tfignore
-rw-r--r-- 1 root root 430 Oct 30 18:33 Dockerfile
-rw-r--r-- 1 root root 371 Oct 30 18:16 Dockerfile-client
-rwxr-xr-x 1 root root 1374 Oct 30 15:15 README.md
drwxr-xr-x 5 root root 4096 Oct 21 21:18 ab-testing-deploy
drwxr-xr-x 3 root root 4096 Oct 30 15:15 build
drwxr-xr-x 14 root root 4096 Oct 30 15:15 client
drwxr-xr-x 2 root root 4096 Apr 10 2015 githooks
drwxr-xr-x 10 root root 4096 Oct 30 15:15 hapi
npm ERR! install Couldn't read dependencies
npm ERR! Linux 4.1.10-boot2docker
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.40
npm ERR! npm v2.14.1
npm ERR! path /myproject/hapi/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR! package.json ENOENT, open '/myproject/hapi/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! Please include the following file with any support request:
npm ERR! /myproject/hapi/npm-debug.log
The command '/bin/sh -c pwd && ls -al && npm install' returned a non-zero code: 34
Unfortunately when you're doing your ADD command you're invalidating the docker build cache, so any commands after that will be run from scratch. From the docs:
Note: The first encountered ADD instruction will invalidate the cache for all following instructions from the Dockerfile if the contents of have changed. This includes invalidating the cache for RUN instructions.
https://docs.docker.com/reference/builder/#add
I think in this case it would be easiest to run an interactive container and run each command from your Dockerfile one by one so you can see which one fails and be in a position to run it again immediately after you attempt to fix the error.
For example:
docker run -ti -v /path/to/your/code:/myproject/hapi node:0.10.40 bash
$ cd /myproject/hapi
$ npm install
Then when you do an ls -la you'll be able to see that package.json either isn't there or something else is wrong, and once you've figured it out you can add that command into your Dockerfile.

Resources