I’ve run into a puzzling issue. I’m creating a playbook to install Crashplan on my Raspberry Pi. On of the steps involves installing the Java lib “libjna-java”. This does not work:
PLAY RECAP *********************
pi : ok=1 changed=0 unreachable=0 failed=1
Going to the machine via SSH and issueing: ‘apt-get install libjna-java’ works without a hitch. I’m a bit at a loss here. How do I debug this?
During the playbook execution I ran ‘ps ax’ to see what commands where issued, nothing strange as far as I can tell. For completeness sake:
/bin/sh -c DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical /usr/bin/apt-get --option Dpkg::Options::=–force-confold -q -y install ‘libjna-java’
When running apt-get local it just installed. Quite literally ‘no questions asked’. It’s just a lib. That is how you’d know there was a TTY right? When some user input is required?
Thanks for all the responses! I’ve made some headway but the mystery deepens.
I’m starting to suspect that it has something to do with the fact that the Pi is an ARM machine, seeing that Lorin is able to install without issues.
The quoting isn’t it. I double checked my YAML file.
The playbook defines 2 packages to be installed, one ‘libjna-java’, the other ‘openjdk-6-jre’ (see it in a Gist: https://gist.github.com/4141972). I’ve added line 8: “-name: install JNA”. Now the playbook fails on the ‘openjdk-6-jre’ package! With the same error (aside from the package name).
I was having the exact problem on Wheezy Debian 7 x64 - using a normal user to install packages with sudo. I was however able to reproduce the problem by logging in via ssh to the machine and executing apt-get on the command line. In my case, I was trying to install rsync:
apt-get -y install rsync
The problem was that dpkg was not in the normal user’s path as were all the normal root paths: /usr/local/sbin:/usr/sbin:/sbin. So to solve the problem you need to explicitly set the path for the apt module as follows
This is indeed a case that happens on Debian, as Ubuntu tends to put sbin paths also in a regular user’s folder.
You might consider extending the path for your sudo user also.
The best solution would be to let the apt module look for the apt-get|aptitude binaries and execute them with full absolute path, whereas it now just calls the binary by name without path.
This path is normally set correctly in the sudoers file (by default).
Seems so, yes. According to sudoers(5):
* By default, the env_reset option is enabled. This causes commands to
be executed with a new, minimal environment. On AIX (and Linux systems
without PAM), the environment is initialized with
** the contents of the /etc/environment file. The new environment
contains the TERM, PATH, HOME, MAIL, SHELL, LOGNAME, USER, USERNAME and
SUDO_* variables in addition to variables from the
** invoking process permitted by the env_check and env_keep options.
This is effectively a whitelist for environment variables.*
on my system (ubuntu) /etc/environments contains:
+ global APTITUDE_CMD = module.get_bin_path("aptitude")
+ global APT_GET_CMD = module.get_bin_path("apt-get")
Ii see one problem with this:
Whilst apt-get can be expected to be installed on any debian based system,
aptitude cannot. A very bare system won't have it (which was the reason
for one of my previous patches on this module), so this should remain
optional, and only checked if explicitly chosen a option needing aptitude.
(PS: unrelated, we might also consider letting users choose between apt-get
and aptitude for other tasks besides upgradingn wchis is now the only case
where aptitude gets used)