Puppet command not available after installation

I followed the instructions at Foreman :: Manual without error, up to the point where I am instructed to run puppet agent --test. When I do so I get
The program 'puppet' is currently not installed.
The deb puppet-common is not installed. Having installed it there is no server directive in /etc/puppet/puppet.conf so the command then fails with
Failed to open TCP connection to puppet:8140
as indeed I would expect it to as that is not the name of the host on which I have installed foreman.

Expected outcome:
Installer should install whatever packages are needed for the puppet command to be in the path, or the instructions should explain the extra steps needed to make this work.

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Other relevant data:
Ubuntu 16.04
Install log: https://pastebin.com/GR4fvcwH

In fact it would appear puppet isn’t installed at all:

root@mom:~# dpkg -l | grep puppet | awk '{print $1,$2,$3}'
rc foreman-installer 1.18.0-1
rc puppet-agent 5.5.4-1xenial
ii puppet-common 3.8.5-2ubuntu0.1
ii puppet5-release 5.0.0-1xenial
rc puppetserver 5.3.4-1xenial
ii ruby-kafo 2.1.0-1

Not super familiar with Ubuntu, but the puppetserver package includes puppet. It’s most likely not in your $PATH, did you try logging out and in again after installation? puppet should be in /opt/puppetlabs/bin.

It’s not in that folder, and the service isn’t running (nothing listening on port 8140). The rc indicates that removal has been requested, but checking my terminal history issue anything that could remove the packages. They’re missing immediately after the foreman installation process completes.

The foreman-installer package has also been removed - is there any self deletion process in that installer? It’s a new box and only I have access.

This seems highly unlikely, I’m deploying a machine to take a look at that

There is no self deletion. Do you have a log of the installer itself? This should be in /var/log/foreman-installer.

Thank you. I thought it unlikely myself. Here’s a log of every command ever issued on the box (not many as it’s new). Please by all means tell me I’ve done something stupid.


Link to installer log is in first post

Installing puppet-common removed foreman-installer, puppetserver and friends

root@mom:/tmp# apt-get install puppet-common
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  ca-certificates-java fontconfig-config fonts-dejavu-core java-common libcups2 libfontconfig1 libjpeg-turbo8
  libjpeg8 liblcms2-2 libnspr4 libnss3 libnss3-nssdb libxi6 libxrender1 libxtst6 openjdk-8-jre-headless ruby-ansi
  ruby-hashie ruby-kafo ruby-kafo-parsers ruby-kafo-wizards ruby-powerbar x11-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  debconf-utils facter hiera ruby-deep-merge ruby-nokogiri ruby-rgen ruby-safe-yaml ruby-selinux ruby-shadow
Suggested packages:
  mcollective-common ruby-rrd
Recommended packages:
The following packages will be REMOVED:
  foreman-installer puppet-agent puppet-agent-oauth puppetserver

After the installer finishes, you have to log out and log in (or do something like exec bash -l) to get updated $PATH. After that you’ll be able to execute puppet which lives in /opt/puppetlabs/bin/puppet

I’ll try that, thanks.

That’s correct, puppet-common is the old Puppet 3 package. The puppetlabs package installs to /opt/puppetlabs and installs a file to /etc/profile.d which adds /opt/puppetlabs/bin to $PATH. You can also source that file manually in your shell.

Thanks all. I have rebuilt the machine and after logging out and in, puppet is in the $PATH for normal users, but not for root. I usually get to root with sudo bash, which I guess doesn’t source stuff in profile.d.

1 Like

So if sudo -i bash everything is OK. What is it that is different here? In 18 years as a Linux user I’ve never had to learn this flag - I’m assuming this is because usually debian packages put links into dirs that are already in the $PATH so that everything just works.

I’ve leaned to use sudo -i because it fixed issues with HOME being set to /root instead of the old user.

I guess that has something to do because debian (and other distributions?) changed the way the “PATH” is beeing defined for user root when using “sudo” or “su”. hence “su -” will fix it, or “sudo -i” might fix the problem as metioned earlier.
Since I ususally use sudo on debian , I added the puppet path to /etc/sudoers in " Defaults secure_path=/opt/puppetlabs/bin:…"

This fixed it for me, but either the manual or the package is incorrect.