SDCXTRA RADIO

Thursday, March 19, 2009

Upgrading a Node using FreeBSD - Part Ten

Upgrading a Node using FreeBSD

Upgrading a Soekris 4526 using FreeBSD

This how-to document is designed to walk people through the process of upgrading the CUWiN software on a Soekris 4526 board using a FreeBSD operating system.

Software Requirements

    • FreeBSD [OpenBSD and NetBSD commands are similar enough that proficient users should be able to translate the FreeBSD commands offered here. Linux is similar as
      well, though the prompts and commands may differ somewhat.)
    • Wget
    • ssh client and server

Hardware Requirements

    • One Ethernet port
    • One crossover cable
    • One cat5e cable
    • One power-over-ethernet injector [POE]

Conventions

Three different command line prompts will be used: # indicates the normal user; $ indicates the root user; and > indicates a prompt from the node. All key strokes (e.g. Shift, Control, Enter, etc...) will use the following syntax: [e.g. , , etc.].

VI Tutorial

For text editing, we use VI, but feel free to use whatever text editor you like. Some useful vi commands:
- enter the edit mode to change text
- to escape the edit mode
:q! - to exit without saving changes
zz - to save changes and exit

STEP 1: GETTING THE SOFTWARE IMAGE

H. The easiest way to get the software for your node is to go to http://cuwireless.net/download#Update and download the upgrade file for your hardware. Download it and place it in your home directory.

Step 2: Start SSHD and login to node [You will need root privileges for this step.]

I. Start SSH server by entering the following command:

      1. $ /etc/rc.d/sshd start

J. Plug the crossover cable into your computer's Ethernet port and the "Data" port on the POE injector. Make sure that the POE injector has power [there should be a green light on top to indicate that it has power].

K. To find the node's IP address:

      1. $ ifconfig -a
      2. Find your ip address. Look for a line similar to:
        inet 10.23.54.27 netmask 0xffffff00 broadcast 10.23.54.255
      3. Record the number following “inet”. Record this a second time, replacing the digits following the last period with “254”. In our example, this would be 10.23.54.254 – this is the ip address of the node.

L. Login to the node using the following command and the ip address of node, found in the previous step:

      1. $ ssh root@10.23.54.254

M. Update the node

      1. Log into the node using the root password. The username is “root” and the default password is “changme”. If you have changed the password, use that password.

N. This command makes the backspace key work the way we expect it to. Its not required, but prevents many headaches when you make a typo.

      1. $ stty erase Control-v

O. Now, upgrade the node. Replace “blah” with your username on your local machine, and the ip address with the ip address of your machine (from step C.2). The “~” stands for you home directory. If the file is not in your home directory, replace “~/” with the correct path to the upgrade file. Also, replace “upgrade.tgz” with the correct name of the upgrade file that you downloaded from the website. If you wish to erase the current configuraton file on the node and use the default one provided in the upgrade, replace the “-f” with a “-C -f”.

      1. $ upgrade -f blah@10.23.54.27:~/upgrade.tgz
      2. When prompted with the following:
3.                           “The authenticity of host '10.23.54.27 (10.23.54.27)' can't be established. 
4.                             DSA key fingerprint is a8:75:fe:7d:46:b7:a8:05:65:77:43:7a:67:e7:a4:fc.
  Are you sure you want to continue connecting (yes/no)?”

Respond by typing “yes”.

      1. When prompted to enter your password, enter the password you use to login to your local machine (and that corresponds to the username you used when you issued the “upgrade” command).
      2. If that is successful, you should see something like this:
