Ubuntu installation on Magnia SG20

From Wildsong
Jump to navigationJump to search

These instructions are my notes on how I installed Ubuntu from scratch onto a hard drive so that I could get Otter (a Toshiba Magnia) running.

2010-August-10 I am updating this page... when I wrote the first version I was using Ubuntu 7 and VMWare. Now I am using Ubuntu 10 and VirtualBox.

I used to use VMWare Workstation extensively. It costs about $100. Now you can do just about everything in VirtualBox and it's free.

If you just want to install the drive image that I built from this system, go back to Otter's page. (The image there is currently version 7, I will be updating that soon too!)

Simulating the Magnia

VirtualBox lets me build a virtual Magnia on my Ubuntu based development machine.

By simulating the Magnia, we have access to the resources of the bigger faster development system (Core Duo + 8GB RAM + SSD etc etc) and we have a directly connected keyboard mouse and monitor. We can simulate the CDROM drive too so we can install from a downloaded ISO image without having to burn the image onto a CDROM.

By physically connecting the Magnia drive to the development system, we can set up a virtual machine to simulate the Magnia, and then install Ubuntu directly onto the physical hard drive, and when we're done configuring and testing, move the drive to the real Magnia.

Connect hard drive to desktop development system

I use a ribbon cable and a 44pin laptop to 40 pin desktop IDE adapter. The drive is one of the 30 GB Toshiba 2.5" 4200rpm drives that came in the system when I got it. I have jumper set up for the drive to be the master.

Set up a virtual machine

My development system has an SATA drive at /dev/sda as its system drive. When I connect the Magnia hard drive to the IDE interface, it appears at /dev/hda. If you already have a drive here use your secondary IDE interface and the drive will appear as /dev/hdc. Where the drive shows up on the development machine does not matter in the virtual machine; it will appear as /dev/sda.

I create a virtual machine using the hard drive on /dev/hda and the cdrom connected to an ISO rescue image called "System Rescue CD". I add a second ethernet interface to the virtual machine to simulate the two Magnia ethernet ports. (It has 8 ethernet connectors but 7 are connected to an ethernet switch and appear as one port to the operating system.)

I set the first port as a "bridged" port and the second one as "host only".

Attach physical drive to virtual machine

The VirtualBox documentation says this:

Warning

Raw hard disk access is for expert users only. Incorrect use or use of an
outdated configuration can lead to total loss of data on the physical disk.
Most importantly, do not attempt to boot the partition with the currently
running host operating system in a guest. This will lead to severe data
corruption.

Now that you have been warned, I create a raw vmdk file and add it to VirtualBox, the command to create the vmdk is

VBoxManage internalcommands createrawvmdk -filename ./RawSDC.vmdk -rawdisk /dev/sdc

In VirtualBox you go into the MediaManager and add the vmdk, which gives you access to /dev/sdc disk from guest machines. Then you go to the Magnia virtual machine and connect the disk to its IDE controller.

Download Ubuntu server

Go to the Ubuntu web site and download the ISO disc image. The great thing with a virtual machine install is that you don't have to burn the image to a cdrom. Just go into the settings for the virtual machine, and set the cdrom to point to the ISO file instead of to your real cd drive.

I used this image. http://ubuntu.osuosl.org/releases/10.04/ubuntu-10.04-server-i386.iso You can go to http://ubuntu.org/ and find a server near you. This one is in Corvallis, Oregon, where I live.

Install Ubuntu Server

Now you can boot from the Ubuntu Server install cd image.

Partitioning

You can use the default partitioning scheme for the drive. I used "guided partitioning with LVM". By putting it on an LVM partition it should be relatively easy for you to expand the image that I create to fill any size hard drive (up to the Magnia limit of 137 GB)

Ubuntu 10.04 defaults to using EXT4 partitions. This is sort... too modern... it makes recovery operations problematic since most rescue discs are not supporting EXT4 yet. Let's stick with EXT3 for now, eh?

User account

I created a user called "magnia" with a password "ubuntu". You should change this. The administrative password for the database server MySQL is also set to "ubuntu".

There is no administrative login on Ubuntu, you log in as a regular user and then use the "sudo" command to run things with administrative (root) privileges.

Initial network configuration

I named the machine "magnia" because I am not in a creative mood right now. After it is all built and the image created then I will rename it to be "otter".

You should let the installer install a default route for you. You will fix up networking later on anyway.

Updates

I selected "no automatic updates". You are on your own to either turn on updates or do them yourself.

Software Selection

I marked these lines with an 'X' from the menu so they will be installed.

X LAMP server (which is Apache + MySQL + PHP)
X OpenSSH server (which lets you log in and get a shell prompt)
X Samba file server (lets you share files and printers among Windows clients)

You can install other things later.

Post install

Remove CDROM. (Or in the case of a VMware installation, disconnect the ISO image from the virtual CDROM device.)

Reboot the virtual machine and you will be running Ubuntu Server.

Kernel selection

The Pentium (Celeron) processor needs the 386 kernel. You must load it and remove the one that Ubuntu installer choose for your virtual machine,

sudo apt-get install linux-386
sudo apt-get remove linux-generic-pae linux-image-generic-pae linux-headers-generic-pae
sudo apt-get autoremove
cd /boot
sudo rm *generic*
sudo update-grub
reboot

Ubuntu updates

You might have to make some changes to the network settings at this point, if you can't execute network commands and you don't know what to do here, ask me for help. Or your local Ubuntu / network guru.

The first line updates the database of packages kept on the system. The second line uses the updated database to decide what packages should be downloaded and installed. The third line performs steps needed to upgrade to the latest revision of the distribution.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Since you just installed from the latest downloaded ISO image, you'd think this step would be unnecessary. But there are always a dozen or so packages that have been upgraded since the ISO image was created, no matter how new it is.

Your system will run without updates but there might be critical security upgrades or bug fixes that will improve reliability and security.

Adding extra packages

I chose to install a minimal set of packages at initial installation, now I go ahead and install the things that I want. I get more control this way, for example instead of choosing "Mail Server" at install time and getting whatever MTA the Ubuntu folks chose, I get to tell it I want postfix.

  • cupsys so that you can print to an attached printer
  • mgetty mgetty-fax support for incoming calls on modem line and faxing
  • nfs-kernel-server so I can share files with other Linux boxes
  • postfix mail handler; added but you will need to reconfigure
  • openvpn a VPN package so I can set up a VPN connection to work
  • lm-sensors access to hardware, you want this if you use SG20 'lcd' program
  • shorewall to manage a firewall; shorewall is supported in webmin
  • dnsmasq so I can be a DHCP server and a DNS server
  • swat is a web-based admin tool for Samba

The format for adding packages is "sudo apt-get install package-name", for example

sudo apt-get install cupsys

