RLOpenCatalyst / Service_Workbench_Templates

Templates for AWS Service Workbench from Relevance Lab
7 stars 13 forks source link

[Bug] bash errors during packer build #10

Closed dcloud9 closed 2 years ago

dcloud9 commented 2 years ago

Hi, We hit these bash errors when packer is ran

    amazon-ebs:   Installing : 1:gmp-devel-6.0.0-15.amzn2.0.2.x86_64                        1/1
    amazon-ebs:   Verifying  : 1:gmp-devel-6.0.0-15.amzn2.0.2.x86_64                        1/1
    amazon-ebs:
    amazon-ebs: Installed:
    amazon-ebs:   gmp-devel.x86_64 1:6.0.0-15.amzn2.0.2
    amazon-ebs:
    amazon-ebs: Complete!
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: -bash: R: command not found
==> amazon-ebs: Stopping the source instance...
    amazon-ebs: Stopping instance
==> amazon-ebs: Waiting for the instance to stop...
==> amazon-ebs: Creating AMI <redacted> from instance i-0fd869a2af80d736f
    amazon-ebs: AMI: ami-071a7ab923fbc1348
==> amazon-ebs: Waiting for AMI to become ready...
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' finished.

==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs: AMIs were created:
eu-west-2: ami-071a7ab923fbc1348

I think because of R is not in the PATH var? Below are the bash commands in the provision-rstudio.sh script.

sudo yum install -y gmp-devel-6.0.*                           # GNU MP arbitrary precision library

#Additional R Packages
sudo su - -c "R -e \"install.packages('tidyverse', version='1.3.1', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('devtools', version='2.4.0', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('kableExtra', version='1.3.4', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('survival', version='3.2.10', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('survminer', version='0.4.9', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('MASS', version='7.3.53.1', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('quantreg', version='5.85', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('DescTools', version='0.99.41', repos='http://cran.rstudio.com/')\""

# Wipe out all traces of provisioning files
sudo rm -rf "/tmp/rstudio"
sudo rm -rf "/tmp/libgit2"
sudo rm -rf "/tmp/R"
travberk commented 2 years ago

I found this problem a couple of days ago, and just found out the root cause. The script provision-rstudio.sh on line 7 tries to install a very specific version of a library, namely libcurl-devel-7.76.1. Unfortunately, it's companion library, libcurl, is already installed at version 7.79.1 in the base image. Therefore, this library install fails, which causes the R installation to fail, and everything falls apart afterward. To fix it, you can simply change the specific library version to be libcurl-devel-7.79.1, save, and redeploy. The build then ran successfully for me in 52 minutes. I have not yet tested just having it install whatever version is current by not specifying version numbers. As the base image continues to update, this problem could come up again.

dcloud9 commented 2 years ago

Agreed. Shall we raise a PR for this? Or there's already a much better future-proofing route in the roadmap?

travberk commented 2 years ago

I have no idea what is on their roadmap. If you want to raise a PR, I'll go in with you. I'm not sure if they would rather use another specific version, as I suggested above, or just leave the version off to use whatever is the latest. I have not tested the latter.

manikandan-thangavelu-rl commented 2 years ago

Fixed the issue in the PR #11 and closing the issue

BoPeng commented 1 year ago

I continue to have the same problem with the master branch. I am trying again with the version of libcurl removed.