Ack: permission denied outputs along with results - grep

when I ack something I often get output like this:
Ack: tmp/nonces/4e8c9698-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-mRPtTixYnWzzGcPpbIwx9scpDnE: Permission denied
Ack: tmp/nonces/4e8cbba9-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-oARiyZ2BwCEskqiPzrfQd1FI_fI: Permission denied
Ack: tmp/nonces/4e8d0b16-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-M8ARATBrrCt8Dzx_AUVyqQPlesE: Permission denied
Ack: tmp/nonces/4e8df921-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-qOogYRrIy2P4eFSD0dps0axw41k: Permission denied
Ack: tmp/nonces/4e8f25a5-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-.gfEmcarFxfuir1JeQeKjevK4Js: Permission denied
Ack: tmp/nonces/4e8f66ac-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-A_iNHhXoUELEWtENxyYp8H_HsJA: Permission denied
Ack: tmp/nonces/4e8f6ad6-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-xISGU82nDE6h.hGAKD7t8kfP3f0: Permission denied
Ack: tmp/nonces/4e8f6c43-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-8_4stPggeXhICZbspC7n3JPbbwU: Permission denied
Ack: tmp/nonces/4e9021f8-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-4LlZ.TfExXsf3L2woyFw9.LJF1U: Permission denied
Ack: tmp/nonces/4e90964d-https-www.google.com-kkEIoIiSEjUBRD.lRR_tT9V6ccE-MQcsEojzduPoDsosj.gnN5jPrmQ: Permission denied
What is this and how can I fix it/make it go away?
EDIT: this only happens in the MacVim output when I use the Ack plugin. Normal Ack does not do this.

The /tmp directory is going to be used by users other than you , and you won't have permission to read those files or directories (even if you're the only one using the machine, various root processes will still use the /tmp dir). There doesn't seem to be an ack option to not complain about permission problems, so you just have to discard those lines. An easy way is to just throw out everything ack prints to stderr, like so:
alias ack='ack $* 2> /dev/null'
However, that will discard all ack errors. To just discard the "Permission denied" errors requires a bit more work. Assuming you're using bash as your shell, put this into your ~/.bash_aliases file:
function ack_discard_perm_errs()
{
\ack --color $* 2>&1 | grep -v "Permission denied"
}
alias ack='ack_discard_perm_errs $*'

Related

Jupyterlab in Docker - Permission demined error on Linux to due to Jupyter not generating .local/share directory

