3

I am having issues installing packer onto the EC2 machine. I have downloaded the Linux packer binary file on my Windows PC and uploaded it to the instance. I put it into the directory ~/packer_new, and have been trying two different ways for adding it to the path because it produces this error:

/usr/share/cracklib/pw_dict.pwd: Permission denied
/usr/share/cracklib/pw_dict: Permission denied

When I run just the packer command.

On the packer website, it states

To fix this, you can create a symlink to packer that uses a different name like packer.io, or invoke the packer binary you want using its absolute path, e.g. /usr/local/packer.

I have done the first part by creating a symbolic link using this command:

sudo ln -s packer_new/packer /usr/bin/packer.io

And when I run the packer command again, it still produces the same error. Am I supposed to be running a different command?

And the second way is to add the path to ~/.bash_profile:

export PATH=$PATH:~/packer_new/

Note that I also have another PATH variable in the bash_profile for bin: PATH=$PATH:$HOME/.local/bin:$HOME/bin, not sure if this will affect setting PATH to packer...

But by adding the path, it also produces the same error when running packer.

How can I fix this?

One more question, what does it mean when they say:

invoke the packer binary you want using its absolute path, e.g. /usr/local/packer.

J. H
  • 125
  • 4
  • 10

2 Answers2

2

And when I run the packer command again, it still produces the same error. Am I supposed to be running a different command?

Run packer.io and you link command is wrong. You should do sudo ln -s $HOME/packer_new/packer /usr/bin/packer.io

And the second way is to add the path to ~/.bash_profile: export PATH=$PATH:~/packer_new/

You have to put the path to the front of the PATH. I.e.

export PATH=$HOME/packer_new:$PATH

invoke the packer binary you want using its absolute path, e.g. /usr/local/packer.

It means that you can always run with the absolute path. In your case $HOME/packer_new/packer.

Rickard von Essen
  • 4,110
  • 2
  • 23
  • 27
  • I tried `sudo ln -s $HOME/packer_new/packer /usr/bin/packer.io` and it works wonders! Thank you so much. If anyone is getting a `permission denied` error, don't forget to change the permissions of the packer binary. – J. H Aug 20 '17 at 09:11
1

I ran into the same issue after I installed cracklib-dicts rpm. What worked for me

Run->which packer
/usr/sbin/packer
Remove->rm /usr/sbin/packer
sudo ln -s /usr/local/packer /usr/sbin/packer

Here is a supporting link for this fix https://learn.hashicorp.com/tutorials/packer/getting-started-install#troubleshooting

user_dev
  • 1,357
  • 3
  • 20
  • 46