Sunday, January 11, 2009

Nerdy kernel source screensaver

This is how to have the Phosphor screensaver scroll through random .c files from the kernel source.

Install xscreensaver (the default gnome lacks some settings) and set the Program field to something like:
cat `ls /usr/src/linux-source/kernel/*.c|shuf`

It's in the Advanced tab under Text Manipulation.

I'm not sure, but it might be possible to do the same in gconf-editor for the Gnome version of the screensaver.

In the line above I have a soft link to the source files:
ln -s /usr/src/linux-source-2.6.27 /usr/src/linux-source


sudo visudo no password

To allow a user or group to sudo some commands without authentication:

Edit the /etc/sudoers file:
sudo visudo


Add a line with the username (or %group):
username ALL=NOPASSWD: HALT, REBOOT, /usr/bin/apt-get, /usr/bin/aptitude


Note: HALT and REBOOT are aliases you can add in the sudoers file, like this:
# Cmnd alias specification
Cmnd_Alias REBOOT = /sbin/reboot
Cmnd_Alias HALT = /sbin/halt


Just do 'which halt' to find the path to the executable

Thursday, January 1, 2009

pxe linux network install

The steps are
1. install dhcp3-server and tftpd-hpa
2. get the netboot files
3. prepare the tftp dir
4. mount the cd images
5. share the cd mount dirs
6. edit the pxelinux.cfg/default file
7. restart services


1. install dhcp3-server and tftpd-hpa
sudo apt-get install dhcp3-server tftpd-hpa

My /etc/dhcp3/dhcpd.conf:
ddns-updates on;
option domain-name "vstrom.local";
option domain-name-servers 192.168.0.2;
default-lease-time 86400;
max-lease-time 86400;
authoritative;
log-facility local7;

# vstrom
subnet 192.168.0.0 netmask 255.255.255.0 {
option domain-name-servers 192.168.0.2;
option domain-name "vstrom.local vstrom";
option subnet-mask 255.255.255.0;
range 192.168.0.50 192.168.0.59;
option routers 192.168.0.1;
ddns-update-style ad-hoc;
filename "pxelinux.0";
next-server 192.168.0.2;
}


My /etc/default/tftpd-ha:
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"


2. get the netboot files
lftp -c "open http://archive.ubuntu.com/ubuntu/dists/intrepid/main/installer-i386/current/images/; mirror netboot/"
sudo mv netboot/* /var/lib/tftpboot
rm -r netboot


3. prepare the tftp dir
cd /var/lib/netboot


All I have in the tftp dir is pxelinux.0 and pxelinux.cfg so just delete the rest
Now create a distribution folder for the ubuntu installations
mkdir -p ubuntu/{intrepid,intrepid-live,jaunty,jaunty-live}


4. mount the cd images
I mount my cd images in /media/
mkdir -p /media/{intrepid,intrepid-live,jaunty,jaunty-live}

My /etc/fstab entries for the images:
ubuntu-8.10-desktop-i386.iso  /media/intrepid-live udf,iso9660 user,auto,loop 0 0
ubuntu-8.10-alternate-i386.iso /media/intrepid udf,iso9660 user,auto,loop 0 0
jaunty-desktop-i386.iso /media/jaunty-live udf,iso9660 user,auto,loop 0 0
jaunty-alternate-i386.iso /media/jaunty udf,iso9660 user,auto,loop 0 0

(The paths to the isos are actually longer, like: /Public/OS/linux/...)

5. share the cd mount dirs
My /etc/exports entries (for nfs)
/media/intrepid-live   *(insecure,rw,no_root_squash,async,no_subtree_check)
/media/intrepid *(insecure,rw,no_root_squash,async,no_subtree_check)
/media/jaunty-live *(insecure,rw,no_root_squash,async,no_subtree_check)
/media/jaunty *(insecure,rw,no_root_squash,async,no_subtree_check)


6. edit the pxelinux.cfg/default file
My /var/lib/tftpboot/pxelinux.cfg/default which is read by tftpd-hpa at start or reload
DISPLAY boot.txt

DEFAULT intrepid_live

LABEL intrepid-live
kernel ubuntu/intrepid-live/vmlinuz
append root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.0.2:/media/intrepid-live file=preseed/ubuntu.seed initrd=ubuntu/intrepid-live/initrd.gz --

LABEL intrepid
kernel ubuntu/intrepid/linux
append vga=normal initrd=ubuntu/intrepid/initrd.gz --

LABEL jaunty-live
kernel ubuntu/jaunty-live/vmlinuz
append root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.0.2:/media/intrepid-live file=preseed/ubuntu.seed initrd=ubuntu/jaunty-live/initrd.gz --

LABEL jaunty
kernel ubuntu/jaunty/linux
append vga=normal initrd=ubuntu/jaunty/initrd.gz --

LABEL gparted
kernel gparted/vmlinuz1
append initrd=gparted/initrd1.img boot=live union=aufs noswap noprompt vga=788 fetch=http://192.168.0.2/gparted/filesystem.squashfs

LABEL grml
KERNEL grml/linux26
APPEND root=/dev/nfs rw nfsroot=192.168.0.2:/media/grml boot=live lang=us nomce quiet apm=power-off nodhcp noprompt noeject initrd=grml/initrd.gz vga=791

My boot.txt, just to type the boot commands available
=============================================
Ubuntu 9.04 Jaunty Jackalope
jaunty-live
jaunty (alternative install)

Ubuntu 8.10 Intrepid Ibex
intrepid-live
intrepid (alternative install)

Tools
gparted
grml


7. restart services
sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/tftpd-hpa restart