gcloud components update permission denied - google-cloud-platform

All of a sudden I started getting "Permission Denied" issues when trying to run any gcloud commands such as gcloud components update -- the issue was avoided if I ran sudo gcloud components update but it's not clear to my why the sudo command is suddenly required? I have actually been trying to run a GCMLE experiment and it had the same error/warning, so I tried updating components and still ran into this issue. I have been travelling for a couple days and did not make any changes since these same commands worked a few days ago. Further, I did not changed my OS (Mac High Sierra 10.13.3) -- were there any changes on the Google side that might explain this change in behavior? What is the best course of action to permanently get around this warning?
(conda-env) MacBook-Pro:user$ gcloud components update
WARNING: Could not setup log file in /Users/$USERNAME/.config/gcloud/logs, (IOError: [Errno 13] Permission denied: u'/Users/$USERNAME/.config/gcloud/logs/2018.03.10/XX.XX.XX.XXXXXX.log')
after sudo gcloud components update I was able to kick off a GCMLE experiment, but I also get the same warning (though my job now submits successfully).
WARNING: Could not setup log file in /Users/#USERNAME/.config/gcloud/logs, (IOError: [Errno 13] Permission denied: u'/Users/$USERNAME/.config/gcloud/logs/2018.03.10/XX.XX.XX.XXXXXX.log')

Based on an answer to a similar question, you probably need to change the permissions to the appropriate directories:
sudo chown -R $USER ~/.config/gcloud
That same post suggests that permissions may have gotten out-of-whack by running a gcloud command with sudo.

In most cases, the problem is not caused by the ~/.config/gcloud directory but the installation directory of gcloud which is owned by root:
drwxr-xr-x 20 root staff 640 Jun 20 18:22 google-cloud-sdk
Solution:
You must change permissions for that directory to your user from:
by:
sudo chown -R $USER /Users/$USER/bin/google-cloud-sdk

Related

Prettier does not ignore a folder that have root permissions

