Unable to run startup script when creating instance on Google Cloud Platform

Jacobian

I have a simple startup script which looks like so:

#!/usr/bin/env bash
sudo apt update
sudo apt install -y ruby-full ruby-bundler build-essential

And create VM instance on GCP like so:

$ gcloud compute instances create test-app --boot-disk-size=10GB --image-family ubuntu-1604-lts --image-project=ubuntu-os-cloud --machine-type=g1-small --zone europe-west1-b --tags test-server --restart-on-failure --metadata-from-file startup-script=startup.sh

My startup.sh is executable. I set its rights like so:

$ chmod +x startup.sh

When however I enter the shell of my newly created instance and check bundler:

test-app:~$ bundle -v

I get these messages:

The program 'bundle' is currently not installed...

So, what is wrong with that and how can I fix it? PS. If I run all my commands just from inside the instance shell, it's all ok, so there is some problem with using startup script on GCP.

N Singh

I tested with your use case, But the bundle package was installed without making any changes.

Output: bundle -v Bundler version 1.11.2

You can check VM serial console log output to verify if start-up script ran. Check the VM instance to verify if the package is installed using the commands below:

sudo apt list --installed | grep -i bundle
sudo egrep bundle /var/log/dpkg.log

In addition, check the gem list bundle

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Creating an instance template in Google Cloud Platform

From Dev

Save a file in a startup-script on Google Cloud Platform when launching a compute engine

From Dev

Several firewalls when creating Google Cloud Platform instance. Which to use?

From Dev

Google Cloud Platform unable to run long running process when connectivity drops

From Dev

Starting python script on Google Cloud Compute instance startup

From Dev

Trying to run VMWare Workstation on Google Cloud Platform instance?

From Dev

How to automatically run a python script when Google Cloud Compute Instance starts

From Dev

Google Cloud Startup Script Not Running

From Dev

How to access Cloud Platform for a Google Apps Script when the link is missing

From Dev

Why do we need Startup Script in Google Cloud VM Instance Metadata and not in Automation

From Dev

Creating a HTTP load balancer in Google Cloud Platform

From Dev

Unable to run custom script on container startup

From Java

Suspend Google Cloud Platform instance using Java

From Dev

Restrict instance size on Google Cloud Platform Compute

From Dev

What are the instance that are storage optimised in Google cloud platform?

From Dev

Detect google compute instance startup script finished?

From Dev

ImportError with startup script for Google Cloud Compute

From Dev

Unable to delete Google Cloud Platform Project

From Dev

Where to run continuous jobs on Google Cloud Platform?

From Dev

Docker image run error on Google Cloud Platform

From Dev

What happens when a local SSD fails in a Google Cloud Platform compute engine instance?

From Dev

HttpRequestException (403 Forbidden) when creating a Google Cloud Storage SignedUrl (GET), only on Cloud Run

From Dev

Difference between STOP instance and SUSPEND instance in Google Cloud Platform

From Dev

Unable to run script for creating a new table

From Dev

Google cloud how to start service when creating instance using Python api?

From Dev

Got an error "ZONE_RESOURCE_POOL_EXHAUSTED" when creating a new instance on Google Cloud

From Dev

Unable to connect to SSH on Google Cloud VM Instance

From Dev

Creating a DNS forward in Google Cloud Platform with Bind9

From Dev

Creating a bucket using Google Cloud Platform Deployment Manager Template

Related Related

  1. 1

    Creating an instance template in Google Cloud Platform

  2. 2

    Save a file in a startup-script on Google Cloud Platform when launching a compute engine

  3. 3

    Several firewalls when creating Google Cloud Platform instance. Which to use?

  4. 4

    Google Cloud Platform unable to run long running process when connectivity drops

  5. 5

    Starting python script on Google Cloud Compute instance startup

  6. 6

    Trying to run VMWare Workstation on Google Cloud Platform instance?

  7. 7

    How to automatically run a python script when Google Cloud Compute Instance starts

  8. 8

    Google Cloud Startup Script Not Running

  9. 9

    How to access Cloud Platform for a Google Apps Script when the link is missing

  10. 10

    Why do we need Startup Script in Google Cloud VM Instance Metadata and not in Automation

  11. 11

    Creating a HTTP load balancer in Google Cloud Platform

  12. 12

    Unable to run custom script on container startup

  13. 13

    Suspend Google Cloud Platform instance using Java

  14. 14

    Restrict instance size on Google Cloud Platform Compute

  15. 15

    What are the instance that are storage optimised in Google cloud platform?

  16. 16

    Detect google compute instance startup script finished?

  17. 17

    ImportError with startup script for Google Cloud Compute

  18. 18

    Unable to delete Google Cloud Platform Project

  19. 19

    Where to run continuous jobs on Google Cloud Platform?

  20. 20

    Docker image run error on Google Cloud Platform

  21. 21

    What happens when a local SSD fails in a Google Cloud Platform compute engine instance?

  22. 22

    HttpRequestException (403 Forbidden) when creating a Google Cloud Storage SignedUrl (GET), only on Cloud Run

  23. 23

    Difference between STOP instance and SUSPEND instance in Google Cloud Platform

  24. 24

    Unable to run script for creating a new table

  25. 25

    Google cloud how to start service when creating instance using Python api?

  26. 26

    Got an error "ZONE_RESOURCE_POOL_EXHAUSTED" when creating a new instance on Google Cloud

  27. 27

    Unable to connect to SSH on Google Cloud VM Instance

  28. 28

    Creating a DNS forward in Google Cloud Platform with Bind9

  29. 29

    Creating a bucket using Google Cloud Platform Deployment Manager Template

HotTag

Archive