How to prevent GCP Cloud Shell from automatic popping up in console every time I open a page - google-cloud-platform

Some time ago (a month or more) GCP Cloud Shell started to show up automatically every time I opened a page (some GCP page). It says it's reconnecting to the existing service. It happens even if I close the one on my first page. Then when I open a new page (for example, with Ctrl + Mouse Left Click in windows in Chrome) the Cloud shell automatically opens up again.
I would like Cloud Shell on the new page to be open only if I manually open it. Maybe I need to configure something somewhere. It's also bad because it uses the available quota for Cloud Shell, decreasing it without my will.
How is it possible to achieve that and disable auto-opening of GCP Cloud Shell?

Look at the URL in your browser. most probably you will find &cloudshell=true appended to it. remove that part and you should be fine.
Note:
When you open cloudshell. the mentioned part is appended with the value true. and when you close it, its value becomes false. if you have issues with that then most probably it's something with your browser.

Related

Google Cloud shell appears to be hanging on provisioning

Anyone else having issues with Cloud Shell this morning? -- My first time working in GCP and when I clicked on cloud shell, the process appears to be hanging at the provisioning stage. According to the docs, this should only take a minute, but I've been waiting more than 20 minutes now and it's still spinning with no apparent progress.
I thought it might have been blocking some process (thank you uBlock origin), but reloading the page with uBlock turned off, I see the same behavior.
Thoughts?
This issue is hard to investigate/track since no error appeared, sometimes related to Cloud Shell location/region. I may suggest to troubleshoot by doing any steps below:
In the Cloud Shell menu, click the three dots menu icon, then click Restart Cloud Shell. Click Restart Cloud Shell in the confirmation dialog.
Add the following in the address bar in Cloud Shell URL so it will open the shell in the safe mode then click the three dots menu icon and click Restart.
&cloudshellsafemode=true
Try to restart the browser or you can try to access or open the Cloud Shell with a different browser.
Try the browser incognito mode.
If the Cloud Shell still does not open, as a workaround, I recommend to install the Cloud SDK to your machine to access your GCP resources.
If all the steps above doesn't work, I'll recommend to contact Google Cloud Platform Support or create a Public Tracker Issue to further investigate this kind of issue.

Google Cloud VM Files Deleted after session disconnect

I am having some of my GCP instances behave in a way similar to what is described in the below link:
Google Cloud VM Files Deleted after Restart
The session gets disconnected after a small duration of inactivity at times. On reconnecting, the machine is as if it is freshly installed. (Not on restarts as in the above link). All the files are gone.
As you can see in the attachment, it is creating the profile directory fresh when the session is reconnected. Also, none of the installations I have made are there. Everything is lost including the root installations. Fortunately, I have been logging all my commands and file set ups manually on my client. So, nothing is lost, but I would like to know what is happening and resolve this for good.
This has now happened a few times.
A point to note is that if I get a clean exit, like if I properly logout or exit from the ssh, I get the machine back as I have left, when I reconnect. The issue is there only when the session disconnects itself. There have been instances where the session disconnected and I was able to connect back as well.
The issue is not there on all my VMs.
From the suggestions from the link I have posted above:
I am not connected to the cloud shell. i am taking ssh of the machine using the chrome extension
Have not manually mounted any disks (afaik)
I have checked the logs from gcloud compute instances get-serial-port-output --zone us-east4-c INSTANCE_NAME. I could not really make much of it. Is there anything I should look for specifically?
Any help is appreciated.
Please find the links to the logs as suggested by #W_B
Below is from 8th when the machine was restarted and files deleted
https://pastebin.com/NN5dvQMK
It happened again today. I didn't run the command immediately then. The below file is from afterwards though
https://pastebin.com/m5cgdLF6
The below one is after logout today.
[4]: https://pastebin.com/143NPatF
Please note that I have replaced the user id, system name and a lot of numeric values in general using regexp. So, there is a slight chance that the time and other values have changed. Not sure if that would be a problem.
I have added the screenshot of the current config from the UI
Using locally attached SDD seems to be the cause ... here it is explained:
https://cloud.google.com/compute/docs/disks/local-ssd#data_persistence
You need to use a "persistent disk" - else it will behave just as you describe it.

Error when trying to connect to a Cloud SQL instance using the Cloud Shell

I've had a Cloud SQL instance for about a year now.
I always accessed it the same way:
I would go to my project on the Cloud Console.
Click on the Cloud Shell icon at the top right (a small right pointing arrow).
A black shell screen would pop up where I would type
gcloud sql connect <my instance> --user=root.
Enter my password.
Now, all of a sudden, I am getting an error message saying:
There was no instance found at projects//instances/ or you are not authorized to connect to it.
I am the owner of the project, and also have Admin rights to the Cloud SQL instance. The project and instance are still there, and my app that accesses the data stored in the instances' database is working fine - therefore I know the database is also present, otherwise my app wouldn't work.
I didn't touch or change anything in the Cloud SQL instance. Suddenly, I simply can't access my database using the exact same procedure I have been using almost every day over the past year now.
I am able to access the database using a local Python script on my laptop and the Cloud SQL Proxy, but I would like to access it from the Cloud Shell again.
Any ideas on what could the problem be?
gcloud components update - update all of your installed components to the latest version
gcloud init - reinitialize gcloud shell. It performs the following setup steps:
Authorizes gcloud and other SDK tools to access Google Cloud Platform using your user account credentials, or from an account of your choosing whose credentials are already available.
It seems like there was a problem with the GCP Cloud Shell (even though there was no mention of it on the GCP error tracking page). When I logged back in today and followed the same above process everything worked well.
Looks like GCP Cloud Shell could occasionally go rouge and start producing errors. Word of advice, don't panic when this happens (like I did) and start resetting, rebooting and messing up things. Just wait a day and check back again.

Browser drops connection during model training

I am currently trying to go through a fairly long hyperparameter grid search (4-5 hours) and I keep having issues with Jupyter Lab (or haven't figured out something yet) on a gcp notebook instance. The browser connection to the notebook keeps dropping, whereas the training process continues just fine. When it finishes training process, there's nowhere to write the output as the browser connection to the notebook has already dropped.
How can I keep that connection alive or make sure the output gets written into the notebook even if my laptop gets turned off/gets turned off?
There are multiple problems that may be affecting your notebook. It can be a GCP issue, a network issue... Therefore, you need to provide more information in order to diagnose what is happening. I would recommend you to open a ticket with GCP or Jupyter support to conduct a more thorough investigation as it can be something difficult to diagnose and they will have more tools to do it. Also, what #Joaquim suggested seems like a good workaround for the moment. Anyhow, I have gathered several troubleshooting steps that you can follow to find if it is one of this recurrent issues the one that is affecting you:
According to this Jupyter Notebook document, there is a ‘shutdown_no_activity_timeout’ option. The default value is ‘0’ that disables this automatic shutdown. The option might be overridden on ‘jupyter_notebook_config.py’ file. You may follow these steps to confirm it:
Click on the instance name of in which your Notebook is running on the AI Platform Notebooks page.
Remote access it by clicking “SSH”
Run this on the shell to confirm the existence of the overriding:
ls /home/*/.jupyter/jupyter_notebook_config.py
Run this command to confirm if the shutdown_no_activity_timeout option is doing the overriding:
cat /home/*/.jupyter/jupyter_notebook_config.py | grep shutdown_no_activity_timeout
Switch the option to ‘0’ if it is set to a different value, and reset the Notebook instances on this page to apply the change.
According to this other document, it might fail to connect when behind a proxy. You can try to disable your browser’s proxy settings.
You can also try to change the Jupyter port. On this Jupyter issue, the customer insists that his disconnection problem was gone after changing it. If you are using Chrome browser, could you please open the Inspect panel (Ctrl+Shift+I) and compare your connection symptoms with this image? If you get similar errors, you may try to change the port (c.NotebookApp.port).

Google Cloud Project won't delete

I made a Google Cloud project to test a few things out. The main one being DataPrep. Then I decided I'd do something else for a bit and tried to delete the project.
I opened up the Google Cloud Shell and typed:
gcloud projects delete <project_name>
and then typed Y for Yes and now it is just hung there doing nothing at all. It doesn't really matter I guess but it is annoying having an old project hanging around I can't get rid of.
I've tried with billing enabled and disabled but neither seem to make a difference. I was using the shell from within the Console website by the way.
Does anyone have any idea why it is taking so long to delete this project?
I think you should follow these steps
To shut down a project using the Cloud Platform Console:
Open the Settings page in the Google Cloud Platform Console.
Click Select a project.
Select a project you wish to delete
and click Open.
Click Delete Project.
Enter the Project ID and click Shut down.