Otter

From Wildsong
Jump to navigationJump to search

Otter is a Toshiba Magnia SG20.

Ubuntu 7.0.4 image made with Acronis "True Image" and the MD5 for the image

Next release-- testing now

  1. RAID 1 support (done, needs better docs)
  2. Webmin (done)
  3. Support for the wireless card
  4. Support for the modem (which I can't test as I have no phone line)
  5. Need to set a default config for shorewall

lcd program

  1. Make the fans be speed controlled by default (done in 2.2.1)
  2. Change lcd to control shorewall firewall instead of my own script

Goal

Set up as a general purpose home server, replacing as many small dedicated boxes as possible. These boxes include a gateway router, a VOIP telephone adapter, an ethernet switch, and a WiFi access point.

Along the way I am preparing an Ubuntu disk image that other people can try on their SG-20's.

I feel the computers I use should use no more energy than required to get the job done, and they should be as quiet as possible. You should have to check the LED on the front panel to see if it's on.

Using Otter as my SOHO server is part of my Carbon diet.

What I like about the SG20

  1. It came with Linux on it. It can be upgraded and hacked in many ways.
  2. Low power consumption.
  3. It's small.
  4. Has a generic Intel CPU that is fast enough for a SOHO server.*
  5. Uses generic PC components for drives and memory.
  6. Has extra goodies hidden away inside like the video slot.
  7. The serial LCD display.
  • Compare with a Via C3 which is not quite a 686 so it crashes if you try to run 686 code on it.

What I don't like

  1. Noisy slow hard drives
  2. Noisy fans
  3. No externally accessible serial port.
  4. No USB ports.

I know I could hack the daughter board to add a serial port so that I could use it as a serial console but am not willing to invest the time in populating the board to install one. Lack of USB ports is remedied on the newer SG-30.

History

06-2007-- put the first Ubuntu image up on this site

03-2007-- I've had it for several years now. I used it with the stock Redhat 7.2 for about a year, then shut it down for a while. When I started writing this page, I did most of the upgrades described here.

Hardware

Disks

It had two 30 GB drives when I got it. I replaced the second hard drive with an 80 GB leftover from a laptop upgrade.

The 30 GB drive is a Toshiba MK3017. The 80 GB drive is a MHV2080AT.

These are both 4200 rpm drives; I'd like to replace one or both with 7200 rpm drives but probably won't for a while.

Memory

I pulled a 512MB PC133 DIMM out of a computer that I got dumpster diving, it works fine. It's not ECC, so I had to hookup an AGP video card and keyboard and turn off ECC in BIOS. While I was in there I set it to boot from the network. I can PXEboot from a Linux desktop system into a rescue mode.

Fans

The stock power supply fan was too noisy, so I hacked out the case a bit for more air flow. Then I put a 80 mm fan on top of the power supply and run it at a low speed.

Software

Boot from network (PXEboot)

You can bypass the hard drive and boot your Magnia from another server on your network. It's not easy, as you have to get BIOS access to switch it on, but once it's set it's set forever.

If you try "PXEboot", you need to set the network adapter in the Magnia to use LAN for booting and you need to use the WAN network port. It's an Intel Etherpro 100. The SG20 will not boot off any of the etherswitch network ports.

I used the "Trinity Rescue Kit", build 279 and was able to ssh into the Magnia. I hacked the TRK startup scripts to allow this; by default it will require entering a new root password from the Magnia console (which is not hooked up, that's the whole point of the netboot.)

Having network booting means that I have another option when the system won't boot from its internal drives. I can netboot, then use ssh to log into the machine and see what happened when it booted, see if it properly detected the hard drives and peripherals and so on.

For example, right now my Magnia is not bootable from the hard drive but I can see this by typing 'dmesg' after booting with TRK.

Probing IDE interface ide0...
hda: TOSHIBA MK3017GAP, ATA DISK drive
hdb: FUJITSU MHV2080AT, ATA DISK drive

This means that it's seeing both drives; I had to change the jumpers on the 80 GB drive from Master to CSEL (cable select) mode by adding a jumper before the Magnia could see it. I just added this drive from a laptop that I upgraded.

Using the TRK, I can mount /dev/hda1 (where I installed Ubuntu) and edit critical system files. The problem turned out to be in the configuration of the network interfaces. I installed Ubuntu onto the 30 GB drive using a VMWare virtual machine and it set up the ethernet interface wrong.

It was finding the network card as '/dev/eth2' instead of '/dev/eth0' so it was not working.

Using an Ubuntu system as a PXEboot server

Ubuntu

I have installed Ubuntu 7.04 Feisty Fawn (upgraded from 6.10 actually).

I used VMware extensively, booting from a virtual machine and testing until things looked close enough to work on the SG20. Then after transferring the image to a real hard drive and booting a few times and moving the hard drive back and forth between the SG20 and my desktop computer eight or ten more times, the first image was ready!

On the first release I used the EXT3 and XFS filesystems. Then I learned that True Image does not support XFS filesystems so the second release uses only reiserfs. The second release is built on EVMS, the 'extended volume management system'. This allows setting up a RAID 1 mirror fairly easily, and also allows the partition sizes to be changed on the fly.

I have started a more detailed page on performing the Ubuntu installation on Magnia SG20

Creating the image

Installing the image

Post-install configuration

expanding filesystem to fill hard drive ethernet ports, wireless, ppp, caller id, fax firewall passwords

mysql openvpn postfix privoxy ssh



Magnia LCD

Stuff you need to know

  1. Default IP address on the LAN is 192.168.123.101
  2. Set for DHCP on the WAN port.
  3. Login via ssh, not telnet.
  4. Usernames and passwords: superuser: root / admin regular user: sshuser / user
  5. Firewall is set to accept no connections from outside (WAN).

Set up for image

The first partition on the first drive (hda) is 3 GB; it contains the root filesystem. The second partition is 1/2 GB and is used as 'swap' space. The rest of the drive is allocated to the third partition and it's mounted at /home.

This is the /etc/fstab file contents

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>    <options>     <dump>  <pass>
proc            /proc           proc      defaults      0       0
LABEL=root      /               ext3      defaults      1       1
LABEL=swap      none            swap      sw            0       0
LABEL=home      /home           reiserfs  defaults      1       2

By using LABEL entries instead of device entries (like /dev/hda1), I can move the image between virtual, regular, and RAID drives without editing the /etc/fstab file.

The second release has EVMS volumes set up as RAID1 using device names /dev/evms/roota, /dev/evms/swapa, and /dev/evms/homea

I recommend the use of one of the other journaling filesystems over EXT3 for large (> 1 GB) partitions. My preference is XFS but on the SG20 image I used reiserfs because it is supported in Acronis True Image. I keep the root filesystem on EXT3 because it makes things easier when using recovery tools. (Also I could not get it to boot from EVMS volumes.)

Installing Ubuntu from the TIB image

What you need to do this installation

  • A desktop PC
  • Either Windows with Acronis True Image installed or a True Image rescue cd (in which case you don't need Windows) You can download the 15-day trial version (or buy the commercial) of True Image Backup. This is a Windows program, most of the people using SG20's are Windows users and are learning Linux. (If you don't have Windows, get a friend to install the program and make a CDROM for you.)
  • a 2.5 to 3.5 hard drive adapter like this one from Newegg for $6

step by step

  1. Install True Image on the Windows desktop machine.
  2. Download the Ubuntu image (link near top of this page) onto the desktop
  3. Shut down your desktop and SG20
  4. Take the first drive (the one on the right as you look from the front) out of your SG20 and connect it to the desktop using the adapter.
  5. Boot the desktop and start True Image or boot the desktop from the TIB cdrom.
  6. Follow instructions there to restore from the Ubuntu image onto the SG20 hard drive. You want to restore the entire drive from this image.
  7. Power off the desktop
  8. You should be able to unhook the desktop's primary hard drive and connect the SG20 drive in its place and boot from it
  9. You can login as root and partition the remaining space if you want. (see next section.
  10. You could also delete a directory I left around accidentally. At the command prompt type rm -rf /var.old
  11. Shut down again (type "shutdown")
  12. Put the drives back where they belong. Boot the SG20 and it should now be running Ubuntu Server 7.0.4

partitioning remaining space

THIS IS OUTDATED -- pertains to first release. The new version uses reiserfs and has the /home partition included in the True Image file. So instead of adding a partition, you can use 'evmsgui' to resize the existing one to expand or shrink it. See Notes on EVMS for more information.

Here are the old instructions, anyway--------

I left the rest of the drive unused to make it easier to deal with using Acronis True Image as the backup program. The image will wipe the entire hard drive, so after you get the system running you will need to add a partition to use the rest of the drive.

From a command line you'd do something like this. I usually put the new partition at /home and so I have some extra steps in here to copy any existing files under /home to the new partition. otherwise you will not have access to them after mounting the new partition there. (The new partition will block access to the old files underneath /home)

At the root command prompt # you type the parts in bold.

# fdisk /dev/hda   to make space available you must add a partition
n  create a new partition
p  make it a primary partition
3  partition number will be three
the program now prompts for start and size, just accept defaults by hitting 'enter' key'
w   write the new partition table to disk
# reboot  you should reboot so new partition table can take effect
# mkfs.xfs /dev/hda3   make a filesystem on the new partition
# cd /                 change to the root of the file tree
# mv /home /home.OLD   move the existing directory tree aside
# mkdir /home create a place to mount the new partition
# mount /dev/hda3 /home  mount it
# mv /home.OLD/* /home   Move files from old space to new space
add an entry to /etc/fstab so that it will mount after rebooting
# echo "/dev/hda3 /home xfs defaults 0 2" >> /etc/fstab
# rmdir /home.OLD get rid of old directory

Fixing boot problems

Does it say something like "MBR failure" or does it print "LI" and lock up? You need to update the master boot record.

The "master boot record" (MBR) is a special sector on the hard drive that has to contain a tiny program that loads the grub boot loader. If it does not then the boot process can't proceed.

I have the hard drive in a separate machine, so I have access to its cdrom drive. So I use the Trinity Rescue Kit cdrom, boot from it, hit "enter" and then use the grub command. The SystemRescueCD is good, too.

# grub
grub> root (hd0,0)
grub> setup (hd0)
Here is a screenshot


You should be able to pop out the cdrom and reboot now.

Change your passwords!

You should bring the system up for the first time disconnected from the Internet, change your passwords.

You can either connect via ssh and use the commands

sudo passwd sshuser
sudo passwd root

or you can connect via webmin and use its password changer.

If you need an ssh client for Windows, I recommend 'putty'.

Adding more packages

My installation includes the options for DNS and LAMP services. DHCP is turned on. So is ssh.

Other packages that I added

I enabled the 'universe' packages by uncommenting the appropriate line in /etc/apt/sources.list. I added the repository for webmin to sources.list, too. Then I added more packages.

release 1

I also added the packages necessary to compile the lcd/fan control program.

release 2

  • oclock to test X11 connections, and for fun, run with "oclock -transparent &"
  • synaptic X11 GUI package manager
  • xauth to allow connecting to X11 applications such as synaptic
  • evms evmsn evmsgui evms-bootdebug support for RAID
  • mgetty mgetty-fax added to support incoming calls on modem line and faxing
  • shorewall added shorewall, which is supported in webmin
  • nfs-kernel-server so I can share files with other Linux boxes
  • cupsys-client added to allow webmin to do printer management
  • privoxy web advertising blocker
  • postfix mail handler added but you will need to reconfigure

To allow X11 clients such as oclock, synaptic and evmsgui to run I changed X11Forwarding from "no" to "yes" in /etc/ssh/sshd_config

To use any X11 client, you have to have an X11 server running on your desktop (any version of Linux with a graphical environment or on Windows, cygwin/X). Then you connect with an ssh client to the SG20 and type the command name. If it worked in a few seconds the window will pop up on your desktop.

Notes on EVMS

Other changes

Change VERBOSE=no to VERBOSE=yes in /etc/default/rcS so that more information is logged at boot.

Add ons

Firewall

For the first release I looked at shorewall and thought it was too complicated. Then I found out it's supported in webmin so I will probably use it now. I also looked "firestarter" and it requires an X client. Now that I have installed other X clients this might be okay too.

On the first release, I gave up on canned packages and wrote a simple set of rules myself. I put the script in /usr/local/sbin/firewall.sh and called it from /etc/network/interfaces so that it gets loaded when the system brings up the network interface. I also wrote a script /usr/local/sbin/firewall-off.sh that simply turns the firewall rules off, opening the machine up again. These two scripts can be run from the push buttons in lcd-2.2


Web server

Apache is running but nothing special is installed.

Database server: mysql username and password: root/admin (set with "mysqladmin password admin")

Printing services

I installed cupsys to allow the system to work as a print server. This was one of my primary goals for this system, to allow printing from any of my computers on my little Canon inkjet printer.

This also requires USB support. If you have an SG-30, fine. I happen to have an SG-20 which does not have built in USB ports so I got a PCMCIA card. I plugged in a pair of USB headphones to try the USB card out and the Magnia froze up, so I might end up not using the USB printer after all. Oh well. :-(

I modified /etc/cups/cupsys.conf so that its built-in web server listens on all ethernet addresses, not just localhost. Connect with a browser to port 631, http://mymagnia:631/ for example. You should consider editing /etc/cups/cupsys.conf file to allow connections only from your local network.

Support for Windows clients with Samba

I installed Samba so that you can share file and print services with Windows clients. I installed 'swat' so that you can change the Samba configuration using a web browser. I installed 'inetd' since swat runs as an inetd service. Connect to it with a web browser. It runs on port 901. So for example, http://mymagnia:901/

Update: I installed swat but did not test it so I did not notice the xinetd package was missing. Ray Day reports that you can get swat going by doing the following:

# apt-get install xinetd
# update-inetd --enable swat
# cd /etc/xinetd.d
# nano swat
# default: off 
# description: SWAT is the Samba Web Admin Tool. Use swat \
#              to configure your Samba server. To use SWAT, \
#              connect to port 901 with your favorite web browser.
service swat
{
       port    = 901
       socket_type     = stream
       wait    = no
       only_from = 192.168.2.7
       user    = root
       server  = /usr/sbin/swat
       log_on_failure  += USERID
       disable = no
}

The IP address following "only_from" is the IP of my windows PC. Either put your own desktop computer's ip address or leave the line out to allow unrestricted access.

Ctrl X and say 'Y' to save. Then do:

# /etc/init.d/xinetd restart

Now you can go to http://192.168.x.x:901/ What ever your SG20 IP is. Put in your name and password and you are in.

DHCP

I installed and configured the dhcpd server package. It assigns numbers in the range 192.168.123.101-199. This is set in the file /etc/dhcpd.conf