SimpleBootServer - henk52/knowledgesharing GitHub Wiki

summary Spartan boot server

= Introduction =

Reference

Create your own repo

  • yum-config-manager

createrepo

See: http://www.techrepublic.com/blog/linux-and-open-source/create-your-own-yum-repository/609/

  • Installing it

    • sudo yum install createrepo
  • Creating the repo:

    mkdir /var/ks/repo

    cd /var/ks/repo

    createrepo .

    • This will create a

    copy in all the RPM files you want installed.

    createrepo .

yumdownloader

  • yumdownloader --destdir DIR --resolve

install: sudo yum install yum-utils

  • rpm -ql puppet
  • rpm -qR puppet

Make sure the packages aren't there already. grep libyaml c601b1538f5b6e6f6d1e927cc1c6d51b8e00c70f51e5ec66e680fa581e2df069-filelists.xml | grep "<package" | awk -F '"' '{ print $4 }'

Provide a web interface to your repo

Kickstart scripts

CentOS 6.5

CentOS 6.5 - pxe.cfg

prompt 1
default netboot
timeout 1

# http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-startinginstall.html

label netboot
kernel centos_65_x86_64/vmlinuz
append initrd=centos_65_x86_64/initrd.img ksdevice=eth0 ks=nfs:10.1.2.3:/var/ks/configs/ks_centos-65-x86_64_nfs.cfg ramdisk_size=9216 noapic acpi=off selinux=0

CentOS 6.5 - KS

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Firewall configuration
firewall --disabled
# SELinux configuration
selinux --disabled
# Use text mode install
text
# Do not configure the X Window System
skipx
# Reboot after installation
reboot


# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$IjWi6ehu$LZ2U1SN7HwomM/uQWb6fJ1
# System timezone
timezone Europe/Amsterdam --isUtc
# System language
lang en_US
# Choose the installation media
nfs --server=10.1.2.3 --dir=/var/ks/images/centos_65_x86_64 

# Network information
#  See: http://docs.fedoraproject.org/en-US/Fedora/20/html/Installation_Guide/s1-kickstart2-options.html
network --device eth0 --bootproto dhcp
#network  --device=eth0 --bootproto=dhcp
# System authorization information
auth  --useshadow  --passalgo=sha512

# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel 
# Disk partitioning information
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1

%packages
@core
%end

Rsync sync

Public rsync server

rsync::server::module{ 'extrarepo':
  path      => "$szKickStartExtraRepos",
  require   => File[ "$szKickStartExtraRepos" ],
  read_only => 'yes',
  list      => 'yes',
}

On the client node:

  • rsync -avz rsync://10.1.2.3:/extrarepo/rhel_63_x86_64_puppetlabs rhel_63_x86_64_puppetlabs

foreman

1 dnf -y install https://yum.theforeman.org/releases/1.13/f24/x86_64/foreman-release.rpm 1 dnf -y install foreman-installer

Rolling you own ISO, using pungi

  • pungi -c /vagrant/files/fedora19_boot_server_ks.cfg --nosource --destdir=/var/ks/pungi --force >& pungi.log
  • grep fail pungi.log | awk '{ print $2 }'
  • or: grep fail pungi.log | awk '{ printf("%s ", $2) }'
  • yumdownloader --resolve --destdir tmp tmux firstboot firstaidkit-plugin-passwd firstaidkit-plugin-key-recovery firstaidkit-plugin-mdadm-conf memtest86+ anaconda-dracut xorg-x11-drivers at-spi jfsutils python-volume_key volume_key system-storage-manager python-ethtool tigervnc-server-module mt-st hdparm libmlx4 madan-fonts xorg-x11-fonts-misc gdb-gdbserver python-epdb icfg yum-plugin-fastestmirror
  • sudo cp ~vagrant/tmp/*.rpm /var/ks/repo/fedora-19/x86_64
  • yumdownloader --resolve --destdir /var/ks/repo/fedora-19/x86_64 dbus-libs
  • yumdownloader --resolve --destdir /var/ks/repo/fedora-19/x86_64 dbus
  • pushd /var/ks/repo/fedora-19/x86_64
  • sudo createrepo .
  • sudo chown -R vagrant:vagrant .
  • cd /var/ks/pungi

the KS file

  • Create it using: /usr/sbin/system-config-kickstart
  • yum install system-config-kickstart
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
#  This is for setting up a boot server, replicating itself ;-)

# TODO replace 'fedora-19' wit $releasever or whatever it is.
repo --name=local --baseurl=http://192.168.3.2/fedora-19/$basearch
repo --name=fedora19 --baseurl=http://192.168.3.2/images/fedora-19/$basearch

# Install OS instead of upgrade
install
# Firewall configuration
firewall --disabled

# Reboot after installation
reboot

# Root password
rootpw --iscrypted REPLACE_WITH_ENCRYPTED_PASSWORD
# System timezone
timezone CET --isUtc
# System language
lang en_US
# Use NFS installation media
nfs --server=192.168.3.2 --dir=/var/ks/images/fedora-19/x86_64
# Network information
network  --bootproto=dhcp --device=eth0
network --bootproto=static --ip=192.168.3.2 --netmask=255.255.255.0 --gateway=192.168.3.2 --nameserver=192.168.3.2 --device=eth1


# System authorization information


auth  --useshadow  --passalgo=sha512
# Use text mode install
text
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx

# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1

%packages
@core
puppet

# grub2 to hopefully be able to install from an ISO.
grub2
lvm2
grub2-tools
grubby
kernel


# Puppet needs to be added and then that needs to take care of package installation and configuration.
#  TODO NTP server.
# find packages with: rpm -qf /usr/sbin/ifconfig

# for debugging:
strace
tcpdump
# /usr/sbin/ifonfig
net-tools

%end

Generating an encrypted password

Boot server concepts

Linux servers

/var/tftp/pxelinux.0

  • Part of the
  • Defined in the dhcp.conf file as a general parameter: filename "pxelinux.0";

1 "pxelinux.cfg/f57b9dda-d79e-4296-90a3-ab91a8565a8b" 1 "pxelinux.cfg/01-08-00-27-60-03-49" * Mac address with '01-' prepended to it. 1 "pxelinux.cfg/0A01E991" * IP address, that was given to the client. 1 "pxelinux.cfg/0A01E99" 1 "pxelinux.cfg/0A01E9" 1 "pxelinux.cfg/0A01E" 1 "pxelinux.cfg/0A01" 1 "pxelinux.cfg/0A0" 1 "pxelinux.cfg/0A" 1 "pxelinux.cfg/0" 1 "pxelinux.cfg/0" 1 "pxelinux.cfg/0" 1 "pxelinux.cfg/default"

ESXi

Solaris

x86

Sparc

netinstalling ubuntu

Creating a boot server from the Fedora Mirror

Get a local copy of the Fedora Mirror

  • Fedora 20 takes up 56GB. 8 GB in the release and 48 GB in the update part.

The script for doing the update.

#!/bin/bash

rsync -vaH --filter=". fedora_filters.txt"  --numeric-ids --delete rsync://dl.fedoraproject.org/fedora-enchilada /var/ks/repo

fedora_filters.txt

+ linux/
+ linux/updates/
+ linux/updates/20/
+ linux/updates/20/x86_64/
+ linux/updates/20/i386/
+ linux/releases/
+ linux/releases/20/
+ linux/releases/20/Fedora/
+ linux/releases/20/Fedora/x86_64/
+ linux/releases/20/Fedora/x86_64/os/
+ linux/releases/20/Fedora/i386/
+ linux/releases/20/Fedora/i386/os/
- linux/releases/20/Fedora/x86_64/*
- linux/releases/20/Fedora/i386/*
- linux/releases/20/Fedora/*
- linux/releases/20/*
- linux/releases/*
- linux/updates/20/i386/debug/*
- linux/updates/20/i386/drpms/*
- linux/updates/20/*
- linux/updates/*
- linux/*

Other oprion: foreman

I've started looking into foreman

Foreman references

Pungi

YumRPMCheckError: [u ERROR with transaction check vs depsolve: , dbus-libs(x86-64) = 1:1.6.8-5.fc19 is needed by dbus-1:1.6.8-5.fc19.x86_64 ]

Hacking away:

cd /var/ks/repo/fedora-19/x86_64/
[root@vagrant-fedora-schrodinger x86_64]# ls | grep dbus
dbus-1.6.12-2.fc19.x86_64.rpm
dbus-glib-0.100-5.fc19.i686.rpm
dbus-libs-1.6.12-2.fc19.i686.rpm
dbus-libs-1.6.12-2.fc19.x86_64.rpm
[root@vagrant-fedora-schrodinger x86_64]# rm dbus-1.6.12-2.fc19.x86_64.rpm dbus-libs-1.6.12-2.fc19.i686.rpm dbus-libs-1.6.12-2.fc19.x86_64.rpm dbus-glib-0.100-5.fc19.i686.rpm
rm: remove regular file ‘dbus-1.6.12-2.fc19.x86_64.rpm’? y
rm: remove regular file ‘dbus-libs-1.6.12-2.fc19.i686.rpm’? y
rm: remove regular file ‘dbus-libs-1.6.12-2.fc19.x86_64.rpm’? y
rm: remove regular file ‘dbus-glib-0.100-5.fc19.i686.rpm’? y
createrepo .
Pungi:INFO: Adding repo ourtree
Pungi:INFO: URL for repo ourtree is ['file:///var/ks/pungi/20131209/x86_64/os']
hfsplus-tools-540.1.linux3-4.fc19.x86_64
checking for root privileges
checking the selinux mode
checking yum base object
setting up build architecture
setting up build parameters
installing runtime packages
got release: fedora-release
running runtime-install.tmpl
Looking for extra fedup-dracut packages...
installpkg *-fedup-dracut failed: No package(s) available to install
Warning: Reusing existing destination directory.
Could not find valid repo at: /var/ks/pungi/20131209/x86_64/os
Spawning worker 0 with 245 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
Could not find valid repo at: /var/ks/pungi/20131209/x86_64/debug
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
downloading packages
checking package signatures
running test transaction
template command error in runtime-install.tmpl:
  run_pkg_transaction
  YumRPMCheckError: [u'ERROR with transaction check vs depsolve:', 'dbus-libs(x86-64) = 1:1.6.8-5.fc19 is needed by dbus-1:1.6.8-5.fc19.x86_64']
Traceback (most recent call last):
  File "/bin/pungi", line 256, in <module>
    main()
  File "/bin/pungi", line 146, in main
    mypungi.doBuildinstall()
  File "/usr/lib/python2.7/site-packages/pypungi/__init__.py", line 937, in doBuildinstall
    workdir=workdir, outputdir=outputdir)
  File "/usr/lib/python2.7/site-packages/pylorax/__init__.py", line 243, in run
    rb.install()
  File "/usr/lib/python2.7/site-packages/pylorax/treebuilder.py", line 104, in install
    self._runner.run("runtime-install.tmpl")
  File "/usr/lib/python2.7/site-packages/pylorax/ltmpl.py", line 180, in run
    self._run(commands)
  File "/usr/lib/python2.7/site-packages/pylorax/ltmpl.py", line 199, in _run
    f(*args)
  File "/usr/lib/python2.7/site-packages/pylorax/ltmpl.py", line 488, in run_pkg_transaction
    rpmDisplay=LoraxRpmCallback())
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 6378, in processTransaction
    self._doTestTransaction(callback,display=rpmTestDisplay)
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 6457, in _doTestTransaction
    raise Errors.YumRPMCheckError,retmsgs
yum.Errors.YumRPMCheckError: [u'ERROR with transaction check vs depsolve:', 'dbus-libs(x86-64) = 1:1.6.8-5.fc19 is needed by dbus-1:1.6.8-5.fc19.x86_64']

NoSuchPackage: grub2

Manually adding grub2 and lvm to the %packages section, fixed this.

During installation on the target the installation process fails with a long list of issues Where this stands out:

NoSuchPackage: grub2

I've only found this page with it: https://bugzilla.redhat.com/show_bug.cgi?id=871143

Wont boot afterwards

Possibly be inspired by: http://www.redhat.com/archives/fedora-buildsys-list/2008-July/msg00062.html

  • boot from cdrom

  • choose troublshooting

  • rescue the image

  • cd /mnt/sysimage/var/log/anaconda

  • grep WARN anaconda.log

  • grep ERR anacondo.log

  • WARN anaconda: no kernel was installed -- bootloader config unchanged

  • ERR anaconda: unknown selinux state: None

Sites to look at:

Network boot

general network boot issues

the ks.cfg failed and states pressing ctrl-C will reboot the machine

alt-F2 will give you a command line prompt.

/tmp/anaconda.log will give you information on what has been going on so far.

Each of the %pre/%post scripts in the ks.cfg is stored, along with a log file in /tmp.

Asks admin to interactively select the NIC to use for install

Perhaps adding: ksdevice=bootif to the pxelinux.cfg file will help.

fedora 20 virtualbox unable to mount root fs on unknown-block

See below

vfs cannot open root device (null) or unknown-block(2,0)

'initrd=' was missing in the pxelinux.cfg boot command file.

HTTP/URL boot issues

redhat 6.1 fails to retrieve ks.cfg via http

For some reason 6.1 doesn't like to get the ks.cfg via http, but nfs works fine.

Post first boot

Kernel panic - not syncing: No working init found

Add: kernel.x86_64 To the package list in the kickstart file.

This seems to have occurred due to the inclusion of an i386 repo.

Starting init: /bin/sh exists but couldn't execute it (error -8)
Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.

troubleshooting Network installation

KVM guest install network install

Source changed - please verify

The real issue, one of the packages can't be resolved. Start removing packages from the install list until it works. One of the anaconda tabs may explain why.

https://bugzilla.redhat.com/show_bug.cgi?id=1419945

  1. Installation source 4) [!] Software selection (http://10.1.2.3/images/rhe (Source changed - please l73) verify)

The path given in --location was different from the path given in 'url' in the ks.cfg

NoSuchGroup: core

Hope: I had generated a new repodata dir, I copied the original back in and hope this helps.

Running the command ends up with this anaconda error: NoSuchGroup: core

⚠️ **GitHub.com Fallback** ⚠️