MavEtJu's Distorted View of the World - 2004-01

Upgrading via cvsup
Perl voodoo

Back to index

Upgrading via cvsup

Posted on 2004-01-22 11:47:45, modified on 2006-01-09 16:29:21
Tags: Computers, FreeBSD

Up to now, I always upgraded my FreeBSD computers via the mini-ISO cdroms provided by the FreeBSD team. Last week, due to circumstances, I had to upgrade them via cvsup and to build the new OS from scratch. A small step for me, a huge step for ME!

What were the circumstances?

At BarNet, there are about eight remote computers. On uninhabited places, like in cupboards, behind the copier, three meters above the floor and so on. Not easily reachable :-)

Also, the computers were running a huge range of OS versions, ranging from FreeBSD 4.2 to FreeBSD 4.9. With matching the OS version with the date the OS version was released you could figure out when the machine came into operation.

And the last thing was that we are going to provide ADSL backup features, which means that when the primary link fails, the traffic will go via a slower link. And zebra, the routing daemon we were going to use, doesn't really work with FreeBSD versions lower than 4.6.

Make the new system

  1. Step one: be brave. Be very brave.
  2. copy /usr/share/examples/cvsup/supfile-4.8 to /root/stable-supfile and change the fields "host" and "release". For host I used cvsup.au.freebsd.org, for tag I used RELENG_4_8_0_RELEASE.
  3. Run cvsup: cvsup -g /root/supfile-4.8
  4. Chdir to /usr/src and run "make -j4 buildworld" and "make -j4 buildkernel"
  5. That is enough for now. Nothing has been damaged yet. You can still chicken out.
  6. Run "make installkernel" and "make installworld". From now on programs can start failing. Reboot quickly!
  7. After the machine has come back (it's unbelievable but it will come back!), run mergemaster.sh in /usr/src/usr.sbin/mergemaster to update your configuration files. Make sure you don't overwrite your /etc/passwd and /etc/master.passwd files!
  8. Make a kernel specific for this machine and install that one.
  9. Reboot again

Was that now so difficult? No. So why have I struggled in the last seven years with cdroms? Must be because I had never done it before.

What went wrong

Of course things can go wrong. And will go wrong.

During one night I had xterms open to all machines which had to be upgraded (erm... all of them), running the make buildXXXX. With -j4, the load on the machine will swing between 5 and 10. We use nagios to monitor the systems, and it complained that their loads was too high. And since I'm not the only one receiving these alerts, I got phonecalls saying "what's wrong, what's wrong?". Inform your fellow people before you start.

First machine I upgraded went without a glitch. The second machine I did didn't come back up. So far for a foolproof solution. When I went to the console (next day early in the morning): fsck had failed. With other words, the harddisk is broken.

Two machines which had been given more networks cards recently didn't come back properly. It seemed the network cards were configured properly, but and the ifconfig_ statements added to /etc/rc.conf, but they had their (old, obsolete) "network_interfaces" variable in /etc/rc.conf not updated. A manual ifconfig and editing of /etc/rc.conf fixed it. (Don't forget to reboot afterwards to see if it works again, or at least restart the DHCP daemon since that daemon doesn't automaticly grabs new interfaces).

At the end

From now on, no more binary upgrades anymore for me, just cvsup and make! Yay!


Show comment | Share on Facebook | Share on Twitter

Perl voodoo

Posted on 2004-01-19 22:55:53, modified on 2006-01-09 16:29:21
Tags: Coding, Perl

A friend of me came up with this piece of code: (click on URL later). If you run it (with 5.6.1 or 5.8) it will complain that $c isn't specified. But then, if you rename the *c and $c to *b and $b, the program suddenly works.

This is even worse than black magic....

#!/usr/bin/perl -w
use strict;

package testexport;
sub testing {
    my $KEY = shift;
    print "KEY=[$KEY]\n";

    my $a = $::TEST_SINGLE;
    print "a=[$a]\n";

#   my $b = eval "\$::$KEY";
#   print "b=[$b]\n";

    no strict 'refs';
    local *c = $::{$KEY};
    use strict 'refs';
    print "c=[$c]\n";
}

package main;
$main::TEST_SINGLE = "hallo";
#my $TEST_SINGLE = "hallo";
testexport::testing("TEST_SINGLE");

(now rename the "local *c" to "local *b" and "$c" to "$b"...)


Show comment | Share on Facebook | Share on Twitter