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.

If you just want to install the drive image that I built from this system, go back to Otter's page.

The hard way

Some folks on the Internet wanted RAID 1 mirroring so as an experiment I set up a system with EVMS to allow converting easily from no RAID to RAID 1. This works but I don't have a desire for RAID 1 on my own system so I have gone back to using a simple no RAID installation.

7.10 Ubuntu will be released in a few days and it supports LVM. If you want RAID on an SG20 I suggest using LVM instead of EVMS.

I have left some instructions here on installing EVMS just for informational purposes.

Connect hard drive to desktop system

In my case, the system is 8track. 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.

Set up virtual machine

I create a VMware workstation virtual machine using the hard drive on /dev/hda and the cdrom connected to an ISO rescue image called "System Rescue CD".

Boot from the System Rescue CD (to use EVMS)

Use evmns to partition the hard drive and create filesystems. Create two volumes, the first is swap (500MB) the second is /root (3GB).

Putting swap first means that the second partition can easily be expanded to fill all available space. Make a reiser filesystem on /dev/evms/root and a swap filesystem on /dev/evms/swap.

The first two partitions are set up with RAID 1 in 'degraded mode' . This allows easily converting to a RAID mirror system at a future time.

No EVMS

With my current installation of Ubuntu, I am not using EVMS, but I still want to use a reiserfs. Mostly it is a personal preference, I won't go into the reasons here.

So I manually partition the drive during the Ubuntu installation and tell it to install onto a reiser formatted partition. You can accept the defaults and it will probably be just fine for you.

Install Ubuntu

Boot from the Ubuntu Server install cd, use the "manual" option for partitioning, tell it to install Ubuntu into the third partition. Tell it to install LAMP (which is Apache + MySQL + PHP) and Openssh-Server. You can install everything else later.

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

Reboot and you will be running Ubuntu Server.

Add extra repository

I don't install webmin but many people like it. If you want to use webmin, you have to add the repository for webmin, see http://www.webmin.com/

Comment out the cdrom entry at the start of the file (/etc/apt/sources.list) SG20's don't have CDROM drives so this entry just slows things down.

Install updates

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.

apt-get update
apt-get upgrade
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 1/2 dozen or so packages that have been upgraded since the ISO image was created.

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

Install 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
  • evms evmsn evmsgui evms-bootdebug support for EVMS RAID if you want that
  • mgetty mgetty-fax support for incoming calls on modem line and faxing
  • nfs-kernel-server so I can share files with other Linux boxes
  • privoxy web ad blocker, you want this!
  • 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
  • dhcp3-server so I can be a DHCP server

Webmin stuff

  • webmin web-based system management utility
  • cupsys-client added to allow webmin to do printer management

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


EVMS stuff

If you are not doing an EVMS install to enable RAID support, skip this section. In fact, skip it even if you want RAID. Support for EVMS has been dropped from Ubuntu 7.10! :-( Oh well, it was too easy to use for it to last.

Creating the EVMS partitions

The easy way is with evnsn which has a text-based gui. After getting down the changes I wanted to make, I used the command line interface to allow me to script the set up. Here are the commmands

  • create two segments
  • create two volumes
  • create swap filesystem on the first volume
  • create reiserfs on the second volume
  • save

Copy everything to the new EVMS volume

I've done this while the system is running but it's better to do it with a rescue cd so that files are not changing while copying takes place. Also you don't have to figure out how to exclude the in-memory filesystems and the device files that are created at boot time.

  1. Boot from System Rescue CDROM
  2. Mount partitions
  3. Perform copy; tar cf - /mnt/old | (cd /mnt/new; tar xpf -)

Make the new partition bootable

Still in the rescue disk...

mkdir /mnt/new
mount /dev/evms/root /mnt/new
cd /mnt/new
mount -o bind /sys /mnt/new/sys
mount -o bind /dev /mnt/new/dev
chroot /mnt/new su -l

You are now running in an environment that looks just like it will when you are done, so you can perform the installation commands now.

  1. Edit grub configuration to point at /dev/evms/root
  2. Run grub to install it in /dev/hda2
  3. Edit /etc/fstab to point at /dev/evms/root and /dev/evms/swap
  4. Make a new initrd --
VERSION="2.6.20-16-server"
cd /boot
mv initrd.img-$VERSION initrd.img-$VERSION.old
update-initramfs -k $VERSION -c
  1. Edit the /boot/grub/menu.lst file to point root at /dev/evms/root
  2. Run 'upgrade-grub' to update the menu.lst entries

Reboot!

LCD program

Next step is to install the Magnia LCD program.

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

The SG20 will eventually BE the gateway so that last line will be removed.

Wireless

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 am currently using 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. This caused the ordering of my network interfaces to change. Drat. So I nailed eth0 and eth1 down in /etc/iftab and tried again. /etc/iftab looks like this now:

# WAN interface Intel Etherpro 100
eth0 driver e100

# LAN interface
eth1 driver

By nailing down eth0 and eth1 to the internal network interfaces, the Orinoco card (and any other PCMCIA network card) will come in third place at /dev/eth2.

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.

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.

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

To enable a log as root on the port, edit the /etc/securetty file to add the line /dev/ttyUSB0

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.

cd /etc/event.d cp tty1 ttyUSB0 vi ttyUSB0 change instances of tty1 to ttyUSB0