UPDATE: A new version of the image is available. It had ‘yum upgrade’ executed on June 12th, 2010, which upgraded it to Centos Version 5.5. The new image is located at http://software.freivald.com/centos/alix-centos-5.5-2gcf.gz. There is also an MD5 sum file at http://software.freivald.com/centos/alix-centos-5.5-2gcf.md5.
I could not find my 2 GB card. I used the original image, copied it to a 4 GB card, performed the update, and then copied only the first 2 GB back into the new image. Please provide feedback if the image does not work on a 2GB card.
INFO: For those who are unfamiliar with Centos, it is a distribution that is binary compatible with RedHat Enterprise Linux.
EDIT: We’ve been added to the ALIX web page. Thank you for the testing and support from the PC-Engines crew.
I’ve been working with one of PC Engine’s Alix 6e1 boards a bit lately. It’s a 500 MHz i586 AMD Geode-based embedded board with 256 MB of RAM that sells for under $150. I was testing various distributions and found that Centos was pretty easy to adapt. It wasn’t listed as supported on the PC Engines Web Site, so I wanted to contribute an image back to the community.
The image I’ve created has the following changes from a base install:
1. It has no swap.
2. It has the noatime and nodiratime options for all mounted partitions, although it uses ext3 because of the wal-wart-no-backup-power-for-shutdown configuration.
3. Grub is configured for a 2-second timeout, and uses the serial port as the console – both for grub and the kernel.
4. /etc/inittab was modified to use the serial console. xdm was also disabled.
5. All console settings are set for 38400 because that is what the initial boot-up bios uses on the ALIX 6e1 that I have.
6. /etc/securetty has been modified to allow login via /dev/ttyS0 (tty0 and vc/1 are also left open because I used VMWare to modify the image).
7. Fortunately, due to the stock Centos LVM configuration, no changes were necessary to fstab or the initrd image.
8. Only a base install was performed. Several of the ‘default’ packages have been omitted (things like bluetooth, extra shells, smart card reader daemon, procmail, cups, NetworkManager, etc. ) Of course they are still available using YUM.
9. Lots of the startup stuff is turned off (kudzu, gpm, netfs, iptables and others). Use chkconfig to turn them back on if you want them.
10. The root password is – yep, you guess it: password
11. The eth0 (next to the USB ports) is configured for DHCP. eth1 (next to the serial port) is configured for 192.168.1.50. The hardware MAC lines have been commented out so that it will work with any box, but there is a slight chance that the order of the ports will get reversed. This has never happened to me, but YMMV. You can use either port to get the box up and running with ssh or putty if you don’t want to use or don’t have a serial interface.
12. The CF card I used was A 2GB SanDisk Ultra 15MB/s. Because it’s LVM based, you can use the LVM tools to shrink or grow the volumes. Check out the LVM Howto for all the recipies you need.
13. I updated the packages using ‘yum update’ on the day it was created, so hopefully you won’t have as much downloading to do. I did not enable centosplus, extras, or any other repositories, which makes the image binary compatible with RHEL 5.4.
To use the image,
1. Download the image from http://software.freivald.com/centos/alix-centos-5.5-2gcf.gz.
2. Unzip the image with bunzip2 and copy it to your Compact Flash drive using ‘dd if=<inputfile> of=<outputdevice>’
3. Install the Compact Flash into the ALIX.
4. Attach your favorite terminal program to the ALIX platform. I use putty.exe under Windows or minicom under linux.
5. Apply power to the unit. It should boot without any fuss. If you don’t have a serial port, use eth0 (next to the USB) to have your DHCP router assign and address, or use eth1 (next to the serial port) for a static configuration. eth1 is configured for 192.168.1.50 and the connector auto-rolls the cable if it needs to, so configure your computer for something like 192.168.1.51 and ping until the system is online. Then use ssh, or putty.exe if you are using Windows, to access the unit.
6. I recommend some changes: Obviously, the root password. Also, add an MD5 password to the grub configuration, since without one anyone with a serial cable can pass parameters to the kernel. You will also probably want to add more software using yum. You might also want to create some scratch space under /tmp, or some of the /var/cache directories using tmpfs. I didn’t do any of the these because they are simple, and different users will have different requirements, especially with the advancement of CF cards (wear leveling, 1000000+writes/block, etc.). You will probably want to customize /etc/securetty for your installation.
With this setup, the initial boot up takes 1:32 and has 193MB of free memory. Should be plenty for your embedded Linux server.
–JATF
Where can we download kernel 2.6.18-164.15.1.el5 on an i586 ? Any link?
Or will kernel-2.6.18-164.el5.x86_64.rpm work on Alix board?
What is the easiest way to create ‘alix-centos-5.4-2gcf’ image ?
Thx.
Comment by rg3 — May 7, 2010 @ 10:14 am
I used the stock i686 kernel for this image. I don’t believe that the x86_64 kernel will run, but I didn’t try it.
Click on the link from the blog page, or copy and paste this link into your browser: http://software.freivald.com/centos/alix-centos-5.4-2gcf.bz2
It is a 2Gig Compact Flash image, but it will work with anything 2G or larger.
Save it into your home directory.
Open up a terminal.
Become superuser with: su -
Then unzip the image with the command: bunzip2 ~yourusername/alix-centos-5.4-2gcf.bz2
Find out where your compact flash drive is with: /sbin/parted -l
Then copy the the image to your flash disk with: dd if=~yourusername/alix-centos-5.4-2gcf of={yourFlashDevice}
Once it is done copying you can remove the compact flash device and slap it into the ALIX. Connect your serial NULL cable and use minicom so that you can see it boot. The ALIX is set for 8N1@38400 baud.
Once it boots you can update the kernel using the standard ‘yum update’ command and install any new software you want with ‘yum install {package}’
Did I answer your question?
Comment by admin — May 7, 2010 @ 10:30 am
Hi Joe,
I’m trying to install Centos 5.4 on an external USB drive (connected to my Alix 2D3
and partitioned in 512MB swap area and root) and use the CF card only for /boot partition,
but I have problems to start system with this configuration, I hope you can help me.
To install Centos I used another computer and the Netboot installer, I not used your image.
After installing the OS, I created a new initrd that supports usb-storage
(I followed this guide: http://www.brool.com/index.php/installing-centos-on-an-external-usb-drive)
——————————————————————————————————————————-
cd /boot
mkinitrd –with-usb –preload=ehci-hcd –preload=usb-storage –preload=scsi_mod ./usbinitrd-2.6.18-164.el5PAE 2.6.18-164.el5PAE
——————————————————————————————————————————-
then I modified the following files
/BOOT/GRUB.CONF :
—————————————————————————————–
serial –unit=0 –speed=38400 –word=8 –parity=no –stop=1
terminal serial
default=0
timeout=5
title CentOS (2.6.18-164.el5PAE)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5PAE root=/dev/sda2 ro console=ttyS0,38400n8
initrd /usbinitrd-2.6.18-164.el5PAE
—————————————————————————————–
/BOOT/DEVICE.MAP:
—————————————————————————————–
(hd0) /dev/hda
(hd1) /dev/sda
—————————————————————————————–
/ETC/FSTAB (/dev/hda is the CF card, /dev/sda is the USB drive) :
—————————————————————————————–
/dev/sda2 / ext3 defaults 1 0
/dev/hda2 /cfdata ext2 defaults 1 0
/dev/hda1 /boot ext2 defaults 1 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sda1 swap swap defaults 0 0
—————————————————————————————–
(I changed the last bit to avoid chkdsk at boot time)
/ETC/INITTAB :
—————————————————————————————–
#1:2345:respawn:/sbin/mingetty tty1
#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6
T0:23:respawn:/sbin/getty -L ttyS0 38400 vt102
—————————————————————————————–
After these modifications I inserted the CF card into Alix, connected the USB external drive
and powered the board…after appearing GRUB, the system hangs and does nothing:
*****************************************************************************************
Booting ‘CentOS (2.6.18-164.el5PAE)’
root (hd0,0)
Filesystem type is ext2fs, partition type 0×83
kernel /vmlinuz-2.6.18-164.el5PAE root=/dev/sda2 ro console=ttyS0,38400n8
[Linux-bzImage, setup=0x1e00, size=0x1c2494]
initrd /usbinitrd-2.6.18-164.el5PAE
[Linux-initrd @ 0xfd75000, 0x27a306 bytes]
*****************************************************************************************
after a minute it reboots and so on.
I think initrd is unable to start and recognize the USB hard drive, the power led is off.
This configuration works perfectly with Debian, I don’t understand why it not works with Centos
the Debian files are very similar: http://www.megaupload.com/?d=2GUW1M2Z
Any idea? I hope you can help me.
Thank you.
Best regards
Giulio
Comment by giulio — May 8, 2010 @ 11:36 am
Well first, you don’t need the PAE kernel. It is for 32 bit environments with more than 4GB of RAM. The ALIX is 256MB max. You probably used a machine with a lot of RAM to do the install. You should use a virtual machine instead. If you don’t have VMWare then use qemu.
I have a feeling the problem is in the mkinitrd environment. I’ve found that mkinitrd can be fussy about the environment it is in when it is created. Try booting the ALIX with my image and inserting your USB disk after it finishes booting. Make the changes to the grub.conf and fstab, and copy the root partition to your USB partition using tar*. After it’s done, run your mkinitrd directly on the ALIX device. Then try rebooting with the USB drive connected. Erase the root partition on the CF and reboot again. If we didn’t miss anything it will boot up properly on the USB.
So the other question is: why do you want to have the root partition on the USB and not the CF?
* the command for copying the root file system using tar is: mount /dev/[YourUSBPartition] /mnt; tar –one-file-system cpsvf – / | ( cd /mnt; tar xfp -)
EDIT: I read another post { http://blog.psykotraz.com/2009/07/installing-centos-on-alix-2d2/ } where someone was having trouble trying to use the PAE kernel on the ALIX, so you might be okay just re-doing your install under qemu with 256MB of RAM.
Comment by admin — May 8, 2010 @ 1:18 pm
Hi Joe, thank you!
I followed your instructions and now the USB external drive works perfectly ^_^
I had to disable SELinux before copying the root partition, otherwise
tar doesn’t dump /selinux folder.
I prefer to use an external disk for the root partition, because I read
that the flash memory have a limited number of cycles of write / erase,
I’ve formatted my 4GB Kingston CF many times so I feel safer to use a hard disk
that has a longer life.
Now I’m testing Kloxo panel… it works pretty well even if Alix has low memory.
Best regards.
Giulio
Comment by giulio — May 10, 2010 @ 9:31 am
Actually, both the USB and the Compact flash use flash memory, so six is one-half-dozen of the other. Not to worry, though, modern flash memory can have millions of writes per block, and the hardware has write leveling and error detection hardware that prevents any single block from being over-written disproportionately to the others and removes bad blocks from use transparently to the operating system and user.
If you are still worried about it, keep the root /usr /boot and /etc on the compact flash (along with the virtual file systems that are in memory like /dev and /proc) and mount them read only. These file systems only change when you update the system with Yum and since CF should be faster than USB this should improve performance . Move high write systems like /var and /tmp to your removable media. Even better, move the highest traffic areas like /tmp to a tmpfs drive of 20-50 MB. tmpfs will only use the amount of memory that is actually in use by the file system, so you can make it as big as you have extra memory after you have all your services running.
If you are truly paranoid about it, the Alix (at least the one I have) has a spot on the board for an IDE header. Solder in a new header and use a 2.5″ hard disk instead of the compact flash.
Cheers.
Comment by admin — May 10, 2010 @ 11:42 am
Thanks Joe,
I’ve sucessfully reinstalled my CentOS using i686 kernel.
The problem now is that I cannot mount my USB drive on Alix board.
Do I need to install USB driver for the board?
How should I go in order to mount a USB device that is connected to the board?
Rgds.
Comment by rg3 — May 12, 2010 @ 12:44 am
Actually I haven’t played with the USB yet. If it’s standard hardware it should ‘just work’. I’ll e-mail giulio and see if he had to do anything to get his to work.
In the mean time, try some commands:
lspci -> to check and see if the USB hardware is recognized
lsusb -> to see if you usb device is recognized
dmesg -> to see if the usb device was assigned a block device
parted -l -> to see if the kernel recognizes the partitions (that is a lower case ‘L’)
–JATF
Comment by admin — May 12, 2010 @ 8:45 am
Got a message back from Giulio. He said that the USB hardware was automatically recognized. If you tell me exactly what you are trying to do maybe I can point you in the right direction.
Comment by admin — May 12, 2010 @ 1:07 pm
I was just trying to mount my USB storage to /mnt mount point.
Yes, logically it should be automatically recognised, but didn’t see any usb device detected.
Will try out your commands later to check.
Comment by rg3 — May 12, 2010 @ 10:32 pm
Thanks for the image! It worked like a charm, and the update to Centos 5.5 worked flawlessly!
Comment by pmoor — May 18, 2010 @ 7:02 pm
You are welcome! I’m traveling this week, but I plan to update the image to 5.5 and post it either this weekend or sometime next week.
Comment by admin — May 18, 2010 @ 8:11 pm
Great Job! I was waiting a long time for this
Comment by psiriders — May 26, 2010 @ 5:48 am
Glad you like it!
Comment by admin — May 26, 2010 @ 6:40 am
Hi Joe,
Got the following errors when tried to installed Dahdi:
You do not appear to have the sources for the 2.6.18-164.el5 kernel installed.
make[1]: *** [modules] Error 1
make[1]: Leaving directory `/usr/src/dahdi-linux-complete-2.3.0+2.3.0/linux’
make: *** [all] Error 2
Have installed kernel-devel-2.6.18-164.el5, but still didn’t help.
Any ideas?
Thanks.
Comment by rg3 — June 1, 2010 @ 9:06 am
The image is not set up for compiling new software. I did this because I assume that most users are looking for a stripped down server and will add the features they need.
In your case, you will have to install both the kernel-devel and kernel-headers packages, and maybe more. I haven’t used Dahdi before, so I can’t be more specific.
Before I went through all that I would try to find a repository that already compiled the software for RHEL5. It appears that the epel repository has three dahdi packages: dahdi-tools, dahdi-tools-devel and dahdi-tools-libs. You might want to start there.
Also – you shouldn’t need to compile software on the ALIX itself. If you are going to work on software for your ALIX, I would recommend compiling it on a full-speed machine, or even a virtual machine. If you create an RPM spec script and package it as an rpm file, then you will only need to install the rpm with the binaries on the ALIX and you won’t have all the extra stuff lying around. You also won’t have libraries on the machine that aren’t accounted for in your rpm database. Creating an rpm is not hard, and will save you mountains of time and headache in the long run. Check out my software repository for some examples of RPMs that I distribute. I try very hard to make them tidy and not cludgy. But it’s always better if someone has already done the work for you. I use the EPEL and rpmforge repositories a lot and almost never have problems. Centos provides a link that shows how to set everything up properly for using multiple repositories.
Comment by admin — June 1, 2010 @ 10:10 am
I have a specialized image of Centos on my CF card and I am looking to create my own image file from that CF card that will work with physdiskwrite. I would like to copy the image onto multiple CF cards. What software did you use to create your image file? Any help I could get would be appreciated.
Comment by liquid — June 30, 2010 @ 12:56 pm
I used VMware Workstation. I understand that it is just as easy to use the opensource tools (qemu/kvm/virt-manager) under Centos, but I’ve used VMware for years.
In VMware, I created a new virtual machine and used the 2GB SanDisk as a physical partition instead of the normal virtual partition. I removed the sound bridge, added an extra virtual network and installed as normal. Once the installation was complete I removed a bunch of extra packages and converted the boot configuration to serial-only.
There is a quick ‘System emulation with QEMU’ tutorial from IBM on qemu at http://www.ibm.com/developerworks/linux/library/l-qemu/
–JATF
Comment by admin — June 30, 2010 @ 1:44 pm
hi!
will it work on a wrap board also?
Comment by elgreco — August 24, 2010 @ 1:38 pm
Hi Joe
I am trying to resize the image to 4Gig CF and 8Gig CF but no luck, could you help me out with some pointers? Or even better make 4gig and 8gig images availble
-GNU
Comment by GNUXPloit — August 24, 2010 @ 2:11 pm
I don’t know what you mean. What is a wrap board? Send me a link and I’ll take a look.
Comment by jfreivald — August 26, 2010 @ 10:58 am
If you want to send me some cards and a nominal check I would be happy to build you a few and provide the images to the community.
To do it yourself you would have to do one of the following:
One way would be to utilize the rest of the space using a separate LVM. For that you would create a second physical volume, add it to the volume group or create a new volume group, create a new logical volume, create the file system and then mount it somewhere (/usr /var or /home would be good, depending on your requirements). If you are mounting it under /usr of /var you will want to migrate the files by mounting the new file system under /mnt and using tar to move them. All of this could be done on a live machine, but the original /usr and /var space wouldn’t be recovered until you mounted it under with a separate machine and removed the files. This is what I would do to get one or two systems online.
Another way would be to add the new physical volume, add it to the volume group and then grow the logical volume to the new size. Then you would have to grow the ext3 file system by first removing the journal (using tune2fs, which would make it an ext2 file system) and then resizing it. Both of those operations have to be done unmounted, so the card must be loaded into another linux box during the whole process. This is what I would do if I were doing a dozen or so.
The last way would be to mount the image on a separate machine, create the proper LVM structure on the new flash, copy the files from the image to the new box (using a piped tar is the easiest way to do this), mount this new image with QEMU or VMwareWorkstation, boot the virtual image with a CD, chroot to the new card, install the boot-loader and reset the selinux permissions. This way is the only way you wind up with a since LVM physical partition, but it’s a lot more work and I don’t think it buys you much. This is what I would do to provide a clean image to the community, or as a baseline project to build multiple projects on.
Cheers.
–JATF
Comment by jfreivald — August 26, 2010 @ 11:19 am