Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurred during build: Command 01_mount failed #24

Open
jpswade opened this issue May 20, 2020 · 16 comments
Open

Error occurred during build: Command 01_mount failed #24

jpswade opened this issue May 20, 2020 · 16 comments

Comments

@jpswade
Copy link

jpswade commented May 20, 2020

Tried this, set the vpc and subnet, but got this error, not sure why yet...

2020-05-20 16:51:17,029 [INFO] -----------------------Starting build-----------------------
2020-05-20 16:51:17,035 [INFO] Running configSets: _OnInstanceBoot
2020-05-20 16:51:17,038 [INFO] Running configSet _OnInstanceBoot
2020-05-20 16:51:17,041 [INFO] Running config AWSEBBaseConfig
2020-05-20 16:51:17,165 [INFO] Command clearbackupfiles succeeded
2020-05-20 16:51:17,169 [INFO] Running config AWSEBCfnHupEndpointOverride
2020-05-20 16:51:17,173 [INFO] Command clearbackupfiles succeeded
2020-05-20 16:51:17,174 [INFO] ConfigSets completed
2020-05-20 16:51:17,174 [INFO] -----------------------Build complete-----------------------
2020-05-20 16:52:07,557 [INFO] -----------------------Starting build-----------------------
2020-05-20 16:52:07,564 [INFO] Running configSets: Infra-EmbeddedPreBuild
2020-05-20 16:52:07,567 [INFO] Running configSet Infra-EmbeddedPreBuild
2020-05-20 16:52:07,569 [INFO] Running config prebuild_0_spectre_blog
2020-05-20 16:52:11,566 [ERROR] Command 01_mount (/tmp/mount-efs.sh) failed
2020-05-20 16:52:11,566 [ERROR] Error encountered during build of prebuild_0_spectre_blog: Command 01_mount failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)
ToolError: Command 01_mount failed
2020-05-20 16:52:11,567 [ERROR] -----------------------BUILD FAILED!------------------------
2020-05-20 16:52:11,567 [ERROR] Unhandled exception during build: Command 01_mount failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 171, in <module>
    worklog.build(metadata, configSets)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
    self.run_config(config, worklog)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)
ToolError: Command 01_mount failed

@jpswade
Copy link
Author

jpswade commented May 20, 2020

@tebayoso
Copy link

Did those changes worked for you? I'm still receiving the error.

@jmosbech
Copy link

jmosbech commented Jun 7, 2020

We're seeing the exact same issue when trying to mount an efs volume on a Docker platform:

Looking at /var/log/cfn-init-cmd.log reveals this:

2020-06-07 13:54:47,011 P5815 [INFO]    /tmp/mount-efs.sh: line 4: /opt/elasticbeanstalk/bin/get-config: No such file or directory
2020-06-07 13:54:47,011 P5815 [INFO]    Mounting EFS filesystem  to directory  ...
2020-06-07 13:54:47,011 P5815 [INFO]    Stopping NFS ID Mapper...
2020-06-07 13:54:47,011 P5815 [INFO]    rpc.idmapd is already stopped!
2020-06-07 13:54:47,011 P5815 [INFO]    Checking if EFS mount directory exists...
2020-06-07 13:54:47,012 P5815 [INFO]    Directory  already exists!
2020-06-07 13:54:47,012 P5815 [INFO]    mount -t efs -o tls :/
2020-06-07 13:54:47,012 P5815 [INFO]    mount: :/: can't find in /etc/fstab.

So it seems that the /opt/elasticbeanstalk/bin/get-config does not exist.

A workaround was to simply change these lines in storage-efs-mountfilesystem.config:

EFS_MOUNT_DIR=$(/opt/elasticbeanstalk/bin/get-config environment -k MOUNT_DIRECTORY)
EFS_FILE_SYSTEM_ID=$(/opt/elasticbeanstalk/bin/get-config environment -k FILE_SYSTEM_ID)

to

EFS_MOUNT_DIR='/efs'
EFS_FILE_SYSTEM_ID='fs-xxxxxxxx'

@amarathota
Copy link

@jmosbech I see the same issue. Did you find any solution?

@jpswade
Copy link
Author

jpswade commented Jun 7, 2020

I forgot I had posted this here, I posted the solution over here:

awsdocs/elastic-beanstalk-samples#120 (comment)

@amarathota
Copy link

Thank you!!

@hopingsteam
Copy link

Another workaround that I've found is to Environment Configuration and type "/" in Document root box. I didn't have anything before there, and after I completed it worked like a charm!

@amarathota
Copy link

@hopingsteam do you mind posting the full solution? thanks!

@hopingsteam
Copy link

@amarathota My solution only applies if you use Amazon Elastic Beanstalk. When you create the main instance, you need to go to Environment Configuration and set the Document root option to "/" (it is NULL initially). I hope that will help you.

@42dontpanic
Copy link

Thanks @hopingsteam, this solved my problem too.

Another workaround that I've found is to Environment Configuration and type "/" in Document root box. I didn't have anything before there, and after I completed it worked like a charm!

@kenoxx83
Copy link

kenoxx83 commented Jul 7, 2021

Hi
I have the same issue than @jpswade but I couldnt fix it with the solution:

awsdocs/elastic-beanstalk-samples#120 (comment)

Please your help

2021-07-07 05:06:34,138 [INFO] Running config AWSEBBaseConfig
2021-07-07 05:06:34,389 [INFO] Command clearbackupfiles succeeded
2021-07-07 05:06:34,393 [INFO] Running config AWSEBCfnHupEndpointOverride
2021-07-07 05:06:34,397 [INFO] Command clearbackupfiles succeeded
2021-07-07 05:06:34,398 [INFO] ConfigSets completed
2021-07-07 05:06:34,398 [INFO] -----------------------Build complete-----------------------
2021-07-07 05:06:40,988 [INFO] -----------------------Starting build-----------------------
2021-07-07 05:06:41,045 [INFO] Running configSets: Infra-EmbeddedPreBuild
2021-07-07 05:06:41,066 [INFO] Running configSet Infra-EmbeddedPreBuild
2021-07-07 05:06:41,080 [INFO] Running config prebuild_0_test
2021-07-07 05:06:41,088 [INFO] ConfigSets completed
2021-07-07 05:06:41,088 [INFO] -----------------------Build complete-----------------------
2021-07-07 05:06:50,563 [INFO] -----------------------Starting build-----------------------
2021-07-07 05:06:50,570 [INFO] Running configSets: Infra-EmbeddedPostBuild
2021-07-07 05:06:50,572 [INFO] Running configSet Infra-EmbeddedPostBuild
2021-07-07 05:06:50,573 [INFO] ConfigSets completed
2021-07-07 05:06:50,573 [INFO] -----------------------Build complete-----------------------
2021-07-07 05:18:56,983 [INFO] -----------------------Starting build-----------------------
2021-07-07 05:18:56,989 [INFO] Running configSets: Infra-EmbeddedPreBuild
2021-07-07 05:18:56,992 [INFO] Running configSet Infra-EmbeddedPreBuild
2021-07-07 05:18:56,995 [INFO] Running config prebuild_0_test
2021-07-07 05:18:56,999 [INFO] Running config prebuild_1_test
2021-07-07 05:19:05,513 [INFO] Yum installed ['amazon-efs-utils']
2021-07-07 05:19:05,857 [ERROR] Command 01_mount (/tmp/mount-efs.sh) failed
2021-07-07 05:19:05,857 [ERROR] Error encountered during build of prebuild_1_test: Command 01_mount failed
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 573, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 273, in build
self._config.commands)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 01_mount failed
2021-07-07 05:19:05,860 [ERROR] -----------------------BUILD FAILED!------------------------
2021-07-07 05:19:05,860 [ERROR] Unhandled exception during build: Command 01_mount failed
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 176, in
worklog.build(metadata, configSets)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 135, in build
Contractor(metadata).build(configSets, self)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 561, in build
self.run_config(config, worklog)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 573, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 273, in build
self._config.commands)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 01_mount failed

@michaelbrant
Copy link

@amarathota My solution only applies if you use Amazon Elastic Beanstalk. When you create the main instance, you need to go to Environment Configuration and set the Document root option to "/" (it is NULL initially). I hope that will help you.

I don't see a Document Root setting anywhere in EB..
image

@ray-moncada
Copy link

@amarathota My solution only applies if you use Amazon Elastic Beanstalk. When you create the main instance, you need to go to Environment Configuration and set the Document root option to "/" (it is NULL initially). I hope that will help you.

I don't see a Document Root setting anywhere in EB.. image

I found it on > Configuration > Software , under Nginx.

@Michaelvons
Copy link

After Adding

EFS_MOUNT_DIR='/efs'
EFS_FILE_SYSTEM_ID='fs-xxxxxxxx'

to environment variables, it worked for me

@deeptirajput2
Copy link

Hi,

I changed above 2 paths(EFS_MOUNT_DIR='/efs'
EFS_FILE_SYSTEM_ID='fs-xxxxxxxx') but still getting below error

cfnbootstrap.construction_errors.ToolError: Command 01_mount failed
2022-12-30 15:24:57,934 [ERROR] -----------------------BUILD FAILED!------------------------
2022-12-30 15:24:57,934 [ERROR] Unhandled exception during build: Command 01_mount failed
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 181, in

Please help.

@oreaba
Copy link

oreaba commented Jan 13, 2023

Hello All,
I have found a solution and I have been able to successfully mount an efs drive to aws elasticbeans running on ami v2.

Steps:

  1. Create a local directory in your application source code root called 'my_efs'
  2. Create an EFS file system from the aws EFS dashboard, select the default VPC, choose the subnets and the security group.
  3. To allow connections, edit the security group rules for the file system. The rules must allow inbound connections on port 2049 (Network File System or NFS) from the security group for instances in your Elastic Beanstalk environment.
  4. Update the instance security group to allow outbound connections on port 2049 to the Amazon EFS security group.
  5. In my setup, I have both the ec2 instance, and the efs on the same region and same availability zone.
  6. Edit the 'env_var.config' with your <EFS_FILE_SYSTEM_ID> and <EFS_MOUNT_DIR> values
  7. Make sure you have the script mount-efs.sh' is inside '.platform/hooks/postdeploy' at the root of your elasticbeans's project root directory. No need to alter anything in this script.
  8. Deploy the application, and you have read/write access to the folder 'my_efs' inside the root of your application, where the content of 'my_efs' dir actually resides in your EFS persistent storage on AWS.
  9. The application will access 'my_efs' folder normally as if it is located on the same machine.
  10. For elasticbeans application, you can find the app dir in the ec2 in this location '/var/app/current/' and the 'my_efs' folder will be in '/var/app/current/my_efs/'

files are located here: my github repo
Thank you,

@deeptirajput2
@ray-moncada
@kenoxx83
@amarathota
@tebayoso
@jmosbech
@jpswade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests