UNDER CONSTRUCTION

TODO: /etc/dhcp/dhcpd.conf: filename, nextserver

TODO: /etc/cobbler/settings: manage_dhcp: 1

TODO: /etc/cobbler/dhcp.template


Cobbler over UEFI

Making deb-packet

Dependencies:

$ sudo aptitude install \
    devscripts lintian make git debmirror createrepo \
    cman syslinux tftpd-hpa fence-agents \
    apache2 apache2-utils libapache2-mod-wsgi libapache2-mod-python \
    python python-support python-django python-yaml python-dateutil python-cheetah \
    python-netaddr python-simplejson python-urlgrabber python-pykickstart

Clone:

$ mkdir cobbler_deb
$ cd cobbler_deb
$ git clone https://github.com/cobbler/cobbler.git
$ cd cobbler
$ git checkout release24

Fix debian rules:

$ sed -i 's/debinstall/install/g' debian/rules
$ sed -i 's/dh_python/dh_pysupport/g' debian/rules
$ sed -i 's/mkisofs/genisoimage/g' debian/control
$ git add debian/rules debian/control
$ git commit -m "Fix deb package building"

Build and install deb-packet:

$ sudo debuild -i -us -uc -b
$ cd ..
$ sudo chown -R $USER:$USER cobbler*
$ sudo dpkg -i cobbler_1.5.0-1_all.deb
$ sudo aptitude hold cobbler

Fix Cobbler

Fix init script

Apply next patch to /etc/init.d/cobblerd (in order to fix cobblerd stopping):

   1 @@ -80,7 +80,11 @@ stop() {
   2      elif [ -f $DEBIAN_VERSION ]; then
   3          # Added this since Debian's start-stop-daemon doesn't support spawned proces
   4          # when cobblerd supports stopping or PID files.
   5 -        if ps -ef | grep "/usr/bin/python /usr/bin/cobblerd" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then
   6 +        ps_list=$(ps -ef | grep "/usr/bin/python /usr/bin/cobblerd" | \
   7 +                grep -v grep | awk '{print $2}' | \
   8 +                sed -e 's/^ *//g' -e 's/ *$//g')
   9 +        if [ -n "$ps_list" ]; then
  10 +            kill $ps_list &>/dev/null
  11              echo -n "OK"
  12              RETVAL=0
  13          else

Fix utils.py

Apply next patch to /usr/lib/python2.7/dist-packages/cobbler/utils.py (in order to fix cobblerd starting):

   1 @@ -1068,10 +1068,8 @@ def tftpboot_location():
   2          return "/var/lib/tftpboot"
   3      elif make == "ubuntu" and os.path.exists("/srv/tftp"):
   4          return "/srv/tftp"
   5 -    elif make == "debian" and int(version.split('.')[0]) < 6:
   6 +    elif make == "debian":
   7          return "/var/lib/tftpboot"
   8 -    elif make == "debian" and int(version.split('.')[0]) >= 6:
   9 -        return "/srv/tftp"
  10      else:
  11          return "/tftpboot"
  12 
  13 @@ -2215,8 +2215,8 @@ def dhcpconf_location(api):
  14          return "/etc/dhcpd.conf"
  15      elif dist == "suse":
  16          return "/etc/dhcpd.conf"
  17 -    elif dist == "debian" and int(version[1].split('.')[0]) < 6:
  18 -        return "/etc/dhcp3/dhcpd.conf"
  19 +    elif dist == "debian":
  20 +        return "/etc/dhcp/dhcpd.conf"
  21      elif dist == "ubuntu" and version[1] < 11.10:
  22          return "/etc/dhcp3/dhcpd.conf"
  23      else:
  24 
  25 @@ -2238,9 +2238,7 @@ def zonefile_base(api):
  26  
  27  def dhcp_service_name(api):
  28      (dist, version) = api.os_version
  29 -    if dist == "debian" and int(version.split('.')[0]) < 6:
  30 -        return "dhcp3-server"
  31 -    elif dist == "debian" and int(version.split('.')[0]) >= 6:
  32 +    if dist == "debian":
  33          return "isc-dhcp-server"
  34      elif dist == "ubuntu" and version < 11.10:
  35          return "dhcp3-server"

This patch chooses next things:

  • - TFTP files dir: /var/lib/tftpboot

    - DHCP config: /etc/dhcp/dhcpd.conf

    - DHCP server package: isc-dhcp-server

If you're using different ones, be sure to change them appropriately in patch above.

NOTE: this patch is intended only for Debian. If you're using Ubuntu -- everything must be working fine. But if not -- you probably need to change similar things in blocks under if make == "ubuntu" block statements.

Configuring Cobbler

Change encrypted password:

$ openssl passwd -1

Enter cobbler admin password and retype it.

Then replace "default_password_crypted:" field value (in /etc/cobbler/settings file) by new one (don't forgot that this value must be quoted).

Obtain boot-loaders:

$ sudo cobbler get-loaders

Change PXE server address (in /etc/cobbler/settings):

next_server: 192.168.0.1

Change server address (in /etc/cobbler/settings):

server: 192.168.0.1

Check Cobbler configuration:

$ sudo cobbler check

There must be no warnings there. You must see next line:

No configuration problems found.  All systems go.

Once there are no errors we need to apply changes:

$ sudo cobbler sync

There must be no warnings there and you must see next line in the end of the output:

*** TASK COMPLETE ***

For details see:

[1] http://www.cobblerd.org/manuals/2.4.0/

[2] http://www.cobblerd.org/manuals/2.4.0/2_-_Cobbler_Quickstart_Guide.html

[3] http://www.cobblerd.org/manuals/2.4.0/3/3_-_Installing_From_Source.html

[4] http://www.cobblerd.org/manuals/2.4.0/3/6_-_Installation_Notes.html

[5] http://www.cobblerd.org/manuals/2.4.0/3/5_-_Relocating_Your_Installation.html

[5] https://github.com/cobbler/cobbler/wiki/Installation-Notes

Cobbler web-interface setup

Cobbler uses /var/www/cobbler path for web-interface files. But we have them in /srv/www/cobbler. Rather than changing "webdir:" field in /etc/cobbler/settings, we will just make symbolic link for it (like it described here: http://www.cobblerd.org/manuals/2.4.0/3/5_-_Relocating_Your_Installation.html):

$ sudo ln -s /srv/www/cobbler /var/www
$ sudo ln -s /srv/www/cobbler_webui_content /var/www

Set up correct permissions:

$ sudo chown www-data /var/lib/cobbler/webui_sessions
$ sudo mkdir /var/lib/cobbler/webui_cache
$ sudo chown www-data /var/lib/cobbler/webui_cache

In file /etc/cobbler/modules.conf, change line:

[authentication]
module = authn_denyall

to:

[authentication]
module = authn_configfile

Change the password for the 'cobbler' username:

htdigest /etc/cobbler/users.digest "Cobbler" cobbler

Fix "404 - Not Found" error:

$ cd /etc/apache2/conf-enabled
$ sudo ln -s ../conf.d/cobbler_web.conf .

Fix "500 - Internal Server Error":
In file "/usr/share/cobbler/web/settings.py" find "SECRET KEY = " entry and assign it to some random text value (it's salt), like:

SECRET_KEY = 'some_random_text'

Enable Apache modules:

$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2enmod rewrite
$ sudo a2enmod wsgi
$ sudo a2enmod ssl
$ sudo a2dismod python
$ sudo service apache2 restart

Fix "Error code: ssl_error_rx_record_too_long" error:

$ sudo a2ensite default-ssl
$ sudo service apache2 reload

Now restart apache2 and cobblerd

$ sudo service cobblerd restart
$ sudo service apache2 restart

Now you should be able to use web interface via next link: https://127.0.0.1/cobbler_web

Login to Cobbler web interface using user name "cobbler" and password you generated earlier (with "openssl passwd -1" command).

For details see:

[1] https://github.com/cobbler/cobbler/wiki/Cobbler-web-interface

Troubleshooting

First, make sure that cobblerd and apache2 are started:

# service cobblerd status
# service apache2 status

If they are not started:

# service cobblerd start
# service apache2 start

Check next logs:

- /var/log/apache2/error.log

- /var/log/cobbler/cobbler.log

There must be no errors observed in these logs.

Check apache modules:

# . /etc/apache2/envvars
# apache2 -l
# apache2 -M

Next modules must be seeing as loaded:

- ssl

- wsgi

Remove Cobbler

$ sudo aptitude purge cobbler
$ sudo rm -rf /usr/lib/python2.7/dist-packages/cobbler /usr/share/cobbler /var/lib/cobbler /var/log/cobbler /etc/cobbler /etc/init.d/cobblerd /var/www/cobbler /srv/www/cobbler*

Link worth to look at:

[1] http://blog.milford.io/2012/03/getting-a-basic-cobbler-server-going-on-centos/

LEG/ServerArchitecture/UEFI/UEFI_Cobbler (last modified 2017-08-17 12:13:08)