Home|Cudeso|Linux|*NIX / BSD|Misc|
 

Installation - info

Contents

1. Package location

2. Misc config

3. Setting time

4. Network configuration

5. Build a new kernel

6. Startup-daemons

7. File-permissions

8. Login-banner

9. pf-logging

10. slow boot

11. Preventing /etc/resolv.conf from being overwritten

12. Problems compiling gnupg-1.2.4 on OpenBSD 3.4.

13. Building the install floppy

14. Move a directory to another partition





1. Package location

setenv PKG_PATH ftp://ftp.cudeso.be/pub/OpenBSD/3.4/packages/i386/
pkg_add ${PKG_PATH}bash-2_0.tgz
If you want bash as your shell, you should add it to /etc/shells

2. Misc config

cp /etc/rc.conf /etc/rc.conf.local
Uncomment the last rule in /etc/rc.conf

Update /etc/skel/.profile
PS1='\u@\h (\w))$ '

3. Setting time

Make this a cronjob:
rdate -ncv ntp.cudeso.be

4. Network configuration

Adjust your host-settings in /etc/<hostname>.ep0

/etc/sysctl.conf
net.inet.ip.forwarding=1

/etc/rc.conf
pf=YES

/etc/rc.local
if [ -x /usr/local/sbin/ddclient ]; then
        echo -n ' ddclient';        /usr/local/sbin/ddclient
  echo -n ' '
fi

5. Build a new kernel

Before you can build a new kernel you have to make sure that all the source files are already there. Fetch the file src.tar.gz from your favorite mirror and place it in /usr/src and extract it.
cd /usr/src
ftp ftp://ftp.openbsd.org/pub/OpenBSD/3.7/src.tar.gz
tar zxvf src.tar.gz

cd /usr/src
cvs -d anoncvs@anoncvs2.usa.openbsd.org:/cvs -q up -rOPENBSD_3_7 -Pd

cd /usr/src/sys/arch/i386/conf
/usr/sbin/config GENERIC
cd /usr/src/sys/arch/i386/compile/GENERIC
make clean && make depend && make

cd /usr/src/sys/arch/i386/compile/GENERIC
cp /bsd /bsd.old (Save an old copy of your kernel)
cp bsd /bsd (Copy the new kernel into place)
reboot

To rebuild the system binaries:
cd /usr/src
rm -r /usr/obj/*
make obj && make build

6. Startup-daemons

/etc/rc.conf
inetd=NO
check_quotas=NO
portmap=NO
ntpd=NO

/etc/ssh/sshd_config
Protocol 2
PermitRootLogin no

/etc/inetd.conf
#rstatd/1-3 dgram rpc/udp wait root /usr/libexec/rpc.rstatd rpc.rstatd
#rusersd/1-3 dgram rpc/udp wait root /usr/libexec/rpc.rusersd rpc.rusersd

7. File-permissions

run this script
#!/bin/sh

ETCFILE={/etc/hosts.allow,/etc/hosts.deny,/etc/inetd.conf,/etc/login.conf,/etc/rc,/etc/rc.conf, \
              /etc/rc.local,/etc/rc.securelevel,/etc/rc.shutdown,/etc/netstart, \
              /etc/syslog.conf,/etc/pf.conf,/etc/nat.conf}
SECFILE={/etc/changelist,/etc/security}

for file in $ETCFILE; do
 chmod o-rwx $file
done

for file in $SECFILE; do
 chmod o-rwx $file
done

8. Login-banner

put this in /etc/rc
# patch /etc/motd
if [ ! -f /etc/motd ]; then
install -c -o root -g wheel -m 664 /dev/null /etc/motd
fi

T=`mktemp /tmp/_motd.XXXXXXXXXX`
if [ $? -eq 0 ]; then
##
# cudeso.be :: Custom banner

  echo "" > $T
  echo "Welcome to "`hostname` >> $T
  echo "" >> $T
  echo "**********************************************************************" >> $T
  echo "                                 NOTICE" >> $T
  echo "**********************************************************************" >> $T
  echo "" >> $T
  echo "This computer system is the private property of cudeso.be. " >> $T
  echo "It is for authorized use only. Users (authorized or unauthorized) " >> $T
  echo "have no explicit or implicit expectation of privacy." >> $T
  echo "" >> $T
  echo "Users not authorized by cudeso.be are not allowed to log on by " >> $T
  echo "any means onto this system. Unauthorized users should log off " >> $T
  echo "immediately!" >> $T
  echo "" >> $T
  echo "Authorized users only, ref. Wet van 28/11/2000 inzake " >> $T
  echo "Informatiecriminaliteit, Het Belgisch Staatsblad, 03.02.2000, p. 2909 " >> $T
  echo "" >> $T
  echo "**********************************************************************" >> $T
        cmp -s $T /etc/motd || cp $T /etc/motd
        rm -f $T
fi

9. pf-logging

tcpdump -n -e -ttt -i pflog0

10. slow boot

When I installed OpenBSD 3.4 on really old hardware I had some trouble booting the system. When 'boot' was checking for the attached hardrives, it took for almost 10 minutes to detect that there were no master or slave on the secundary harddrive-controller. This had nothing to do with hardware-problems because the machine had previously run Linux for 3 years without any trouble.

A search on the net gave me a possible solution, James Dahlgren offered a useable solution on deadly.org. (http://www.deadly.org/article.php3?sid=20031106192213).

In the file diskprobe.c there is a loop that counts from 0x80 to 0x88. When I modified this to 0x82 (and so indicating that it should only check for two drives) my system booted properly, without long timeouts. Now, it takes a little more than just modifying this file. These are the steps that I do. Off course, when you're going to add drives, you need to adjust the values to your need.

If you already have the sources then you can skip the first two steps (in fact, I'm not really sure they are needed).
  • download and unpack the base-sources
    cd /usr/src
    tar zxvf src.tar.gz
  • update your source tree to the latest CVS-version
    export CVSROOT=anoncvs@anoncvs.be.openbsd.org:/cvs
    cd /usr/src
    cvs -d $CVSROOT -q up -rOPENBSD_3_4 -Pd


  • open /usr/src/sys/arch/i386/stand/libsa/diskprobe.c
  • search for these lines, and adjust as needed
    /* Probe for all BIOS hard disks */
    static void
    hardprobe(void)
    {
            struct diskinfo *dip;
            int i;
            u_int bsdunit, type;
            u_int scsi = 0, ide = 0;
    
            /* Hard disks */
    /*        for(i = 0x80; i < 0x88; i++) {  */
            printf("\ncheck for two disks only\n");
            for(i = 0x80; i < 0x82; i++) {
                    dip = alloc(sizeof(struct diskinfo));
                    bzero(dip, sizeof(*dip));
    
                    if(bios_getdiskinfo(i, &dip->bios_info)) {
    #ifdef BIOS_DEBUG
                            if (debug)
                                    printf(" <!hd%u>", i&0x7f);
    #endif
                            free(dip, 0);
                            break;
                    }
    
  • go up one level to /usr/src/sys/arch/i386/stand/
  • compile
    make depend && make
  • reboot with the floppy34.fs image (this means, reboot with the floppy wich you used to install OpenBSD)
  • choose for Shell (and off course, not Install or Upgrade)
  • mount your drive (I'm using wd0a)
    mount /dev/wd0a /mnt
  • make a backup of the present boot and copy the new one
    cp /mnt/boot /mnt/boot-old
    cp /usr/src/sys/arch/i386/stand/boot/boot /mnt/boot
  • install the new boot-image
    /usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot wd0
  • unmount the drive and reboot
    umount /mnt
    reboot

11. Preventing /etc/resolv.conf from being overwritten

/etc/dhclient.conf
initial-interval 1;
send host-name "myhost";
supersede domain-name "cudeso.be";
supersede domain-name-servers 192.168.1.1;
request subnet-mask,
        broadcast-address,
        routers,
        host-name;

12. problems compiling gnupg-1.2.4 on OpenBSD 3.4.

I had this problem when I was compiling GnuPG 1.2.4 on a freshly installed OpenBSD 3.4 :
...
_mpih-mul1.s: Assembler messages:
_mpih-mul1.s:114: Error: Alignment not a power of 2
_mpih-mul1.s:132: Error: Alignment not a power of 2
gmake[2]: *** [mpih-mul1.o] Error 1
gmake[2]: Leaving directory `/usr/local/src/gnupg-1.2.4/mpi'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/local/src/gnupg-1.2.4'
gmake: *** [all] Error 2
A bit of googling directed me towards a patch from David Shaw
Index: config.links
===================================================================
RCS file: /cvs/gnupg/gnupg/mpi/config.links,v
retrieving revision 1.30.2.6
diff -u -r1.30.2.6 config.links
--- config.links        2 Dec 2003 05:13:35 -0000       1.30.2.6
+++ config.links        29 Dec 2003 20:32:09 -0000
@@ -62,6 +62,11 @@
        cat  $srcdir/mpi/i386/syntax.h   >>./mpi/asm-syntax.h
        path="i386"
        ;;
+    i[34567]86*-*-openbsd3*)
+       echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
+       cat  $srcdir/mpi/i386/syntax.h   >>./mpi/asm-syntax.h
+       path="i386"
+       ;;
 # Use old assembler syntax for OpenBSD as their assembler is really old.
     i[34567]86*-*-openbsd*)
        echo '#define BSD_SYNTAX' >>./mpi/asm-syntax.h
It all worked out after applying this patch with
cd gnupg-1.2.4/mpi
patch < /the/path/to/the/saved/patch/file
cd ..
./configure
make
The google-thread that I followed was : http://lists.gnupg.org/pipermail/gnupg-users/2003-December/021156.html

13. Building the install floppy

This is all very well described in the FAQ but I just put it here as a reminder.
fdformat /dev/floppy/0
dd if=/tmp/floppy37.fs of=/dev/floppy/0 bs=32k

14. Move a directory to another partition

First create the partition with disklabel.
disklabel -E wd0
Put an new filesystem on it
newfs wd0j
Mount it on a temporary location
mount /dev/wd0j /mnt/tmp
Copy all the files to this location (this will copy /usr/local to the new location)
cd /usr/local; find -d . -print | cpio -pvdum /mnt/tmp
Update the file /etc/fstab with the new location.
/dev/wd0j /usr/local ffs rw 1 1
Now reboot into single user mode (issue boot -s on the boot-prompt) Move the existing directory to an new location and create a new one. Watch it, it is possible that you have to mount /usr in the case that you are moving /usr/local.
mv /usr/local /usr/local-old
mkdir /usr/local
Now reboot and behold the magic! ;-)
Copyleft 2002-2007 - cudeso.bewebmaster@cudeso.betop