will install the cupsys package and any other packages that it requires. For any package there may be additional steps involved to configure it (for example, postfix will not work until it's set up properly.)

Webmin

I installed webmin from their Debian repository. You have to add the repository for webmin, see http://www.webmin.com/ for all the details

  • webmin web-based system management utility
  • cupsys-client added to allow webmin to do printer management
sudo apt-get install webmin libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions libapt-pkg-perl
sudo apt-get cupsys-client


X11 stuff

I don't have any interest in running graphical applications on my firewall machine so I don't install these. It's possible. You can run a full desktop and have the output appear on another machine if you want. I don't.

If you are interested in having a GUI interface you might want to look into installing 'xvnc' which lets you run a vnc client on a Windows machine and open the X11 console of your SG20 in a window there.

  • xauth to allow connecting to X11 applications such as synaptic
  • oclock to test X11 connections, and for fun, run with "oclock -transparent &"
  • synaptic X11 GUI package manager

RAID

There used to be lots of extra steps on this page telling you how to use EVMS to manage the partitions on the drive, to enabled a RAID mirror configuration.

As of Ubuntu 7.10, there is no longer support for EVMS in Ubuntu, so I removed those notes. I am not using RAID currently on my Magnia.

It is possible to install to a pair of drives in RAID 0 or RAID 1 configuration from the Ubuntu installer. This is what I do at work on modern computers.

I did put the root and swap partitions on an LVM volume to allow more flexible space management; this is the default set up now for Ubuntu 10.04. It should not be hard to convert to a RAID mirror using LVM but I have not worked out how to do it yet.

LCD program

Next step is to install the Magnia LCD program. (Click on the link for instructions.)

Network

Ethernet

Ubuntu wants the ethernet switch at /dev/eth0 and the Intel WAN interface at /dev/eth1. So be it. I updated /etc/network/interfaces to match.

The interfaces are configured in /etc/network/interfaces like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The WAN interface (outside)
auto eth1
iface eth1 inet dhcp

# The Ethernet Switch
auto eth0
iface eth0 inet static
 address 192.168.123.101
 netmask 255.255.255.0
 gateway 192.168.123.254

To use the SG20 as your gateway you would remove the gateway line.

Wireless

These notes date back to Ubuntu 7.04 so take them with a grain of salt.

I did some testing with my WiFi set up but it is not in my current configuration. At some point in the future I intend to replace the internal MiniPCI modem card with a WiFi card.

I generally prefer using an external access point so that I can put it somewhere that it will do the most good, for instance near my laptop. I suggest you get yourself an external antenna if you use a PCMCIA card in the back of the SG20.

Instead of WiFi, I (used to) use the SG20's PCMCIA slot for a USB adapter so that I can connect a USB printer.

Getting the wireless card going requires adding more Ubuntu packages. The pcmcia modules are not installed by default on the server distribution. Also thought I should run the wireless LAN (WLAN) in bridge mode so that it would be as close as possible to the original Magnia configuration.

apt-get install pcmcia-cs bridge-utils

I rebooted after installing these packages and the wireless card was detected. Popping the card out and reinserting it did not bring the interface back online. This is disappointing; I bet there is some other laptop package for Ubuntu. Older Linux systems had a thing called 'hotplug'. The ifplugd package looks most promising. For this initial phase I am assuming anyone with a wifi card will be leaving it plugged in, so I am not going to worry about it; just treat it like a n internal network card. Plug the card in and leave it there while rebooting.

I am using an old Orinoco Silver card. (Supports 802.11b / 11 Mbps only) This card was one of the ones supported on the original SG20 Redhat build. It happens to be the one that I one. The other modules are installed so you should not be restricted to using an Orinoco card any more, but I don't have any others to use for testing at the moment.

I added a line "orinoco-cs" to /etc/modules so that module will be loaded on boot.

Controlling ordering of ethernet interfaces

THIS SECTION IS VERY IMPORTANT. If this file is not set up correctly, you won't be able to use your network connections once you connect the drive to the real hardware.

/etc/udev/rules.d/70-persistent-net.rules has lines like this in it

# This is the inside ethernet switch interface
SUBSYSTEM=="net", DRIVERS="", NAME="eth0" 

# This is the WAN/Internet interface
SUBSYSTEM=="net", DRIVERS="e100", NAME="eth1"

USB

I don't plan to use the WiFi card as described in the previous section. I want to plug a printer in that has only USB, so I bought a USB pcmcia card.

I popped it in and checked the 'dmesg' command and I see

[ 1112.880000] pccard: CardBus card inserted into slot 0
[ 1113.320000] usbcore: registered new interface driver usbfs
[ 1113.320000] usbcore: registered new interface driver hub
[ 1113.330000] usbcore: registered new device driver usb
[ 1113.340000] ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1113.340000] PCI: Enabling device 0000:02:00.0 (0000 -> 0002)
[ 1113.340000] ACPI: PCI Interrupt 0000:02:00.0[A] -> Link [LNKA] -> GSI 12 (level, low) -> IRQ 12
[ 1113.340000] PCI: Setting latency timer of device 0000:02:00.0 to 64
[ 1113.340000] ohci_hcd 0000:02:00.0: OHCI Host Controller
[ 1113.350000] ohci_hcd 0000:02:00.0: new USB bus registered, assigned bus number 1
[ 1113.350000] ohci_hcd 0000:02:00.0: irq 12, io mem 0x34000000
[ 1113.440000] usb usb1: configuration #1 chosen from 1 choice
[ 1113.440000] hub 1-0:1.0: USB hub found
[ 1113.440000] hub 1-0:1.0: 3 ports detected
[ 1113.550000] PCI: Enabling device 0000:02:00.1 (0000 -> 0002)
[ 1113.550000] ACPI: PCI Interrupt 0000:02:00.1[B] -> Link [LNKA] -> GSI 12 (level, low) -> IRQ 12
[ 1113.550000] PCI: Setting latency timer of device 0000:02:00.1 to 64
[ 1113.550000] ohci_hcd 0000:02:00.1: OHCI Host Controller
[ 1113.550000] ohci_hcd 0000:02:00.1: new USB bus registered, assigned bus number 2
[ 1113.550000] ohci_hcd 0000:02:00.1: irq 12, io mem 0x34001000
[ 1113.640000] usb usb2: configuration #1 chosen from 1 choice
[ 1113.640000] hub 2-0:1.0: USB hub found
[ 1113.640000] hub 2-0:1.0: 2 ports detected
[ 1113.750000] PCI: Enabling device 0000:02:00.2 (0000 -> 0002)
[ 1113.750000] ACPI: PCI Interrupt 0000:02:00.2[C] -> Link [LNKA] -> GSI 12 (level, low) -> IRQ 12
[ 1113.750000] ehci_hcd 0000:02:00.2: EHCI Host Controller
[ 1113.750000] ehci_hcd 0000:02:00.2: new USB bus registered, assigned bus number 3
[ 1113.780000] ehci_hcd 0000:02:00.2: irq 12, io mem 0x34002000
[ 1113.780000] ehci_hcd 0000:02:00.2: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
[ 1113.780000] usb usb3: configuration #1 chosen from 1 choice
[ 1113.780000] hub 3-0:1.0: USB hub found
[ 1113.780000] hub 3-0:1.0: 5 ports detected

HAPPY DAY

I plug in the printer. I run the 'lsusb' command.

# lsusb
Bus 003 Device 002: ID 04a9:10a2 Canon, Inc. 
Bus 003 Device 001: ID 0000:0000  
Bus 002 Device 001: ID 0000:0000  
Bus 001 Device 001: ID 0000:0000

Again, happy day. The printer is a Canon Pixma ip4200 so the system can see it. I will try more USB goodies out later.

Logging in to the USB serial port

I can plug in a USB to RS232 serial port adapter on the second USB port and set up login access, so that I have a backdoor the next time I manage to lock myself out with bad firewall rules.

I have a little IOgear adapter that has the circuitry for the serial port conversion built into its 9pin connector. Normally it lives in my laptop's bag since the laptop has USB and no serial port.

When I get into a tough spot on the SG20, I plug it into the USB card and run a null modem cable to my desktop's serial port. I start up minicom on the desktop and then I can log into the SG20 to repair it.

To have the system put a login prompt up on the serial line, do this

cd /etc/init
cp tty1.conf ttyUSB0.conf
vi ttyUSB0.conf    change instances of tty1 to ttyUSB0

Troubleshooting

Mounting the drive on a "normal" computer.

apt-get install lvm2 vgscan lvs mount /dev/magnia/root /mnt