7.                            
8.                             fdisk: DIOCGDEFLABEL: Invalid argument
9.                             fdisk: DIOCGDINFO: Invalid argument
10.                          Disk: /dev/rwd0d
11.                          NetBSD disklabel disk geometry:
12.                        cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
13.                          total sectors: 125056
14.                         
15.                          BIOS disk geometry:
16.                        cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
17.                          total sectors: 210453442400
18.                         
19.                          Partition 0:
20.                          NetBSD (sysid 169)
21.                        start 32, size 62512 (31 MB, Cyls 0-488/2/17)
22.                          Making partition 0 active.
23.                          Preparing for upgrade on /dev/wd0e.
24.                          /dev/rwd0e: 30.5MB (62512 sectors) block size 8192, fragment size 1024
25.                          using 4 cylinder groups of 7.63MB, 977 blks, 1920 inodes.
26.                          super-block backups (for fsck_ffs -b #) at:
27.                          32, 15664, 31296, 46928,
28.                          Installing the upgrade.
29.                          The authenticity of host '10.23.54.27 (10.23.54.27)' can't be established.
30.                          DSA key fingerprint is a8:75:fe:7d:46:b7:a8:05:65:77:43:7a:67:e7:a4:fc.
31.                          Are you sure you want to continue connecting (yes/no)?yes
32.                          Warning: Permanently added '10.23.54.27' (DSA) to the list of known hosts.
33.                          Password:
34.                          100% |*************************************|  4041 KB  237.68 KB/s    --:-- ETA
35.                          Updating etc/fstab
36.                          Updating primary bootstrap
37.                          Updating active partition
38.                          Disk: /dev/rwd0d
39.                          NetBSD disklabel disk geometry:
40.                        cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
41.                          total sectors: 125056
42.                         
43.                          BIOS disk geometry:
44.                        cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
45.                          total sectors: 210453442400
46.                         
47.                          Partition 1:
48.                          NetBSD (sysid 169)
49.                        start 62544, size 62512 (31 MB, Cyls 488/2/17-977)
50.                          Making partition 1 active.
51.                          Copying existing /etc/cuw_config.
52.                          Upgrade complete (/dev/wd0e).
53.                        #
  

P. After that runs, type the following at the command line to reboot the node:

a. $ reboot

Q. The node begins to reboot and you are disconnected from the ssh session. Wait a couple minutes and verify that the node is back up and operational. If it is not, please consult our troubleshooting section.

Flashing a Soekris 4526 Node using FreeBSD: Introduction

This how-to document is designed to walk people through the process of installing the software on a Soekris 4526 board using a PXE boot on a FreeBSD operating system. This is the kind of board you might buy from Metrix.net.

Software Requirements

    • FreeBSD [OpenBSD and NetBSD commands are similar enough that proficient users should be able to translate the FreeBSD commands offered here.
    • wget or links
    • Cu [installed by default with Tip in FreeBSD]
    • lrzsz

Hardware Requirements

    • One Ethernet port
    • One serial port [We found that a USB-RS232 Serial Connector worked as well.]
    • One crossover cable
    • One cat5e cable
    • One null-modem cable
    • One power-over-ethernet injector [POE]

Conventions

Three different command line prompts will be used:

    • $ indicates the normal user;
    • # indicates the root user; and

> indicates a prompt from the node.

All key strokes (e.g. Shift, Control, Enter, etc...) will use the following syntax: [e.g. , , etc.].

VI Tutorial

For text editing, we use VI, but feel free to use whatever text editor you like. Some useful vi commands:

    • - enter the edit mode to change text
    • - to escape the edit mode
    • :q! - to exit without saving changes
    • zz - to save changes and exit

Proceed to Step 1

Flashing Your 4526 Soekris Node: Step 1

    1. You need to make a "tftpboot" directory then move to the new directory
      • $ mkdir /tftpboot
      • $ cd /tftpboot
    2. Download the files you need for the initial flash.
      • $ wget http://cuwireless.net/files/netbsd.gz
      • $ wget http://cuwireless.net/files/pxeboot_ia32_com0_19200.bin
    3. You are almost there. You just need to make the files readable by everyone. [You must be root to do this.)
      • $ chmod -R 744 /tftpboot

Proceed to Step 2

Flashing Your 4526 Soekris Node: Step 2

Step 2: Setup the Network for PXE Booting

    1. DHCP Server [You will need root privileges for this step.]
      1. # pkg_add -r ics-dhcp3-server
      2. Now we need to change the configuration file. We do that with vi.
        • # vi /usr/local/etc/dhcpd.conf
        • Make the file look like this:
          [Remember to type to edit the text, to stop editing, and ZZ to exit.]

ddns-update-style ad-hoc;

subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.101;
option subnet-mask 255.255.255.0;
range 192.168.1.1 192.168.1.100;
}

class "pxe-clients-ia32" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.1.101;
filename "pxeboot_ia32_com0_19200.bin";
}

class "netbsd-pxe-clients-ia32" {
match if substring(option vendor-class-identifier, 0, 17) =
"NetBSD:i386:libsa";
next-server 192.168.1.101;
filename "tftp:netbsd.gz";
}

      1. Restart the dhcp server and make sure that the dhcp server is running by entering:
        • # dhcpd &
        • # pgrep dhcpd
        • Entering the last code should give you a number. If it doesn't, your dhcpd.conf file needs to be reviewed.
    1. TFTP Server [You will need root privileges for this step.]
      1. Now you need to edit the TFTP Server Configuration. TFTPD requires the INETD service. You will need to edit "/etc/inetd.conf"

a. # vi /etc/inetd.conf

b. Move to the line below and put the cursor on the "#". Press DEL to remove the "#" mark.

tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -U 777 -s /tftpboot

c. Exit VI

    1. We also need to edit the /etc/remote file as follows.
      • # vi /etc/remote
      • Add the following lines at the end of the file:

#cuwin node stuff
cuw0:dv=/dev/cuad0:br#19200:pa-none:dc:

    1. Reboot and Check
      • Reboot the computer: $ shutdown -r now
      • When the computer reboots, you will want to run the following commands:
        • # dhcpd &
        • # pgrep inetd
          Entering the last code should give you another number. If it doesn't, you tftp service is not running and you should revisit step 2B.
        • # pgrep dhcpd
          Entering the last code should give you a number. If it doesn't, your dhcpd.conf file needs to be reviewed.

Proceed to Step 3

Flashing Your 4526 Soekris Node: Step 3

Step 3: PXE Boot the Node
[You will need root privileges for this step.]

    1. Plug the crossover cable into your computer's Ethernet port and the "Data" port on the POE injector. Make sure that the POE injector has power [there should be a green light on top to indicate that it has power]. Now plug the null-modem cable into the serial port on your computer and the serial port on the Soekris board.
    2. Now you will need to run the tip program as root in order to update the BIOS of the node.
      1. Enter su and the root password when prompted.
      2. Now you will need to access the node console. At the command prompt, enter: # tip cuw0
      3. You will need to reboot your node.
      4. A successful PXEboot looks like this:
5.                           Pre-boot eXecution Environment  PXE-2.0 (build 082)
6.                           Copyright (C) 1997-2000  Intel Corporation
7.                            
8.                            
9.                           CLIENT MAC ADDR: 00 00 24 C3 A8 40
10.                        CLIENT IP: 192.168.1.9  MASK: 255.255.255.0  DHCP IP: 192.168.1.101
11.                        GATEWAY IP: 192.168.1.101
12.                         
13.                         
14.                        >> NetBSD/i386 PXE Boot, Revision 1.1
15.                        >> (rgmussel@cuw.ojctech.com, Sun Apr 23 07:50:45 CDT 2006)
16.                        >> Memory: 582/64512 k
17.                        Press return to boot now, any other key for boot menu
18.                        Starting in 0
19.                        PXE BIOS Version 2.1
20.                        Using PCI device at bus 0 device 6 function 0
21.                        Ethernet address 00:00:24:c3:a8:40
22.                        net_open: client addr: 192.168.1.9
23.                        net_open: subnet mask: 255.255.255.0
24.                        net_open: net gateway: 192.168.1.101
25.                        net_open: server addr: 192.168.1.101
26.                        net_open: file name: tftp:netbsd.gz
27.                        2159776+33612688-