In my project we have a docker folder that we use to run the container. The issue is that when we run prettier i got this error:
[error] Unable to expand directory: .
[error] EACCES: permission denied, scandir '/home/nanez/my-project/docker/data/postgres'
This folder need root permissions to access and delete it (using sudo ofc). I already added the whole docker folder to .prettierignore and also the specific postgres folder and i still throwing the error. Here my .prettierignore:
## Deps
node_modules
cache
generated
docker
./docker
/docker/**/*
/docker/*
/docker/data/postgres
As you can see, I added the docker folder with all the posibilities that I thought.
If I run prettier with the negative pattern work good, for ex: npx prettier . '!./docker' --check. This run all without problem, but I'm wonder why I can't ignore directly with npx prettier . --check if already I have the docker folder in the .prettierignore.
I'm using WSL2 with Ubuntu 20.04LTS.
Thanks :)

JupyterLab : cannot save notebook. "File > save notebook" greyed out. Auto save and Cmd + S also doesn't work

JupyterLab is in a gcp Deep learning vm.
Since few hours ago I can't save any changes in JupyterLab.
There are unsaved changes.
save notebook greyed out.
Also, if I try to delete a file from the left pane, it gives a 500 error.
The only change I recall making prior to this breaking is this. I had this error when I tried to do git operations in the command line.
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
Therefore I did this
rm -f ./.git/index.lock
And the git command worked correctly. This the only thing I recall doing prior to this error.
Afterwards, I deleted the repository and recloned it.
And since I had to type sudo everytime I had the user claim the jupyter directory. But this error was there before I made this change.
udo chown your_username directory
Somehow group permissions for jupyter directory has changed to read and execute only. Simply adding write permissions solved this.
drwxr-xr-x 13 praveen jupyter 4096 Feb 9 11:46 jupyter
Command
chmod 771 /home/jupyter/
this has been useful to me :
chmod -R 777 /folder_name. The -R (or --recursive) options make it recursive.
Or if you want to make all the files in the current directory have all permissions type:
chmod -R 777 ./
Reference

Initd permission denied

I'm new to Linux and AWS I'm trying to set up an initd script as this code in this gist but getting the following error message, which I think related to permissions but I don't understand what thing needs permissions where.
env: /etc/init.d/geoserver: Permission denied
I've tried the following to resolve it;
[ec2-user#ip-xxx init.d]$ sudo chmod +x geoserver start
[ec2-user#ip-xxx init.d]$ service geoserver start
Starting geoserver...
/etc/init.d/geoserver: line 33: /run/geoserver.pid: Permission denied
EDIT: The machine is AWS Linux 2 RHEL 7.6 Maipo

E: Malformed entry 7 in list file /etc/apt/sources.list.d/google-cloud-sdk.list (Suite) E: The list of sources could not be read

Getting this error when trying to sudo apt-get update. E: Malformed entry 7 in list file /etc/apt/sources.list.d/google-cloud-sdk.list (Suite)
E: The list of sources could not be read.
I tried to run sed to remove and no luck.
Please help.
Okay, after following the first 5 steps in the link: cloud.google.com/sdk/docs/quickstart-debian-ubuntu I received the following output:
Your Google Cloud SDK is configured and ready to use!
Commands that require authentication will use cloud#postaprayer.org by default
Commands will reference project post-a-prayer by default
Compute Engine commands will use region us-west2 by default
Compute Engine commands will use zone us-west2-a by default
Run gcloud help config to learn how to change individual settings
This gcloud configuration is called [postaprayerdns]. You can create additional configurations if you work with multiple accounts and/or projects.
Run gcloud topic configurations to learn more.
Some things to try next:
Run gcloud --help to see the Cloud Platform services you can interact with. And run gcloud help COMMAND to get help on any gcloud command.
Run gcloud topic --help to learn about advanced features of the SDK like arg files and output formatting
Okay. I was able to get into the google-cloud-sdk.list file and edit it using sudo nano /etc/apt/sources.list.d/google-cloud-sdk.list
From there I edited the .list file and deleted line 7 (which stated clear)
I edited these instructions to solve this error: https://askubuntu.com/questions/332669/unable-to-edit-etc-apt-sources-list-file
sudo nano /etc/apt/sources.list.d/google-cloud-sdk.list
`
Solved. Used Nano command to edit *.list file, deleted corrupt entry 7, and then saved.
Summary:
sudo nano /etc/apt/sources.list.d/google-cloud-sdk.list
From there I edited the .list file and deleted line 7 (which stated clear)
I edited these instructions to solve this error: https://askubuntu.com/questions/332669/unable-to-edit-etc-apt-sources-list-file
sudo nano /etc/apt/sources.list.d/google-cloud-sdk.list

Cannot chmod file on Openshift online v3 : Operation not permitted

I am migrating a Django application from Openshift v2 to v3 (In case you don't know, RedHat is shutting down v2 on September 30th, see: https://blog.openshift.com/migrate-to-v3-v2-eol/)
So, I am following this blog post to help me: https://blog.openshift.com/migrating-django-applications-openshift-3/ . I am new to all these Docker / Kubernetes concepts the new version is build upon.
I was able to make some progress : I managed to get a successful build of my app. Yet it crashes at deployment time:
---> Running application from script (app.sh) ...
/usr/libexec/s2i/run: line 42: /opt/app-root/src/app.sh: Permission denied
Indeed, app.sh has lost its x permission. I log into the failing container as debug and see it:
> oc debug dc/<my app>
> (app-root)sh-4.2$ ls -l /opt/app-root/src/app.sh
-rw-rw-r--. 1 default root 127 Sep 6 21:20 /opt/app-root/src/app.sh
The blog posts states "Ensure that the app.sh file is executable by running chmod +x app.sh.", which I did on my local repo. Whatever, I want to do it again directly in the pod, but it doesn't work:
(app-root)sh-4.2$ chmod +x /opt/app-root/src/app.sh
chmod: changing permissions of ‘/opt/app-root/src/app.sh’: Operation not permitted
So, how can I set the x permission to app.sh ? Thank you
Without looking into more details, any S2I builder image will gladly use your custom supplied run script to start the application in an alternative way.
Create .s2i/bin/ (mind the dot) in your source code directory, place the run script into it and rebuild the app in OpenShift - it will automatically use your custom run script upon deployment.
This is the preferred way of starting applications using custom commands in OpenShift.
Regarding your immediate problem, there is a very simple reason why you can not change the permissions of the script: you were trying to modify the permissions in the deployed pod, and not the builder pod. Deployed pods run using different UIDs, usually somewhere in the range of 100000000, and definitely do not match the file ownership as generated by the build. Hence permission denied.
The root cause of your problem (app.sh losing executable permissions) must be in the way the build process installs those files, and indeed looking at the /usr/libexec/s2i/assemble script in the base image does seem to reveal the culprit. The last two lines are:
# set permissions for any installed artifacts
fix-permissions /opt/app-root
If you wanted to change this part of the build instead of using a custom run script, I suggest you then create .s2i/bin/assemble in your project's source code and make it look sort of like this:
#!/bin/bash
echo "Running stock build:"
${STI_SCRIPTS_PATH}/assemble
echo "Fixing the mess:"
chmod 755 /opt/app-root/src/app.sh
This will fix whatever the stock build process does to file permissions, and will do it using the same UID as the rest of the build, so file ownership shouldn't be an issue.
as I stumbled upon this issue myself I've found a way to resolve it.
You have to make your file app.sh executable and push it in your repo as such.
If git does not track this modification as it did for me, you have to use: git update-index --chmod=+x app.sh for it to work.