New to foreman, a couple issues with Ubuntu 12.04 deploy and 14.04 post deploy cleanup

Hello,

I have Foreman running on CentOS 6.5.

rpm -qa | grep foreman

rubygem-foreman_api-0.1.11-1.el6.noarch
foreman-proxy-1.5.0-1.el6.noarch
foreman-release-1.5.0-1.el6.noarch
foreman-postgresql-1.5.0-1.el6.noarch
ruby193-rubygem-foreman_bootdisk-2.0.5-1.el6.noarch
foreman-1.5.0-1.el6.noarch
foreman-selinux-1.5.0-1.el6.noarch
ruby193-rubygem-foreman_setup-2.0.3-1.el6.noarch
foreman-installer-1.5.0-1.el6.noarch

rpm -qa | grep puppet

puppet-server-2.7.25-2.el6.noarch
puppet-2.7.25-2.el6.noarch

While attempting to bare metal deploy Ubuntu 12.04, I'm noticing the
foreman is trying to pull installer files from the following url using the
default installation media titled 'Ubuntu Mirror':

E, [2014-05-16T16:52:00.194200 #4084] ERROR – : [2614]
http://archive.ubuntu.com/ubuntu//dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux/dists/precise/main/installer-amd64/current/images/netboot
/debian-installer/amd64/initrd.gz:
E, [2014-05-16T16:52:00.194285 #4084] ERROR – : [2614] 2014-05-16 16:52:00
ERROR 404: Not Found.

The url should
be: http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/
ubuntu-installer/amd64/linux

I tried creating a new Installation Medium, but then I get a url like:
http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux
/dists/precise/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux
.

Is this a known issue? How can I stop the additional string from being
appended?

For 14.04, I posted this to the IRC channel but didn't get any bites:

I'm running into an issue where after a ubuntu 14.04 host completes its
bare metal install (just after grub is installed) I get an error: failed to
run preseeded command execution of preseeded command "wget
http://foreman…/unattended/finish?token=<token> -0
/target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target
/tmp/finish.sh" failed with exit code 8

if I browse to that url, I get: unable to find finish template for
[dell-ubuntu.domain.name] running [Ubuntu 14.04]. After a reboot, the host
runs through the installer process again.

I'm using the following templates: provision/Preseed default, and
PXELinux/Presseed default PXELinux on the Ubuntu 14.04 OS configuration

For reference I have been able to install Centos 6.5 with kickstart without
issue.

Is 14.04 too new for the built in templates? I tried adding 14.04 to the
provisioning template 'preseed default' which didn't change anything:

<%#
kind: provision
name: Preseed default
oses:

  • Debian 6.0
  • Debian 7.0
  • Ubuntu 10.04
  • Ubuntu 12.04
  • Ubuntu 13.04
    ± Ubuntu 14.04
    %>

Any help is appreciated,
Steve

> Hello,

> While attempting to bare metal deploy Ubuntu 12.04, I'm noticing the foreman
> is trying to pull installer files from the following url using the default
> installation media titled 'Ubuntu Mirror':
>
> E, [2014-05-16T16:52:00.194200 #4084] ERROR – : [2614]
> http://archive.ubuntu.com/ubuntu//dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux/dists/precise/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz:
> E, [2014-05-16T16:52:00.194285 #4084] ERROR – : [2614] 2014-05-16 16:52:00
> ERROR 404: Not Found.
>
> The url should be:
> http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux

You'll note that ubuntu-installer is present at the start of the wrong
URL - it looks like two URLs are being run together. What have you got
in your Ubuntu Medium? For reference, I use:

Medium: Ubuntu Mirror
Path: http://gb.archive.ubuntu.com

The rest of the URL to the netboot image is added by Foreman, and the
defaults should work fine.

> For 14.04, I posted this to the IRC channel but didn't get any bites:
>
> I'm running into an issue where after a ubuntu 14.04 host completes its bare
> metal install (just after grub is installed) I get an error: failed to run
> preseeded command execution of preseeded command "wget
> http://foreman…/unattended/finish?token=<token> -0 /target/tmp/finish.sh
> && in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh" failed
> with exit code 8

If you have a monitor/vnc access to the host as it installs, switch to
another VT and look in /tmp on the newly installed disk (usually
mounted at /mnt or /target from the installer environment). The finish
script will be there, and you can try running it yourelf (remember to
chroot first, it's designed to be run inside the new OS, not from the
installer). A common issue is use of a proxy in the preseed, which
then needs to be unset for the final wget to foreman at the end of the
finish script.

It's also worth checking the Foreman lgogs - it's possible the script
is executing correctly, but Foreman isn't happy with cancelling the
build state for some reason. In this scenario, Foreman returns an
error for the final wget in the script, which makes wget exit
non-zero, which causes the preseed to error out.

> if I browse to that url, I get: unable to find finish template for
> [dell-ubuntu.domain.name] running [Ubuntu 14.04].

If you go to the Host page in Foreman for this host. and click the
Templates tab, there is a Review button next to the finish template.
There you will be able to see the exact rendered script Foreman will
give when the host requests the URL. You can check it for obvious
errors, and then try running it as above.

>After a reboot, the host
> runs through the installer process again.

The finish script is responsible for notifying Foreman that the build
is complete (it's the last wget in the script). As such, if the finish
is not executing for some reason, this would be expected behaviour.

> I'm using the following templates: provision/Preseed default, and
> PXELinux/Presseed default PXELinux on the Ubuntu 14.04 OS configuration
>
> For reference I have been able to install Centos 6.5 with kickstart without
> issue.
>
> Is 14.04 too new for the built in templates? I tried adding 14.04 to the
> provisioning template 'preseed default' which didn't change anything:

They worked fine for 14.04 last time I tried them (~3 weeks ago). The
metadata in that initial comment is for use by a template-related
plugin, Foreman doesn't use it. Associations in Foreman are handled by
another tab, which you have presumably already found if you've
associated the template with the Ubuntu 14.04 OS :slight_smile:

··· On 16 May 2014 22:23, Steve Dainard wrote:

>
> You'll note that ubuntu-installer is present at the start of the wrong
> URL - it looks like two URLs are being run together. What have you got
> in your Ubuntu Medium? For reference, I use:
>
> Medium: Ubuntu Mirror
> Path: http://gb.archive.ubuntu.com
>
> The rest of the URL to the netboot image is added by Foreman, and the
> defaults should work fine.
>

After I reread the manual on OS creation I found the part mentioning how
foreman determines the OS, which is by the name field. If the name doesn't
contain 'ubuntu' for debian type OS's, the netboot url defaults to debian.

After switching the name to ubuntu 12.04 the url looks good, and the
netboot image is pulled down to the tftpboot location, and after a bit of a
delay the installation starts.

If you have a monitor/vnc access to the host as it installs, switch to
> another VT and look in /tmp on the newly installed disk (usually
> mounted at /mnt or /target from the installer environment). The finish
> script will be there, and you can try running it yourelf (remember to
> chroot first, it's designed to be run inside the new OS, not from the
> installer). A common issue is use of a proxy in the preseed, which
> then needs to be unset for the final wget to foreman at the end of the
> finish script.

Was missing the finish template :open_mouth:

>
>

> >After a reboot, the host
> > runs through the installer process again.
>
> The finish script is responsible for notifying Foreman that the build
> is complete (it's the last wget in the script). As such, if the finish
> is not executing for some reason, this would be expected behaviour.
>

That makes sense.

>
> > I'm using the following templates: provision/Preseed default, and
> > PXELinux/Presseed default PXELinux on the Ubuntu 14.04 OS configuration
> >
> > For reference I have been able to install Centos 6.5 with kickstart
> without
> > issue.
> >
> > Is 14.04 too new for the built in templates? I tried adding 14.04 to the
> > provisioning template 'preseed default' which didn't change anything:
>
> They worked fine for 14.04 last time I tried them (~3 weeks ago). The
> metadata in that initial comment is for use by a template-related
> plugin, Foreman doesn't use it. Associations in Foreman are handled by
> another tab, which you have presumably already found if you've
> associated the template with the Ubuntu 14.04 OS :slight_smile:
>

Good to know, was a shot in the dark.

Thanks for your help, anyone who stumbles on this in the future, RTFM, its
very comprehensive :slight_smile: