Custom AMI with nvidia driver via packer.



I have a curious problem that I can seem to make heads or tails of. I am using packer to create a custom AMI that includes the nvidia driver. I am using the base ubuntu 16.04 image on a g4dn.xlarge instance as the packer base and packer completes successfully. It installs the nvidia driver using the package. Everything looks good, but when I provision a new ec2 instance from this ami, the nvidia driver is not loaded and I get "NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running." when running nvidia-smi. I have tried adding extra steps to the packer project that follow the steps outlined here:, but the result is always the same. What I am missing here?


asked 4 years ago920 views
1 Answer

I figured out the issue, I need to set the ephemeral storage devices that come with a g4dn in packer to no device:

  "launch_block_device_mappings": \[  
      "device_name": "/dev/sda1",  
      "delete_on_termination": true,  
      "volume_size": "125",  
      "volume_type": "gp2"  
      "device_name": "/dev/sdb",  
      "no_device": true  
      "device_name": "/dev/sdc",  
      "no_device": true  
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions