License

Copyright (C) 2008-2021 Oliver Bohlen.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

A copy of the license is included in the section entitled "GNU Free Documentation License".

Introduction

This documentation comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

Howto: Server for thinclients for Gentoo Linux

This part describes how I boot client-PCs over the network. For this I use PXE, DHCP, TFTP and NFS.
For UEFI Grub do

cd /gtc/pxe ; grub-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --fonts="unicode" -o bootx64.efi boot/grub/grub.cfg

If you want to use this solution you need the following howto(s) finished:

Required software

The required software has to be installed with the following command(s):
emerge net-fs/nfs-utils
emerge sys-boot/syslinux
emerge net-ftp/tftp-hpa

Changes in /etc/conf.d/in.tftpd

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/conf.d/in.tftpd

Changed on 04.04.10
Issued by olli
Beginning line 15

Path for PXE files and necessary bootoptions for tftpd.


Before change
INTFTPD_OPTS="-R 4096:32767 -s ${INTFTPD_PATH}"
After change
INTFTPD_PATH="/gtc/pxe"
#INTFTPD_OPTS="-R 4096:32767 -s ${INTFTPD_PATH} --refuse blksize --refuse tsize --refuse blksize2 --user nobody -vvv"
INTFTPD_OPTS="-p -u nobody -s ${INTFTPD_PATH} -vvv"

Changes in /etc/dhcp/dhcpd.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/dhcp/dhcpd.conf

Changed on 06.09.08
Issued by olli
Beginning line 22

This is for starting the syslinux (pxelinux) bootmanager for thinclients booting over pxe.

next-server my.lan.ip.addr;
option architecture-type code 93 = unsigned integer 16;
if option architecture-type = 00:09 {
filename "bootx64.efi";
} elsif option architecture-type = 00:07 {
 filename "bootx64.efi";
} else {
filename "pxelinux.0";
}

Changes in /etc/exports

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/exports

Changed on 23.12.08
Issued by olli
Beginning line 2

NFS4-configuration for test and production environment of the Thinclients.

#/gtc            XXX.XXX.XXX.XXX/XXX.XXX.XXX.XXX(fsid=0,no_subtree_check,async,ro,no_root_squash,insecure)
/gtc/test	my.lan.network.ip/XXX.XXX.XXX.XXX(fsid=1,no_subtree_check,async,ro,no_root_squash,insecure) XXX.XXX.XXX.XXX/XXX.XXX.XXX.XXX(fsid=1,no_subtree_check,async,ro,no_root_squash,insecure)
/gtc/stable	my.lan.network.ip/XXX.XXX.XXX.XXX(fsid=2,no_subtree_check,async,ro,no_root_squash,insecure) XXX.XXX.XXX.XXX/XXX.XXX.XXX.XXX(fsid=1,no_subtree_check,async,ro,no_root_squash,insecure)
/srv/vms        XXX.XXX.XXX.XXX/XXX.XXX.XXX.XXX(fsid=3,no_subtree_check,async,rw,no_root_squash,insecure)

Changes in /gtc/pxe/pxelinux.cfg/default

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /gtc/pxe/pxelinux.cfg/default

Changed on 06.09.08
Issued by olli
Beginning line 1

Boot menu configuration for PXE boots.

default menu.c32
prompt 0
	    
menu title GTC-PXELinux Boot Menu
NOESCAPE 1
ALLOWOPTIONS 1
MENU AUTOBOOT Starting Gentoo Thinclient in # seconds

label stable
 timeout 100
 menu default
 menu label ^Gentoo Stable Thinclient 5.10.61
 kernel /kernel-genkernel-x86_64-5.10.61-gentoo
 append initrd=/initramfs-genkernel-x86_64-5.10.61-gentoo root=/dev/nfs nfsroot=my.lan.ip.addr:/gtc/stable ramdisk_size=256000 acpi_sleep=s3_bios real_root=/dev/nfs raid=noautodetect consoleblank=0 clocksource=hpet
 ipappend 3

