RHEL 5 Install Never Notifies Razor That Install Was Completed

58 views
Skip to first unread message

Alex Scoble

unread,
Mar 18, 2015, 12:24:22 PM3/18/15
to puppet...@googlegroups.com
Hi All,

Trying to get Razor to provision RHEL 5 boxes and for whatever reason, when the install is completed the client node never notifies Razor Server that the install was finished.

Not sure what's wrong with our kickstart or postinstall files, but here's what we are using:

kickstart erb

#!/bin/bash
# Kickstart for RHEL/CentOS 5

install
url --url=<%= repo_url %>
cmdline
lang en_US.UTF-8
keyboard us
rootpw <%= node.root_password %>
network --hostname <%= node.hostname %> --noipv6
firewall --enabled --ssh
authconfig --enableshadow --enablemd5
timezone --utc America/Los_Angeles
# Avoid having 'rhgb quiet' on the boot line
bootloader --location=mbr --append="crashkernel=auto"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
zerombr yes
clearpart --all --initlabel
# Create primary partitions
part /boot --fstype ext3 --size=512 --asprimary
part swap --fstype swap --size=1024 --recommended --maxsize=4096
part pv.01 --size=1 --grow

volgroup vgroup1 pv.01
logvol /     --fstype ext3 --name=root --vgname=vgroup1 --size=20480
logvol /tmp  --fstype ext3 --name=temp --vgname=vgroup1 --size=1024 --fsoptions="nodev,nosuid"
logvol /home --fstype ext3 --name=home --vgname=vgroup1 --size=10240 --fsoptions="nodev"
logvol /var  --fstype ext3 --name=var  --vgname=vgroup1 --size=10240 --fsoptions="nodev"
logvol /var/log --fstype ext3 --name=varlog --vgname=vgroup1 --size=2048 --fsoptions="nodev,noexec,nosuid"
logvol /var/log/audit --fstype ext3 --name=audit --vgname=vgroup1 --size=1024 --fsoptions="nodev,noexec,nosuid"

# reboot automatically
reboot

%packages --nobase
@core
@base
nano
openssh-clients

%post --log=/var/log/razor.log
echo "Kickstart post"

curl -s -o /root/razor_postinstall.sh <%= file_url("post_install") %>

# Run razor_postinstall.sh on next boot via rc.local
if [ ! -f /etc/rc.d/rc.local ]; then
  # On systems using systemd /etc/rc.d/rc.local does not exist at all
  # though systemd is set up to run the file if it exists
  touch /etc/rc.d/rc.local
fi
chmod a+x /etc/rc.d/rc.local

echo bash /root/razor_postinstall.sh >> /etc/rc.d/rc.local
chmod a+x /root/razor_postinstall.sh

curl -s <%= stage_done_url("kickstart") %>
echo "<%= stage_done_url("kickstart") %>"
############
sleep 10
%end

post install erb

#!/bin/bash

exec >> /var/log/razor.log 2>&1

echo "Starting post_install"

# Wait for network to come up when using NetworkManager.
if service NetworkManager status >/dev/null 2>&1 && type -P nm-online; then
    nm-online -q --timeout=10 || nm-online -q -x --timeout=30
    [ "$?" -eq 0 ] || exit 1
fi

<%= render_template("set_hostname") %>

<%= render_template("store_ip") %>

# @todo lutter 2013-09-12: we should register the system with RHN; be
# careful though, since this file is also used by the CentOS installer, for
# which there is no RHN registration

<%= render_template("os_complete") %>

# We are done
curl -s <%= stage_done_url("finished") %>



Mark Powell

unread,
May 6, 2015, 11:21:54 AM5/6/15
to puppet...@googlegroups.com
Hi Alex,

What does the file "/var/log/razor.log" on the built node contain?

A couple of thoughts:
Do the package groups "core" or "base" contain the curl package?
Is the file "/root/razor_postinstall.sh" downloaded onto the new node?

I'd be interested to know how you're getting on with RHEL 5 and Razor.

Cheers

Mark

Alex Scoble

unread,
May 8, 2015, 7:09:49 PM5/8/15
to puppet...@googlegroups.com
We abandoned RHEL 5 entirely rather than waste time on this.

--Alex

Mark Powell

unread,
May 13, 2015, 12:06:19 PM5/13/15
to puppet...@googlegroups.com
That's a shame because I believe it is eminently "do-able". Good luck!

Alan Crosswell

unread,
May 30, 2015, 5:52:51 PM5/30/15
to puppet...@googlegroups.com
Mark,

I saw a similar issue when installing CentOS-7.1 and your questions helped me find the solution. 

Short answer can be one or both of these issues:
(1) razor server hostname failing to properly resolve so the razor_postinstall.sh never gets installed.
(2) /etc/rc.d/rc.local is not executable due to a default non-executable rc.local on CentOS 7 and a misplaced chmod a+x in the kickstart file.

Long answer:
(1) /var/log/razor.log contained this error:
chmod: cannot access '/root/razor_postinstall.sh': no such file or directory

So I checked /root/anaconda_ks.cfg and saw where it tries to do a curl from (in my case) http://razor:8080/...


Due to the way I had my DHCP server configured, /etc/resolv.conf had bad search stuff in it due to my having misconfigured the hostname in my centos policy JSON. I had the hostname as "hostname": "host${id}.somedomain" which caused "search somedomain" to end up in resolv.conf. Yet, my Razor host was using a simple non-domain hostname of "razor" which was getting converted to "razor.somedomain" and therefore not resolving. (I'm doing all this stuff in an isolated NATed environment and am using simple hostnames.)


(2) After fixing the above policy stuff, it now installs but ends up in the boot_local stage with installed: false. I logged in and /var/log/razor.log contains:
Kickstart post
but somehow /etc/rc.d/rc.local is mode 0644. The reason this is the case is that /etc/rc.d/rc.local exists and is non-executable on purpose! It's contents
are:
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
# ...
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
There is a chmod a+x in the kickstart but it is embedded within a "if [ ! -f /etc/rc.d/rc.local ]" block but the "echo bash /root/razor_postinstall.sh >>/etc/rc.d/rc.local" happens later. So the chmod +x never happens if the rc.local already exists. The fix should be to move the chmod a+x to always happen.

I hope this helps. If I can figure out where the kickstart ERB is located and how to submit a pull request I'll do that. I'm still learning razor so it's going to take me a while to find where the various parts come from.

I hope this helps.
/a

Alan Crosswell

unread,
May 31, 2015, 11:38:10 AM5/31/15
to puppet...@googlegroups.com

Ugh, already fixed in this commit: 

https://github.com/puppetlabs/razor-server/commit/669995285deae9b4e0b8457130f0b72af5a41254

I should just be working from the git repo instead of the razor-server rpm.


/a

--
You received this message because you are subscribed to the Google Groups "puppet-razor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-razor...@googlegroups.com.
To post to this group, send email to puppet...@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-razor.
For more options, visit https://groups.google.com/d/optout.



--

Elyse Salberg

unread,
Oct 11, 2015, 5:03:42 PM10/11/15
to puppet-razor
I know this is an older ticket, but in case it's useful to anyone else, I worked around this issue by fully specifying stage_done_url and file_url("post_install") - interestingly, some of the other file_urls are file (I think some of the log urls aren't working, but I haven't tracked them down).

I put some quick documentation up on the Razor Wiki:
Reply all
Reply to author
Forward
0 new messages