FreeBSD Stable Release 6.0 Installer  Guide

Home______________________________________________________________________

 

Managing your configuration changes

Experience has taught me that it's a very good procedure to make a copy of all the configuration files you change during the process of configuring your FBSD system. You can copy them to a floppy for safe keeping just in case you happen to lose your hard drive where you cannot even boot from it or to install the next stable version of FBSD and populate it with your saved configuration files. My floppy containing only the changed configuration files has saved my butt before, and I highly recommend you do the same. You will be surprised at how few of the FBSD config files you really change during the process of installing your operating system and that they are mostly in the /etc directory. When you install ports or packages they also have config files that you may have to configure. Those files should also be saved. Then there are the password files, the group file and the log files you may have created to support new applications. I call these the primary config files which make your installation unique from all the other systems.

I find that having a single floppy that contains all the primary config files in a matching directory tree structure is very convenient when I install the next stable production release from scratch. All I have to do is copy the files from the floppy to their normal locations with one command and I have my basic system all configured.

Installer Note: The concept presented here is just a skeleton directory configuration to convey how to set it up and use it. There will be other directories which contain configuration files. It’s your responsibility to modify the /custom directory to contain these other directories and the backup and restore scripts so they work correctly with the additional directories you added.

I create a directory named custom off the / base directory. Then make the directory tree inside it for the directories that contain the config files I change.

Follow these commands

cd /             # point to the base of the FBSD directory tree
mkdir custom     # create directory named custom
cd /custom       # change into custom directory
mkdir root       # create sub-directory named root
mkdir etc        # create sub-directory named etc

Example: Following the instructions in the installer's guide you changed the /root/.cshrc file, so you would make your backup copy this way

cd /root       # Change into the directory where the file lives

cp .cshrc /custom/root/

Here is some information you need to know about the copy command.

The cp command has mandatory fields that must be there for the command to work. The 'from location' and the 'to location'. In the above example you changed into the location where the file to be copied lives, so there was no requirement to give the path as part of the from location. As in:

cp /root/.cshrc /custom/root/

If you happened to leave the last / off the 'to location'

cp .cshrc /custom/root

then the file would be copied to the /custom directory and renamed as root. This was not what you wanted to do. As you see, the syntax of the from and to location is very important. Every time you change a configuration file, you have to copy it to the correct location in the /custom tree directory.

 

Personal Scripts

FBSD is a command line driven operating system. It's very hard to remember where all the config files are and what they are called. You have to be constantly working on your FBSD systems on a daily basis to remember all the commands you use to do repetitive things. I found that if I build a simple shell script and place the command I use, or the sequence of commands I used to perform repetitive tasks, I can give the script a long name that self describes what it does. All users have a bin directory which they can save their canned scripts in. The users bin directory is not created as part of the FBSD install so you must make one for root.

cd /root

mkdir bin

Now lets say for example I use IPFILTER for my firewall. I repeatedly edit the filter rules, load the rules, edit the NAT rules, and load the NAT rules. I simplify these admin functions by creating simple scripts with meaningful names.

ipf.edit.rules
ipf.load.rules
ipf.edit.natrules
ipf.load.natrules

Here is how to create simple script.

cd /root/bin

ee ipf.edit.rules

#! /bin/sh
ee /etc/ipf.rules

Close and save the file.

ls -l     # will show you that this file only has read and write permission. It needs execute permission to run.

chmod 700 ipf.edit.rules   # give it execute permission for root owner only

rehash    # let the shell know about it

Enter ipf.edit.rules on the command line, and you find yourself looking at the screen displaying your rules file open and ready to edit.

Every time you want to create another script, copy an existing one and it will already have the correct permissions to execute.

 

Script to Backup /custom to floppy

#! /bin/sh
echo " "
echo "Script to copy /custom directory to floppy for bkup"
echo " floppy disk must be in drive first for this to work"
echo ' '
# Prepare the floppy to receive data
echo " "
echo "Deleting contents of floppy"
mount /a
rm -rfv /a
echo ' '
echo 'Copying custom to floppy'
cp -rpfv /custom/ /a/
umount /a
echo "Custom Image backup to floppy completed"
echo "and /a is unmounted"

 

Script to Restore floppy to /custom

#! /bin/sh
# script to restore FBSD SYS config files from custom bkup floppy
# to new fresh install of FBSD.
#
cd /
mkdir /custom # make custom directory
mkdir /a # make mount point for floppy drive
cd /root # root/bin is default search path for scripts
mkdir bin # Home of all custom scripts

echo 'Copying floppy custom to Hard Drive custom directory'
cp -rpfv /a/ /custom/

# copy custom files to there homes in FBSD
cd /
cp -rpfv /custom/etc/ /etc/
cp -rpfv /custom/root/ /root/ >
echo "CUSTOM RESTORE COMPLETED"

 

Burncd and .iso files

The FBSD handbook has a good section on creating CDs which gives a general overview. see:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/creating-cds.html

As FBSD releases each new stable production version to the public, they create install CD's. A compressed image .iso file is stored on the FBSD FTP mirror sites for people to download to their systems. This .iso file has to be written to a CD  before it can be used to install the new version of FBSD on your system. The miniinstall.iso file is the smallest, because it does not contain any of the ports collection. It does contain everything necessary to install FBSD on your system. The .iso files are very large so you have to put it somewhere on your hard drive where you have room. Below is the pre-canned script I use to get the miniinstall.iso file. Notice that I am using the fetch program so the download can be resumed if an interruption occurs.

 

Mini.iso FTP download script

#! /bin/sh
# There is not enough disk space on the FBSD slice to hold the
# iso-image of the new FBSD miniinstall.iso version file.'
# so putting it in /usr where most of the free space is allocated
# replace the 4.10 with the version number you want to download

cd /usr
path="pub/FreeBSD/releases/i386/ISO-IMAGES"
fetch -avrAF ftp://ftp.FreeBSD.org/$path/4.10/4.10-RELEASE-i386-mini.iso
fetch -avrAF ftp://ftp.FreeBSD.org/$path/4.10/CHECKSUM.MD5
echo ' '
echo ' '
echo 'Run these steps to verify download is good'
echo 'ls -l to verify file sizes'
echo 'md5 4.10-RELEASE-i386-miniinstall.iso >> CHECKSUM.MD5 to create value & append to end of file'
echo 'ee CHECKSUM.MD5'
echo 'second to last line = official hash value'
echo 'last line = downloaded file hash value'
echo 'if they do not match download again'
echo ' '

 

Burncd command

Be sure CD-writer drive contains a blank CDROM in it. For info on what the option flags mean, see 'man burncd' man page.

burncd -v -f /dev/acd0c -s 8 -e data /usr/4.9-i386-mini.iso fixate

 

Technical Support

FBSD is an all volunteer supported operating system. There is not any phone number to call to get technical support. The only avenue is the official mailing lists and the lists archives. See the following link for a list of the different mailing lists and instructions on how to subscribe to the mailing list of your choice.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/eresources.html#ERESOURCES-MAIL

The mailing list you should subscribe to is the FreeBSD-Questions list. Not only is it the list to ask your questions on, but it is the list most experienced users routinely read. It has the largest number of subscribers and has a large amount of traffic (IE: 30 to 100 posts per day). The volume goes up as new development releases are prepared to deploy as stable releases. You can learn a lot from just reading the posts for help and their replies.

When you need help with something you should first review the appropriate man pages on your system or use the online FBSD command lookup function for manual documentation on the command. http://www.freebsd.org/cgi/man.cgi

Then search the questions list archives at http://docs.freebsd.org/mail/archive/2004/freebsd-questions/

Or select one of the other official archives which may be more appropriate:

http://docs.freebsd.org/mail/archive/2004/

These official FBSD archives are not user friendly and do not have search ability.

http://freebsd.rambler.ru/  has search ability, but it does not present the posts in thread form. Instead individual posts are displayed which is harder to navigate around.

This is the search URL I use, http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&group=lucky.freebsd.questions

It uses the lucky.freebsd.question news group. It’s only 8 hours behind the realtime activity on the FBSD questions list. It presents the answers to your search in thread format. Be sure to click on option to search within this newsgroup, or it will search all newsgroups which dilutes the results.

When searching the archives don’t bother going back further than 24 months, generally information older than that is outdated as it does not reflect the current stable release.

When it comes time to submit a request for help to the questions list, the email subject line is the most important field to fill in when asking a question. Manny readers just blow right by any post that has blank subjects or subjects that have been covered in the list in the past few months. They know you have not done your homework. Always try to write the subject so it’s easy for the reader to understand what your question is about.

The general rule is you can never post to much information about your problem in the body of your email. Always say what FBSD version you are running, the age of the PC, and what hardware it uses. Post the full content of any config files that may shed light on your problem, like /etc/rc.conf, /var/run/dmesg.boot, firewall rules file, whatever. The more info you post the better the answer you will receive. Specially if you are a newbie and don’t know the technical words to use, the more you describe the environment in your own words, the easier it is for the reader to comprehend what you are trying to say.

Nothing ticks off a responder to your post more than to see another post later from you where it’s obvious you did not try the responders solution. If you are not going to take the responders advance, you have no business posting to the questions list in the first place. You will be labeled as a troll and people will ignore your posts as background noise. You know the story about the sheepherder boy who called wolf.

When someone goes off list to work with you one on one, consider yourself privileged. When you have a solution that you have tested, it’s a courtesy to post the solution to the list using the original subject line so the next person can find it in the archives.

______________________________________________________________________

This FreeBSD Installer Guide is an public domain HOW-TO.  This content may be reproduced, in any form or by any means, and used by all without permission in writing from the author.