Notes - FreeBSD Tips

.plan
[Last 5] [Last 10] [Index] [RSS Feed] [Full .plan]
Contact Me
Todo Chart (aka: How busy is Dylan?)

Research

ZFS Timeline Forensics
Honours Thesis
BSDCan 2014 Presentation
ZFS/ZDB Plaso Parsers

Notes

Notes
Security
Vim
C and C++
FreeBSD
more notes...

Software

Codepile
Assorted little scripts and apps.
rastodo.py
Commandline/Android ToDo list stored in a text file.
Android Apps
more software...

Game Mods

LethalMod
A Max Payne 2 mod - more realistic and deadly.
more mods...

RMITCS

C Helpdesk Resources
Customising Your CS Account
more RMITCS stuff...

Roleplaying Games

Shadowrun Notes(4th ed)
Heavy Gear Notes(2nd ed)
more RPG stuff...

Portfolio

Portfolio
Examples of my University work.

Miscellaneous

links
Old Image Gallery
Taglines
crazy
Trombone slide position chart [PDF]
[Back to home page]
[Back to Index]

[Raw XML]
Assorted FreeBSD stuff.

Contents:

The below notes are mostly from my .plan - I also have some notes cribbed from the FBSD mailing lists.

Build a port with the interactivity at the start

This is my recommended way to use ports:


make all-depends-list | less
make config-recursive build install clean

The first line lets you review the depends first in case the port will pull in a heap of stuff you don't want. The config-recursive target ensures all the config is done up front, rather than stopping the build a quarter of the way to ask more questions. Some ports will mess this up by asking questions at the non-config stages, unfortunately.

Redirecting or deleting port/package dependencies

This assumes you are managing your ports with one of the tools that reads /usr/local/etc/pkgtools.conf (e.g. portupgrade).

This won't prevent make from pulling independencies unless you define NO_DEPENDS (e.g. in /etc/make.conf).

Inside the ALT_PKGDEP section, map each port you want redirected to it's target. To delete dependencies, use :delete as the target. For example:


  ALT_PKGDEP = {
        'textproc/libxml' => 'textproc/libxml2',
        'devel/ORBit' => 'devel/ORBit2',
        'graphics/imlib' => 'graphics/imlib2',
        'textproc/ispell' => 'textproc/aspell',
        'media/gnome-media' => :delete, #gnome meta-ports won't pull this in
        'media/gstreamer' => :delete,
  }

Some libraries can't be redirected like this - for example, some GTK1.x programs will not build with GTK2.x. Remember, this only redirects the dependencies that portupgrade (et al) use when installing or upgrading ports. It won't remove existing ports or prevent you from installing the old ones directly.

Cutting down the buildkernel (and modules) time

First of all, create a custom kernel config and get rid of stuff you won't be using. I recommend building a GENERIC kernel as well as your custom one just in case.

Removing items from the kernel config won't stop make buildkernel from creating them as modules though. To stop the modules from being made.


WITHOUT_MODULES=ispfw if_bxe hpt27xx vxge hptrr sound ...

Keeping the locate database sane

Put any directories which you DON'T want scanned for locate(1) in the PRUNEPATHS var in /etc/locate.rc - for example:

PRUNEPATHS="/tmp /usr/tmp /var/tmp /var/db/portsnap /scratch"

Filesystems which are not of the type specified in /etc/locate.rc will not be scanned either.

Quick guide to tracking/updating FreeBSD-STABLE

This assumes you are using Subversion to track the source tree; you have already checked out the source into /usr/src; and you have modified make.conf KERNCONF appropriately to build a custom kernel if you want to (see below).


# cd /usr/src
# svn up
# rm -rf /usr/obj/*
   - (be careful!)
# make buildworld buildkernel installkernel
   - (now reboot into single user mode with new kernel)
   - (make sure /usr and the rest of the base hierarchy is mounted)
# cd /usr/src
# mergemaster -p
# make installworld
# mergemaster
# (optional) make delete-old
   - (get rid of /var/run/temproot when done merging)
   - (reboot into multi-user mode)
A few extra points:

Saving dump/backup space and RAID space

The following directories can easily be regenerated or downloaded again, so they can generally be excluded from backups and put on non-redundant storage.

If using dump for your backups, set the nodump flag (with "chflags nodump") on them. For other backup programs, there will be some mechanism to exclude directories (some will honour nodump as well).

An alternative to flagging them in some way is symlinking them to scratch space which is never backed up (i.e. /usr/obj -> /scratch/usr/obj/, where /scratch is nonredundant storage).

This might seem like trivial stuff at first glance, but on my systems the below usually take up more than the rest of /var, /usr and /home combined, so keeping them out of backups makes a massive difference to the number of volumes I need.

/usr/obj
Built from source, an obvious candidate for scratch storage.
/usr/src
Unless you have modified source, you can just download it again.
/usr/ports
As for /usr/src, just "portsnap fetch" it again unless you have modifications. Portsnap will clobber changes anyway, so if you do have changes they might need to be stored elsewhere anyway.
/usr/ports/distfiles
Even if you have a modified port tree, this one can definitely be excluded.
/var/db/portsnap
Portsnap's compressed copy of the stock ports tree, easily refetched.

Once-off Live UFS2 Dumps

Handy for moving filesystems to another disk/slice/partition.

 dump -0 -L -a [-f file or -p pipe] fsmountpoint
-0 full backup (no u so it doesn't touch the dumpdates file)
-L live filesystem - if you specify this dump will take a UFS snapshot and dump that. Ignored on a read only or unounted fs.
-a auto-size (so it writes all to the one file instead of doing volumes... over the first volume file and breaking it)

-h 0 Honour the nodump flag for full (level 0) dumps. Default is to ignore nodump unless doing an incremental dump.

-f file (can be - for stdout)
-p pipecommand (e.g. bzip2 or somesuch)

Random Hints for port authors/maintainers

Most importantly, TELL THE USER ABOUT IT. And not somewhere in the middle of the build process where it's going to be missed. Do it at the start with a pause for config/build options, and at the end for defaults and post-install configuration.

Getting apache/php/perl slave ports to work


mod_ssl only ever seems to work properly if installed with Apache (rather than adding it later), so make sure you choose apache*-modssl* or add the make options when you install. Judging from assorted newsgroups and forums this seems to be a common problem. However, many things (like php*) have dependencies on "apache13" or "apache2" and not any extended packages/ports. Once you figure out what to do it is actually very easy to fix, just add the line "APACHE_PORT=www/apache13-modssl" (or similar) to /etc/make.conf . Thanks go to Dr. Matthew J Seaman in the FreeBSD mailing lists for pointing me in the right direction. http://lists.freebsd.org/pipermail/freebsd-questions/2004-April/043816.html
Generated Sat, 17 Jan 2015 11:14:49 +1100
Copyright © 2002-2014 Dylan Leigh.
[HTML 4.01 Transitional]