Proceed to Step 4

Flashing Your 4526 Soekris Node: Step 4

Step 4: Upgrade the node

    1. Log into the node using the root password. [usually "changeme"]
    2. You need to change a few variables to enable the upgrade.
      • > stty erase Control-v
      • > ifconfig sip0
        Find a line that looks something like this:
        inet 10.168.64.254 netmask 0xffffff00
      • > ifconfig sip0 inet 10.168.64.254 netmask 0xffffff00 -alias
      • > ifconfig sip0
        You should now see a line that looks something like this:
        inet 192.168.1.7 netmask 0xffffff00 broadcast 192.168.1.255.
      • Ping the server to verify your connection:
        > ping 192.168.1.101 -c 5
        You should see lines like this:
        64 bytes from 192.168.1.101: icmp_seq=0 ttl=64 time=0.656 m
    3. Let's upgrade the node:
      • > upgrade -f -C blah@192.168.1.101:/tftpboot/upgrade.tgz
        [where blah is your user name.]
        If that is successful, you should see something like this:
§                              
§                             fdisk: DIOCGDEFLABEL: Invalid argument
§                             fdisk: DIOCGDINFO: Invalid argument
§                             Disk: /dev/rwd0d
§                             NetBSD disklabel disk geometry:
§                             cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
§                             total sectors: 125056
§                              
§                             BIOS disk geometry:
§                             cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
§                             total sectors: 210453442400
§                              
§                             Partition 0:
§                             NetBSD (sysid 169)
§                                  start 32, size 62512 (31 MB, Cyls 0-488/2/17)
§                             Making partition 0 active.
§                             Preparing for upgrade on /dev/wd0e.
§                             /dev/rwd0e: 30.5MB (62512 sectors) block size 8192, fragment size 1024
§                             using 4 cylinder groups of 7.63MB, 977 blks, 1920 inodes.
§                             super-block backups (for fsck_ffs -b #) at:
§                             32, 15664, 31296, 46928,
§                             Installing the upgrade.
      • Because you won't be an authenticated user, you will be prompted to verify that you want to continue. Answer yes.
§                             The authenticity of host '192.168.1.101 (192.168.1.101)' can't be established.
§                             DSA key fingerprint is a8:75:fe:7d:46:b7:a8:05:65:77:43:7a:67:e7:a4:fc.
§                             Are you sure you want to continue connecting (yes/no)?yes
      • You will also need to enter your password on the freebsd computer.
§                             Warning: Permanently added '192.168.1.101' (DSA) to the list of known hosts.
§                             Password:
§                             100% |*************************************|  4041 KB  237.68 KB/s    --:-- ETA
§                             Updating etc/fstab
§                             Updating primary bootstrap
§                             Updating active partition
§                             Disk: /dev/rwd0d
§                             NetBSD disklabel disk geometry:
§                             cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
§                             total sectors: 125056
§                              
§                             BIOS disk geometry:
§                             cylinders: 977, heads: 4, sectors/track: 32 (128 sectors/cylinder)
§                             total sectors: 210453442400
§                              
§                             Partition 1:
§                             NetBSD (sysid 169)
§                                  start 62544, size 62512 (31 MB, Cyls 488/2/17-977)
§                             Making partition 1 active.
§                             Copying existing /etc/cuw_config.
§                             Upgrade complete (/dev/wd0e).
§                              #
      • After that runs, type the following at the command line to reboot the node:
        $ reboot
    1. You will want to exit Tip now. Do that, you should first unplug the serial cable, then enter the following command: ~D [i.e. --~, release the keys, and then --d].

Congratulations! If you made it this far, you are ready to put the node on the roof and get to work!

No comments:

Post a Comment