ootput burst!

the lively meanderings of an idle mind

RSS

 1 2 3  12 Next →

  • Parse /usr/ports/UPDATING for Relevant Issues

    Jan 19, 2012 0 Comments

    Tired of sifting through /usr/ports/UPDATING for notes that affect only those packages installed on your system?

    Tired of grepping for issues that may have arisen from/to certain dates?

    pkg_updating(1) analyses /usr/ports/UPDATING and does the heavy lifting for you.

    To obtain the relevant entries from, say, two weeks ago, do:

    # /usr/sbin/pkg_updating -d $(/bin/date -v-2w +%Y%m%d)

    Use:

    • -v-1d for a day;
    • -v-1m for a month;
    • -v-1y for a year, and so on.
     
  • Rebuild All Installed FreeBSD Ports

    Dec 30, 2011 0 Comments

    Firstly, read /usr/ports/UPDATING for any advisories for package updates.

    Also, to list ports with issued warnings, do:
    # portaudit -a

    Once you are confident that the advisories for affected packages are negligible, issue:
    # DISABLE_VULNERABILITIES=yes portmaster -R -a -f -B -C -d

    From portmaster(8):
    -R skips ports updated on the previous run
    -a checks all ports and updates when needed
    -f forces build
    -B prevents portmaster from creating a backup package
    -C prevents # make clean from being executed before the build
    -d always clean distfiles

    DISABLE_VULNERABILITIES=yes prevents portmaster from aborting when an 'unsafe' port is encountered.

     
  • Import FreeBSD Root ZPool to Other Environments

    Dec 30, 2011 0 Comments

    While testing various memory disk filesystems in FreeBSD, I intelligently made changes to /etc/fstab that pointed to non-existent mountpoints (zroot/usr/home did not exist until later in the boot process - and the system refused to boot into FreeBSD due to mounting errors.)

    To remedy this, I booted into my Ubuntu Oneiric installation, which fortunately supported native ZFS. Using the following commands, I was able to mount my root partition zpool - zroot - to make the necessary adjustments to /etc/fstab.

    In Ubuntu, as root, list the available zpool imports with:
    # zpool import

    This will reveal all existing zpools found on all disk drives. Check to see if the zpool can be properly imported by reading the state, status, and action descriptions of the zpool.

    Continuing on, create a temporary mountpoint for the zpool:
    # mkdir -p /mnt/zpool_temp

    Then import the zpool:
    # zpool import -N -R /mnt/zpool_temp zroot

    To confirm this worked, do:
    # zfs list

    Also, note the dataset's original mountpoint value with:
    # zfs get mountpoint zroot

    Then:
    # zfs set mountpoint=/mnt/zpool_temp zroot
    # zfs mount zroot

    This will temporarily mount the root zpool R/W at /mnt/zpool_temp, allowing you to make the necessary changes.

    After you are done making changes to the mounted dataset, while making sure that it is no longer in use:
    # zfs unmount zroot

    Then, reset the mountpoint to it's original value:
    # zfs set mountpoint=/ zroot

    Now reboot the machine without exporting the zpool - this is very important.

    Your FreeBSD should now boot properly.

     
  • Move Chromium's Cache to MFS Memory Disk on FreeBSD

    Dec 30, 2011 2 Comments

    From md(4):

    The md driver provides support for four kinds of memory backed virtual disks: ... swap: Backing store is allocated from buffer memory. Pages get pushed out to the swap when the system is under memory pressure, otherwise they stay in the operating memory. Using swap backing is generally preferable over malloc backing.

    Chromium's cache is at $HOME/.cache/chromium, and so, my /etc/fstab contains:

    # 256M mfs for google chrome
    /dev/md0 /home/ootput/.cache/chromium mfs rw,-s256m,-wootput:ootput,noauto 2 0
    

    From mount_mfs(8):
    -s256m specifies a memory reservation of 256 M;
    -wootput:ootput hands ownership of the mountpoint from root to the user; and
    noauto prevents the system from failing to boot properly if the mountpoint does not (yet) exist.

    The following additions to /etc/rc.conf were also made:

    mdconfig_md0="-t swap -s 256m"
    mdconfig_md0_owner="ootput:ootput"
    mdconfig_md0_perms="1777"
    

    which lists arguments to mdconfig(8) for device md0.

    At mininum the -t type must be specified and either a -s size for malloc or swap backed md(4) devices or a -f file for vnode backed md(4) devices.

    The redundancies found in fstab and rc.conf allows automatic mounting at boot, or manual mounting after boot.

    To test the changes made, as root:
    # /etc/rc.d/mdconfig restart

    On to the $USER/bin/pack_chrome executable script that will both mount the md device, and/or sync contents from the cache at RAM to a backup cache on the HDD:

    #!/usr/local/bin/bash
    
    CACHE="$HOME/.cache/chromium"
    BACKUP="$CACHE.bak"
    
    for DIR in $CACHE $BACKUP; do
       if [ ! -d "${DIR}" ]; then
          mkdir -p ${DIR}
       fi
    done
    
    if test -z "$(/sbin/mount | grep -F "$CACHE" )"; then
        sudo /sbin/mount "$CACHE"
    fi
    
    if test -f "$CACHE/.synced"; then
        rsync --exclude '.synced' --exclude '.snap' --delete -avrPx \
            "$CACHE/" "$BACKUP"
    else
        rsync --delete -avrPx "$BACKUP/" "$CACHE"
        touch "$CACHE/.synced"
    fi
    

    The script requires that the $USER is in sudoers(5), and is able to use the /sbin/mount command.

    Finally, after $ crontab -e:

    */30 * * * * $HOME/bin/pack_chrome >/dev/null 2>&1
    

    .. the script gets called every half-hour to automate the syncing process. This also requires that $USER is specifically allowed in /var/cron/allow.

     
  • Upgrading to FreeBSD 8-Stable

    Dec 27, 2011 0 Comments

    As a reminder to myself:

    # pkg_add -r fastest_cvsup
    # fastest_cvsup -c all

    In /root/stable-supfile, have:

    *default host=cvsup.au.freebsd.org
    *default base=/var/db
    *default prefix=/usr
    *default release=cvs tag=RELENG_8
    *default delete use-rel-suffix
    *default compress
    src-all
    

    # csup /root/stable-supfile

    # cd /usr/src
    # rm -r -f /usr/obj
    # script /var/tmp/buildworld-$(date "+%Y%m%d%H%M.%S")
    # make -jX buildworld ( where X == number of CPUs + 1 )
    # exit
    # script /var/tmp/buildkernel-$(date "+%Y%m%d%H%M.%S")
    # make buildkernel KODIR=/boot/testing KERNCONF=CUSTOM64
    # make installkernel KODIR=/boot/testing KERNCONF=CUSTOM64
    # exit
    # nextboot -k testing
    # shutdown -r now

    # cd /boot
    # rm -r -f OLD
    # mv kernel OLD
    # mv testing kernel

    # adjkerntz -i
    # mergemaster -p
    # cd /usr/src
    # make installworld
    # mergemaster -iU
    # make delete-old
    # shutdown -r now

     
  • Custom Kernel Config for FreeBSD 8-Stable

    Dec 27, 2011 0 Comments

    In /usr/src/sys/amd64/conf/CUSTOM64, I have:

    include GENERIC
    machine amd64
    cpu	HAMMER 			# aka K8, aka Opteron & Athlon64
    nocpu   i486_CPU
    ident   CUSTOM64
    nomakeoption DEBUG
    
    ## No IPv6
    nooptions       INET6
    nooptions 	SCTP		# Stream Control Transmission Protocol
    
    ## No Debugging stuff
    nooptions INVARIANTS
    nooptions INVARIANT_SUPPORT
    nooptions WITNESS
    nooptions WITNESS_SKIPSPIN
    
    nodevice        eisa
    
    nodevice        fdc
    
    ## Disable various ATA systems we will never have
    nodevice	atapicd		# ATAPI CDROM drives
    nodevice	atapifd		# ATAPI floppy drives
    nodevice	atapist		# ATAPI tape drives
    
    nooptions 	MSDOSFS		# MSDOS Filesystem
    nooptions 	CD9660		# ISO 9660 Filesystem
    
    device          ahci
    
    nodevice 	urio
    nodevice 	uscanner
    nodevice 	aue
    nodevice 	axe
    nodevice 	cdce
    nodevice 	cue
    nodevice 	kue
    nodevice 	rue
    
    # PCMCIA and cardbus bridge support
    nodevice	cbb		# cardbus (yenta) bridge
    nodevice	pccard		# PC Card (16-bit) bus
    nodevice	cardbus		# CardBus (32-bit) bus
    
    # Parallel port
    nodevice	ppc
    nodevice	ppbus		# Parallel port bus (required)
    nodevice	lpt		# Printer
    nodevice	plip		# TCP/IP over parallel
    nodevice	ppi		# Parallel port interface device
    
    # FireWire support
    nodevice	firewire	# FireWire bus code
    nodevice	sbp		# SCSI over FireWire (Requires scbus and da)
    nodevice	fwe		# Ethernet over FireWire (non-standard!)
    nodevice	fwip		# IP over FireWire (RFC 2734,3146)
    nodevice	dcons		# Dumb console driver
    nodevice	dcons_crom	# Configuration ROM for dcons
    
     
 1 2 3  12 Next →