label test
 menu label ^Gentoo Test Thinclient 5.10.76
 kernel /kernel-genkernel-x86_64-5.10.76-gentoo-r1
 append initrd=/initramfs-genkernel-x86_64-5.10.76-gentoo-r1 root=/dev/nfs nfsroot=my.lan.ip.addr:/gtc/test ramdisk_size=256000 acpi_sleep=s3_bios real_root=/dev/nfs raid=noautodetect consoleblank=0 clocksource=hpet
 ipappend 3

label bootlocal
 menu label ^Boot from local Disk
 localboot 0

Changes in /gtc/test/etc/conf.d/nfs

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /gtc/test/etc/conf.d/nfs

Changed on 23.12.08
Issued by olli
Beginning line 19

The rpc mountd should listen on port 32767 (needed for some firewall settings).


Before change
#OPTS_RPC_MOUNTD=""
After change
OPTS_RPC_MOUNTD="-p 32767"

Changed on 23.12.08
Issued by olli
Beginning line 27

The rpc statd should listen on port 32765 and send outgoing connections over port 32766 (needed for some firewall settings).


Before change
#OPTS_RPC_STATD=""
After change
OPTS_RPC_STATD="-p 32765 -o 32766"

Changes in /gtc/test/etc/thinclient/server-profile/etc/exports

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /gtc/test/etc/thinclient/server-profile/etc/exports

Changed on 23.12.08
Issued by olli
Beginning line 2

NFS(4)-configuration for test and production environment of the Thinclients.

/opt/gtcroot	*(fsid=0,crossmnt,no_subtree_check,async,ro,no_root_squash,insecure,nohide)

Changes in /usr/local/sbin/mkgtcstable.sh

File permissions:
Owner: root
Group: root
Permissions: -rwx------

Click here for a download of the complete file: /usr/local/sbin/mkgtcstable.sh

Changed on 29.06.09
Issued by olli
Beginning line 2

This is a small script for creating the stable environment from the test environment.

#!/bin/bash
set -x
/etc/init.d/rsyncd stop
#mv /gtc/test/usr/portage/distfiles/jre* /srv/tmp
rm -rf /gtc/test/usr/portage/distfiles/*
#mv /srv/tmp/jre* /gtc/test/usr/portage/distfiles/
if mount | grep -q "on /gtc type btrfs"
then
 btrfs subvolume delete /gtc/stable
 btrfs subvolume snapshot /gtc/test /gtc/stable
 btrfs property set /gtc/stable ro false
 rsync -aXAH --delete --exclude=distfiles /gtc/test/usr/portage/ /gtc/stable/usr/portage/
else
 rsync -aXAH --delete /gtc/test/ /gtc/stable/ --exclude=/_gtcroot/ --exclude=/gtcdvd/ --exclude=/proc/ --exclude=/sys/ --exclude=/tmp/ --exclude=/var/tmp --exclude=/root
fi
mkdir -p /gtc/stable/proc
mkdir -p /gtc/stable/sys
mkdir -p /gtc/stable/tmp
mkdir -p /gtc/stable/root
chmod 0700 /gtc/stable/root
chmod 1777 /gtc/stable/tmp
mkdir -p /gtc/stable/var/tmp/portage
chmod 1777 /gtc/stable/var/tmp
mkdir -p /gtc/stable/_gtcroot
for i in `find /gtc/stable/var/log/ -type f` 
do
 >$i
done
rm -r /gtc/stable/usr/share/doc
rm -r /gtc/stable/usr/share/gtk-doc
for i in `find /gtc/stable/usr/src -maxdepth 1 -type d | grep linux`
do
 cd $i
 # Rest needed for Kernel modules eg nvidia-drivers
 make clean
 cd -
done
btrfs property set /gtc/stable ro true
/etc/init.d/rsyncd start
/etc/init.d/nfs restart
/gtc/pxe/linkkernel.sh

Setting up services

For starting the new service after system reboot you should add it to a runlevel with the following command(s):

rc-update add nfs 
rc-update add in.tftpd 
rc-update add rpc.idmapd default

Please send a feedback to: doc<at>gabosh.net

Howto listing
File Index

Here you can find the official Gentoo Linux Forums where you can find a lot of answers.

Here a link to the official Gentoo Linux Homepage.

Edit Howto

About / Impressum

Click here for About / Impressum

Wishlist

If you want to support my work you can find my Amazon whishlist here