Objective: Currently creating a dockerfile using jupyter/base-notebook, and I want to make sure that my environment can run in Windows, macOS, and Linux.
Issue: In theory, docker should not have an issue running in any OS. However, I encountered a following permission denied error when I was running on Linux:
pwd
+ docker run -it --rm -p 8888:8888 -v /home/<username>/myDocker:/home/jovyan myDocker:latest
[I 2022-07-18 18:01:42.359 ServerApp] jupyterlab | extension was successfully linked.
[W 2022-07-18 18:01:42.363 NotebookApp] 'ip' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2022-07-18 18:01:42.364 NotebookApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2022-07-18 18:01:42.364 NotebookApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2022-07-18 18:01:42.371 ServerApp] nbclassic | extension was successfully linked.
[W 2022-07-18 18:01:42.372 ServerApp] [Errno 13] Permission denied: '/home/jovyan/.local/share'
Traceback (most recent call last):
File "/opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py", line 645, in get
value = obj._trait_values[self.name]
KeyError: 'runtime_dir'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/bin/jupyter-lab", line 10, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 584, in launch_instance
serverapp = cls.initialize_server(argv=args)
File "/opt/conda/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 554, in initialize_server
serverapp.initialize(
File "/opt/conda/lib/python3.10/site-packages/traitlets/config/application.py", line 110, in inner
return method(app, *args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/jupyter_server/serverapp.py", line 2462, in initialize
self.init_configurables()
File "/opt/conda/lib/python3.10/site-packages/jupyter_server/serverapp.py", line 1865, in init_configurables
connection_dir=self.runtime_dir,
File "/opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py", line 686, in __get__
return self.get(obj, cls)
File "/opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py", line 648, in get
default = obj.trait_defaults(self.name)
File "/opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py", line 1752, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "/opt/conda/lib/python3.10/site-packages/jupyter_core/application.py", line 106, in _runtime_dir_default
ensure_dir_exists(rd, mode=0o700)
File "/opt/conda/lib/python3.10/site-packages/jupyter_core/utils/__init__.py", line 12, in ensure_dir_exists
os.makedirs(path, mode=mode)
File "/opt/conda/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/opt/conda/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/opt/conda/lib/python3.10/os.py", line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/jovyan/.local/share'
Where the main culprit of this is that .local/share is not being generated upon running dockerfile when ran on Linux (Ubuntu and RedHat). Surprisingly, when I run this on my Windows (via WSL2 - Ubuntu) and on macOS, it does generate .local/share and does not get this error.
Setup: My dockerfile looks something like this:
FROM jupyter/base-notebook:latest
USER root
USER jovyan
RUN set -ve
USER jovyan
EXPOSE 8888
ENTRYPOINT jupyter lab --no-browser --allow-root
*Note: My dockerfile has more content, but commented out most of them for debugging purpose.
Commands that I am using to build & run above dockerfile is following:
docker build -f <path_to_dockerfile> -t myDocker:latest .
docker run -it --rm -p 8888:8888 -v $(pwd):/home/jovyan myDocker:latest
Even after testing with above minimalistic dockerfile, Windows version would still generate the .local/share/... while giving me the permission denied error on Linux.
What I've tried:
So far, I've tried manually generating .local/share, which would get another permission denined error since it needs an additional directories (.local/share/jupyter/runtime/...).
New error looks something like this:
# new error 1
[I 2022-07-18 18:38:01.260 ServerApp] Writing Jupyter server cookie secret to /home/jovyan/.local/share/jupyter/runtime/jupyter_cookie_secret
[E 2022-07-18 18:38:01.260 ServerApp] Failed to write cookie secret to /home/jovyan/.local/share/jupyter/runtime/jupyter_cookie_secret: [Errno 13] Permission denied: '/home/jovyan/.local/share/jupyter/runtime/jupyter_cookie_secret'
/opt/conda/lib/python3.10/site-packages/IPython/paths.py:70: UserWarning: IPython parent '/home/jovyan' is not a writable location, using a temp directory.
warn("IPython parent '{0}' is not a writable location,"
# new error 2
[E 2022-07-18 18:38:01.580 ServerApp] Failed to write server-info to /home/jovyan/.local/share/jupyter/runtime/jpserver-1.json: [Errno 13] Permission denied: '/home/jovyan/.local/share/jupyter/runtime/jpserver-1.json'
Generating jpserver-1.json manually will still yield a permission error.
Additionally, I've used ls -la to check the permission status of every directory I have, and they all have same permission setting.
I've also referenced post with similar issue and used chown like following:
chown -R jovyan:users ~/.local/share/jupyter
but this did not solve issue as permission denied error comes from non-existing directories/files.
Question: What would I need to do so that Linux would generate .local/share/... to prevent permission denied error? Preferably, I would like to avoid generating .local/share/... manually.
Thank you in advance for your help.
Small Update:
I've tried manually creating all missing files, such as:
.local/share/jupyter/runtime/jpserver-#.jp
.local/share/jupyter/runtime/jupyter_cookie_secret
and provided additional permission using:
chmod -R 777 .local/share/
and ran this whole thing, and it started working. However, it doesn't perfectly work as in it's still not generating essential directory, such as .jupyter.
Furthermore, I'd like to avoid this method as # in jpserver-#.jp is randomly generated, thus I won't be able to automatically generate these essential directories.
My speculation is that it's a path issue where jupyter is automatically generating essential directory, such as .local/share, .jupyter, etc. into different location.
Not the best solution, but I found a workaround in case anyone has the same issue:
Essentially, what I did was I gave full access to a directory that I'm working on, i.e.
sudo chmod -R 777 <top_of_directory>
From a security standpoint, this may not be the most optimal solution, but neither 755 nor running them via sudo -s did not work for some reason.
Please note that while this solution is satisfactory for my case, it may not be the best solution for someone with same issue.

Error in CMD ["supervisord", "-c", "/etc/supervisor.conf"] and USER non-root [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I need to run docker container always non-root user also under the supervisor.conf all services need to up status but still getting following error
Traceback (most recent call last):
File "/usr/bin/supervisord", line 11, in
load_entry_point('supervisor==4.1.0', 'console_scripts', 'supervisord')()
File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 358, in main
go(options)
File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 368, in go
d.main()
File "/usr/lib/python3/dist-packages/supervisor/supervisord.py", line 70, in main
self.options.make_logger()
File "/usr/lib/python3/dist-packages/supervisor/options.py", line 1466, in make_logger
loggers.handle_file(
File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 417, in handle_file
handler = RotatingFileHandler(filename, 'a', maxbytes, backups)
File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 213, in init
FileHandler.init(self, filename, mode)
File "/usr/lib/python3/dist-packages/supervisor/loggers.py", line 160, in init
self.stream = open(filename, mode)
PermissionError: [Errno 13] Permission denied: '/supervisord.log'
My requirement is must login container as a non root user and after docker run will be running all service in supervisor.conf. I need non root user only normal user and don't have any type of access.
Dockerfile last 3 line
RUN useradd -m nonroot && echo "nonroot:nonroot123" | chpasswd
USER nonroot
CMD ["supervisord", "-c", "/etc/supervisor.conf"]
The error shows that your supervisord running as a non-privileged user is not allowed to write to a file directly under / -> /supervisord.log
As per the supervisord documentation, the log path defaults to supervisord.log in the current working directory, and is configurable via:
the logfile parameter in the [supervisord] section of the configuration file, defaulting to $CWD/supervisord.log.
You have two options here:
Change the container's default working directory to a path where your non-root user has full permissions, using the WORKDIR Dockerfile command. You should probably do this anyway as you're running it with a non-privileged user
Edit /etc/supervisor.conf, setting a writable path for the log

Jenkins does not abort on SVN error E175002

I am calling svn ls from Jenkins on a SVN directory to get a list of paths that match a certain pattern (that I later process further).
Maybe not very nice, but this is currently how it works:
def proc = bat (returnStdout: true, script: '#svn ls https://path/to/my/repo/trunk -R --trust-server-cert-failures=unknown-ca --non-interactive | findstr /R "^[^_].*_src/$" | findstr /R "^FolderA ^FolderB" | findstr /V "_test"').trim()
Problem
Sometimes due to connection issues the svn ls command fails and the Jenkins job aborts (which is perfectly ok because it is the expected behavior.
Sometimes however, it seems that only some folders / sub-folders are not accessible temporarily and I get an error message, but it seems not an error signal from the svn ls:
svn: E175002: Unexpected server error 500 'Internal Server Error' on 'path/to/a/folder
This is a problem, because the pipeline does not abort, but continues and the content of proc only contains parts of the result, but not the full result.
Is there any way to detect this case where the error occurs? Please note, that not the occurrance of the E175002 error is my problem, but its detection.

Error running ghost on Windows 10

I installed ghost and ghost-CLI on Windows 10. When I run ghost start I get the error below. how to fix this? It seems related to the command to check file and folder permissions. Note that I'm running ghost in the D: drive.
By the way, if I run ghost run it works.
D:\onlinehelp>ghost start
Process manager 'systemd' will not run on this system, defaulting to 'local'
√ Checking current folder permissions
√ Validating config
× Checking folder permissions
× Checking file permissions
√ Checking memory availability
One or more errors occurred.
1) Checking folder permissions
Message: Command failed: C:\WINDOWS\system32\cmd.exe /q /s /c "find ./ -type d ! -perm 775 ! -perm 755"
FIND: Parameter format not correct
Exit code: 2
2) Checking file permissions
Message: Command failed: C:\WINDOWS\system32\cmd.exe /q /s /c "find ./ -type f ! -path "./versions/*" ! -perm 664 ! -perm 644"
File not found - ./
File not found - -TYPE
File not found - F
File not found - !
File not found - -PATH
File not found - !
File not found - -PERM
File not found - 664
File not found - !
File not found - -PERM
File not found - 644
Exit code: 1
Debug Information:
OS: Microsoft Windows, v10.0.16299
Node Version: v8.9.1
Ghost-CLI Version: 1.7.2
Environment: production
Command: 'ghost start'
Additional log info available in: C:\Users\pablo\.ghost\logs\ghost-cli-debug-2018-05-01T16_58_30_857Z.log
Try running ghost doctor to check your system for known issues.
Please refer to https://docs.ghost.org/v1/docs/troubleshooting#section-cli-errors for troubleshooting.
D:\onlinehelp>
This isn't an ideal solution but it worked for me.
Ghost uses linux's find command to check permissions, this command does not exist on windows (or at least the windows find command does not accept the same arguments.
I was pretty sure my permissions were fine, so I decided to bypass the check.
To do so, locate where ghost-cli is installed globally, in my case it was
C:\Users\your-name-here\AppData\Roaming\npm\node_modules\ghost-cli
In there, you want to find lib\commands\doctor\checks\check-permissions.js
you will notice a line that starts with
return execa.shell(
This is the line we want to avoid, to do so, we can return a result before it is run, in my case I added the line return Promise.resolve();
e.g.
return Promise.resolve();
return execa.shell(checkTypes[type].command, {maxBuffer: Infinity}).then((result) => {
...

Installing pow rack server from source on 32bit CPU

Found out about pow just now and trying to install it on a laptop with a 32bit processor. I am running into (hopefully) a minor error.
During the installation from source I get the following error:
*** Installing local configuration files...
mkdir: /Users/username/Library/Application Support: Permission denied
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Command failed: mkdir: /Users/username/Library/Application Support: Permission denied
at ChildProcess.exithandler (child_process.js:102:15)
at ChildProcess.emit (events.js:67:17)
at Socket.<anonymous> (child_process.js:172:12)
at Socket.emit (events.js:64:17)
at Array.<anonymous> (net.js:837:12)
at EventEmitter._tickCallback (node.js:126:26)
pow#0.3.2 /usr/local/lib/node_modules/pow
├── log#1.2.0
├── async#0.1.8
├── coffee-script#1.1.2
├── nack#0.13.1 (netstring#0.2.0)
└── connect#1.7.1
I have tried to change the permissions on the application support folder using:
sudo chmod 777 ~/Library/Application\ Support/
and can verify the permissions using:
ls -la ~/Library/ | less
I get the following:
drwxrwxrwx+ 15 username blah 510 26 Sep 19:16 Application Support
Can anyone point me in the right direction as I seem to have hit a brick wall thanks
From completly unrelated git issue:
sudo chown -R $USER /usr/local/
& then run install without sudo
npm -g install
Worked for me...

Resources