Joe's Linux Blog Linux Admin tips and tricks

April 22, 2010

ALIX Centos Image

Filed under: ALIX,Centos,Installation — Tags: , , , , , — jfreivald @ 10:48 pm

UPDATE 12/31/2011: I have updated the Alix Centos 5 image to 5.7.  During the process, I removed the /etc/ssh/ssh_host* keys so that each host will generate its own keys on boot up.  Note that during the ‘yum upgrade’ process, I had boost the memory on the virtual image. Yum was unable to allocate enough ram with only 256 MB available. This means that it is unlikely that an update from 5.5 to 5.7 can be performed in a single step on a live board with only 256 MB of RAM.

As for the Centos 6 image, it is being troublesome because the up-line removed all of the non-pae kernel images for the 32-bit architecture.  I’ve attempted to custom package a few kernels to complete the image but none of the work to my satisfaction.

UPDATE 10/22/2010: Added a step in the ‘Using the Image’ section below. All active installations should ensure they replace their SSH System keys to prevent man-in-the-middle attacks. I will post an updated image that has the keys removed when I get around to it. Until then, just perform the commands in item 7 of the Using the Image section.

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.7-2gcf.gz.  There is also an MD5 sum file at http://software.freivald.com/centos/alix-centos-5.7-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.

UPDATE: Hat-tip @Cris. In order to get the vga to work on the 3d3 board you must put the irqpoll as kernel boot parameter.  See his comment for more information.

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.  Hook up a terminal emulator set to 38000, 8N1 to view the boot sequence or access the console directly.

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 use 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.

Using the Image

1.  Download the latest image from http://software.freivald.com/centos/.

2.  Unzip the image with bunzip2.  Please verify the uncompressed image with md5sum. Several users who had issues simply had bad downloads or uncompressed the file improperly.  An md5sum will catch these types of issues.  The md5sum file is in the same directory as the image.

3.  Copy it to your Compact Flash drive using ‘dd if=<inputfile> of=<outputdevice> bs=4096’.  <inputfile> is the uncompressed image that you verified in step 2.  <outputdevice> is your compact flash card.  You can find the correct one for your system with ‘sudo parted -l’.  You must use the disk device, not a partition i.e: /dev/sdc as opposed to /dev/sdc1.  This will install the boot loader and all necessary partitions to have a running system.  If your compact flash is larger than 2GB, see the comments section of this post for ways in which you can use the rest of the space.

4.  Install the Compact Flash into the ALIX.

5.  Attach your favorite terminal program to the ALIX platform.  I use putty.exe under Windows or minicom under linux.

6.  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.

7.  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.

8. On images earlier than 5.7, change the SSH server keys with:
$ sudo rm /etc/ssh/ssh_host_*
$ sudo /etc/init.d/sshd restart
(Hat tip to @pmoor for catching this one!)

With this setup, the initial boot up takes 1:32 and has 193MB of free memory. Enjoy.

–JATF

65 Comments »

  1. 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

  2. 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

  3. 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 0x83
    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

  4. 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

  5. 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

  6. 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

  7. 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

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

  13. Great Job! I was waiting a long time for this 😉

    Comment by psiriders — May 26, 2010 @ 5:48 am

  14. Glad you like it!

    Comment by admin — May 26, 2010 @ 6:40 am

  15. 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

  16. 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

  17. 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

  18. 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

  19. hi!

    will it work on a wrap board also?

    Comment by elgreco — August 24, 2010 @ 1:38 pm

  20. 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

  21. 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

  22. 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 single 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

  23. Great work Joe!!

    Just for giggles I installed this into a Soekris 5501 and it worked just dandy!!

    eth0 is next to the serial port.

    eth1 is the next one along.

    Comment by NI2O — October 11, 2010 @ 8:15 pm

  24. Glad you like it!

    Comment by jfreivald — October 11, 2010 @ 8:19 pm

  25. One more important thing people should change when using this image are the SSH server keys, otherwise anyone can use a man-in-the-middle attack against these installations:

    $ sudo rm /etc/ssh/ssh_host_*
    $ sudo /etc/init.d/sshd restart

    also, regarding resizing the volume, the following worked for me on my host machine:

    $ sudo fdisk /dev/sdX # sdX = the CF card

    switch to sector units (u), delete the second partition, and then re-create the second partition with the exact same start sector and type:
    d 2
    n p 2 205632
    t 2 8e
    w

    $ sudo lvm
    lvm> pvscan
    lvm> pvresize /dev/sdX
    lvm> lvresize -L +1.8g (change this as needed)
    lvm> lvchange -a y VolGroup01/LogVol00

    $ sudo e2fsck -f /dev/mapper/VolGroup01-LogVol00
    $ sudo resize2fs /dev/mapper/VolGroup01-LogVol00
    $ sync

    -> remove drive and boot.

    Comment by pmoor — October 22, 2010 @ 10:47 am

  26. @pmoor: good catch on the keys. I’ll put that on the list. Thanks for the input on resizing. I’m sure there are more than a few people who will find it useful.

    Comment by jfreivald — October 22, 2010 @ 11:34 am

  27. Hi.
    First. nice job on the image.
    just 2 questions.

    when i install the image on my card yum doesnt work. i have to rebuild the rpm database (after that it works)

    Do u know how to install a x11? i’m trying for day’s now to get fluxbox to work but with no luck.
    startx works i see my mouse for like 2 sec then i get back in the normal console.

    I’m trying to make a small firefox kiosk from my alix 1d but with no luck so far.

    If u could provide any help to get that x11 to work it would be realy nice

    Comment by Terrorhawk — October 25, 2010 @ 2:01 pm

  28. @Terrorhawk:

    Thanks for your kind words. I believe that x11 is a group in yum, so all that would be needed is:
    yum groupinstall x11

    –JATF

    Comment by jfreivald — October 25, 2010 @ 2:26 pm

  29. @Terrorhawk:

    I double checked, and the command for installing the X Windows Group is:
    yum groupinstall "X Window System"

    You can also do a:
    yum grouplist
    To see all of the groups that are available.

    –JATF

    Comment by jfreivald — October 25, 2010 @ 5:20 pm

  30. Joe,

    Thanks for the great effort with Centos and ALIX boards!

    I have a new Alix6e2 board. I have created a 2Gig Cf, flashed your image and installed. Seems to boot normally initially, but eventually comes to:

    (from serial port)

    ERROR opening /dev/console: Not a directory
    Trying to use fd 0 instead.
    WARNING: can’t access (null)
    exec of init ((null)) failed!!!: Bad address

    any thoughts?

    thanks,

    Jason

    Comment by jtaubman — December 22, 2010 @ 10:19 am

  31. @jtaubman

    Not a clue. 6e2 is the same board I made the image with, so it should work out if the box.

    I’m waiting to redo the image when Centos 6 is released, so I’m resisting fiddling with it until then.

    Did you check the md5 of the image before you copied it to the flash?

    –JATF

    Comment by jfreivald — December 22, 2010 @ 10:55 am

  32. MD5 checked out fine….

    Tried on a 4G card, worked fine. Tried on a different 2G card, worked fine. Tried again on original 2G card, same failure. So… suspect bad 2G card.

    Off to fiddle… thanks again!

    Jason

    Comment by jtaubman — December 22, 2010 @ 10:20 pm

  33. Joe, Excellent work on this project! Inspired by your efforts, I have used Virtualbox with USB redirection to install CentOS directly to a 2.5″ IDE hard drive (using a USB to IDE dongle). It is my hope to explore further into the tweaks you did to minimize wasteful writes to the CF, and make them part of a CentOS kickstart config post install script. I have been using the UDA Appliance (www.ultimatedployment.org) to automate repetitive installs via PXE boot in our environment – which happens to be a data center environment where remote installation is the norm.

    The ALIX board’s 256MB of RAM is plenty to run CentOS, however, not apparently enough to install successfully. Anaconda chokes and runs out of memory when you install via NFS or HTTP. Since ALIX boards do not support booting from USB, the PXE boot install option is all that is left. I have thought of writing a shell script that could do the partitioning of the CF card and/or hard drive media (while physically on the ALIX), and then mounting the ISO off the local partition. I would still copy the installation media over NFS or HTTP, but it would make Anaconda happy. This would then leave enough memory for Anaconda to complete the job, or even allow swap space to be enabled ahead of the dependency checking process which is where all the memory gets eaten up.

    The other option I am considering is to use a PXE boot environment to fetch a copy of the raw disk image and then use dd to write the image to the CF and/or hard drive. If I find either option works, I still would need to automate the installation of CentOS to accommodate it to the ALIX hardware.

    Do you use a shell script to modify the install in VMWare prior to imaging it? I would imagine that such a shell script could be adapted to work as part of a kickstart config. The UDA appliance provides the plumbing to make the kickstart configuration very easy and relatively painless. If you have any scripts that you could share, I would like to help adapt them for a similar installation/build using the UDA appliance.

    Thanks!

    Matt

    Comment by mattorola7 — December 29, 2010 @ 2:00 pm

  34. @mattorola7

    Sorry for not responding earlier. Your post got lost in the shuffle and I didn’t see it until today.

    I don’t do anything fancy to perform the VMWare install. One of the nice things about VMWare is that I can put the memory at 2GB for the install and then throttle it down when I’m testing the running image. Anaconda is a huge hog, and I hate tweaking with it. I played around with it years ago trying to get a custom build with extra packages under Fedora and found it was much less painful to add a repository after the install with a yum install group and perform my installs that way. It also turns out to be more portable, since I can then create repositories for EL, Centos and others without the need to fuss with an installer or kickstart scripts. The only reason I can see monkeying with a kickstart disk is on network-isolated boxes in secure areas that do not allow USB storage.

    As for the ALIX adjustments, they are done by-hand. I plan to do another release when Centos 6 comes out. The build crew are reporting that it’s still a few weeks out.

    –JATF

    Comment by jfreivald — January 10, 2011 @ 5:52 pm

  35. Vnc server possible?

    Anyone know how (or if possible) to have the Alix board run vncserver in order to get a remote x display?

    I have an application that will only run in an X environment. Once I set the application running I could close the vnc client and allow the application to keep running.

    Thoughts?

    Ted

    Comment by Ted_SD — January 3, 2011 @ 1:49 pm

  36. @Ted_SD

    There shouldn’t be a problem running an X server, if you keep in mind the limited nature of the processor and memory available. If I were doing it, I would install individual packages one at a time until the application runs rather than installing the “X Windowing System” package group since you can often get away with far fewer packages and less RAM.

    You could start with ‘yum install vncserver’ and see what else it needs to run. Edit /etc/sysconfig/vncserver and put in the user you want to use. Start the server once manually for the user, and then edit the .startup file in the user’s .vncserver directory to start the app you want instead of xterm. Xdm will be the default window manager, which is NOT user friendly to non-unix heads, but fine if you set it up like a kiosk. I wouldn’t attempt KDE or GNOME as their memory requirements are too high. There are some other lightweights out there (xfce, and others) that might do better if you can’t stand xdm.

    Cheers.

    –JATF

    Comment by jfreivald — January 3, 2011 @ 11:43 pm

  37. JATF, I installed the xfce packages. I placed “exec xfce4 &” in my xstartup file. All I get is a grey screen when I run VNC viewer. I also tried placing “xfce4-session” but the same thing happens.

    Tried xdm too.

    Thanks

    Ted

    Comment by Ted_SD — January 5, 2011 @ 8:05 pm

  38. @Ted_SD

    I don’t use xfce so I’m not much help there. Perhaps you could find help on the xfce lists? If you hit a complete brick wall let me know and I’ll look into it.

    –JATF

    Comment by jfreivald — February 17, 2011 @ 1:04 am

  39. Hi Joe,
    I’ve been struggling to write the centos image in a 4Gb flash drive. What happens is that after dd, the first boot partition /dev/sdb1 is ok, but /dev/sdb2 is not readable, the super block is corrupted and I haven´t managed to fix it.
    Would it be possible that you publish the 4Gb image that you have?

    Thanks in advance Victor

    Comment by vplata — February 12, 2011 @ 7:45 pm

  40. @vplata

    Did you check the md5sum of the image?

    I plan to have 2 and 4 GB images of the new versions as they come out. According to twitter.com/centos, the 5.6 update should be seeding later this week. Are you under a time crunch to have the 4 GB image or can it wait for the 5.6 update? I can make you one if it’s critical and time sensitive.

    –JATF

    Comment by jfreivald — February 12, 2011 @ 8:58 pm

  41. J,

    I was wondering if you could shoot me a message about how to create the cf images, I am looking to do an image with asterisk and freepbx on it for use on embedded platforms…..I have virtual machine capability on my macbook using parallels, similar in concept to vmware (i’ve used vm in the past)

    -Andy

    Comment by dfwbt — February 12, 2011 @ 11:13 pm

  42. Joe,
    It’s not really critical, I’m just eager to move forward. I think I can wait for 5.6
    Thanks for you fast response.

    /Victor

    Comment by vplata — February 13, 2011 @ 1:55 pm

  43. Hi

    I might have the same problem as @victor have tried several times to dd the image to a 16GB CF card but I never get any response on 192.168.1.50 or dhcp on the 3 ports of my alix.2d13.

    Steps:
    1. gunzip the image
    2. dd if=alix-centos-5.5-2gcf of=\\.\d:
    3. add the cf to the board and attach net cable
    4. power on
    5. ping 192.168.1.50 and watching my linksys wrt54gl dhcp log in 3 goes for all ports. (have added a virtual ip to the linksys 192.168.1.2/24)

    Any good suggestions.

    Using dd from http://www.chrysocome.net/dd

    Comment by coq-rouge — February 16, 2011 @ 11:24 pm

  44. @coq-rouge

    My guess is the dd for windows doesn’t properly handle the raw disk copy or that the 2.13 has some other gotcha I don’t know about (I only have the 6e2).

    Try booting your computer with a Linux Live CD. Ubuntu has a really nice that is easy to use – open a terminal and type ‘sudo su -‘ to get root access. ‘parted -l’ will tell you where the CF disk is.

    If that fails we’ll have to re-think things. You are overseas (well, not from your perspective. ;D ) so shipping the board back and forth is probably out.

    Cheers.

    –JATF

    Comment by jfreivald — February 17, 2011 @ 12:51 am

  45. thinking if I would have more luck with the alix-centos-5.4-2gcf image. Is there some there have had success with the 5.5

    Wonder if I got a bad board shiped.

    Looking forward to some response 🙂

    Thx Coq Rouge

    Comment by coq-rouge — February 16, 2011 @ 11:29 pm

  46. @coq-rogue

    I sincerely doubt that you have a bad board. If you are going to do more than one box it is probably a good idea to invest in a USB to Serial cable and a null-modem adapter so yo u can use the console port. Not only does it give you the BIOS and GRUB bootloader access, but it also prints out all of the boot-up sequence message, kernel debug messages and gives you the ability to change the network configuration without losing control of your session. It saves the cost in frustration, confusion and anguish – which is an easy trade. 🙂

    You are welcome to try the 5.4 board – a ‘yum upgrade’ will bring it up to date in short order, but I’ve used the 5.5 image several times (6 installs + 10 or 15 writes to flush a CF back to starting configuration after I’m done testing) on both 2 and 4 gb flash drives, plus it gets downloaded between 2 and 20 times each day and only a few people have had issues, so I’m leaning toward the image being just fine and the individual set-ups that are being used are the problem. In your case I’m highly suspicious of the Windows environment. In my experience unix tools almost never work just as they should under M$ systems. YMMV.

    –JATF

    Comment by jfreivald — February 17, 2011 @ 1:00 am

  47. Got a live usb and live cd but my note is locked and my centos hardware pc had a hardware crash why I got the alix. Have tried dd on mac same same problem and dd on openwrt same same problem 🙁

    regards

    Comment by coq-rouge — February 17, 2011 @ 12:55 am

  48. can I mount the card somehow after I dd’ and check it on a windows or mac..

    Comment by coq-rouge — February 17, 2011 @ 1:02 am

  49. I got the usb to serial cable but again my windows is locked also for adding drivers 🙁 trying to see if I can get it running on my mac.

    Openwrt and mac is unix/linux systems where I used dd with same issue.

    Will try the 5.4 tonight and get the cable running on the mac.

    regards

    Comment by coq-rouge — February 17, 2011 @ 1:06 am

  50. Joe,
    I guess the problem with the 2 gig image is that when you dd from 4 gig to 2 gig the second partition became corrupted, I checked the MD5 and is ok and I’m working with Linux, but the partition is damaged after the copy.

    /Victor

    Comment by vplata — February 18, 2011 @ 11:19 am

  51. no luck..

    the dd makes 2 parttions 105mb linux and a 1,91GB Linux_lvm partition on serial 38400 N81 is there only a blank screen.

    Anyone got an ideer

    /coq-rouge

    Comment by coq-rouge — February 19, 2011 @ 4:18 pm

  52. Hi Jo,

    i work on the same project regarding centos and alix in our company and have made some images by my self.
    I would like to share my experience with you: it would be better to use a ext2 filesystem or deactivate the journaling in ext3 so write operations are as minmal as possible. also a minimal installation of centos would be nice, this way some of the stuff you have deactivated, kudzu, iptables…, wouldn’t be installed, you just can uncheck all boxes in the extended package selector at the setup screen, you also would save much diskspace because all documentations are not installed this way….

    some meaningful names for the volume groups and logical volumes in LVM would nice, but that could be just my petty-minded brain 🙂

    kind regards.

    Comment by T-One — May 20, 2011 @ 3:52 am

  53. @T-One

    I had considered each of those items when creating the image. Our requirements are somewhat different. If you are maintaining an image for your work you have tight control over who does what to the unit. Releasing the image to the public, I must consider that novice builders will use the image to make a variety of appliances and I wanted to make it as bulletproof as possible. Plus, let’s be honest: I’m lazy, and the closer I can keep it to a stock Centos install, the less likely I’ll be to have people asking questions because something isn’t where they expect it to be. 😉

    I selected ext3 because the Alix has no backup power facilities, and if someone uses it for a SOHO router or firewall it is very likely that a user will unplug the unit at some point to reset the network, or a power outage will cause the unit to be reset mid-process. Ext3 should automatically recover from this, but ext2, without the journal, has a high probability of causing the file system to stall when the unit is booted next, requiring a console hook-up to complete the fsck cycle. For most appliances, this would be considered unacceptable. Advanced users will know that they can turn the journal off with tune2fs, but the novice builder will be better off with this safeguard. Modern flash cartridges use write leveling and bad-block exclusion and each block is good for tens of millions of writes, so even with the journal they should last years and years as an appliance. Also, the use of tmpfs should limit the flash-based writes to the /tmp directory. The Alix’s processor and memory specifications restrict it from being an effective server for write-intensive services like a major database or web server anyway, so I think there is very little risk there. If someone is looking to use the Alix in a write-intensive environment (say, as an IDS logger) they are most likely an advanced user and should solder an IDE header in place and put in a 1.8″ or 2.5″ hard disk instead of flash. They’ll have much more space and much better long-term performance since the flash write performance will degrade over time.

    As for the space savings, I considered that the price of flash having dropped like a stone the last few years and the small level of space savings compared to the 2GB image size did not warrant the inconvenience of having no documentation or basic services at the builder’s disposal. Again, the advanced user can remove any package they wish with a variety of tools, but the novice may not know exactly how to get that basic functionality back, or at the very least might have to waste many hours trying to figure it out. I run my servers with 4GB cards and 8 – 64GB cards are available for someone who might need vast amounts of space in a small package, or who want to extend the run-time of the unit.

    I thought about having more descriptive LVM names, but most tutorials online use the standard names so I just stuck with them. Again: Keep it simple so I can be lazy.

    Thanks for the input. I’m not attempting to be argumentative and hopefully I’m not letting my ego get the best of me. I just wanted to let you know that I did think about each of the points you brought up. I might have made bad decisions for some people, but I hope that they are good decisions for most people. 🙂

    It’s nice to know I have a bedfellow out there working the Alix/Centos images. Do you have many of the platforms? I have only the 6e2. I’ve been swamped with our youngest son finishing High School and my wife starting a new job so I haven’t done an upgrade to 5.6 yet. I’ll be on travel for two weeks and I plan to bring one with me to work on in the hotel. Who knows – maybe they’ll release 6 in the mean time and I can get them both done at once!

    Cheers

    –JATF

    Comment by jfreivald — May 20, 2011 @ 8:43 am

  54. What are your thoughts on moving logging to tmpfs or disabling most logging?

    I’m going to be using this in a production environment, so I want to maximize my CF card lifespan.

    Thanks, and thanks for this image! 🙂

    PS: I installed to a 4gb card and successfully added a pv and extended the lvm group with no problems. 🙂

    Comment by scoob8000 — June 17, 2011 @ 5:28 am

  55. @scoob8000:

    I don’t recommend disabling logging, especially in a production environment. Doing a post mortem off a failure of a production device is critical, and modern flash drives are very robust. Each cell can be written to millions of times, and the flash disk hardware ensures that the lifespan of the device is maximized by using write leveling (prevents you from writing to the same spot over and over, even if you try), and error correction and lockout (verifys each block after write and locks out blocks as they fail). What I would do is this: on your test device, verify the average daily log file size in blocks. Calculate how many blocks per year are expected to be written. Divide by 1,000,000 writes. That’s how many blocks you would ‘consume’ (as in wear out completely) in one year. Multiply by the lifespan of the device (say 10 years), and then double that amount.

    You will notice that unless your logs are VERY large, the results are small enough as to be meaningless because there wouldn’t be enough of them to store the data in the first place. That’s because flash drives are very, very robust and you shouldn’t worry about it unless you are really pushing the limits.

    The benefits of having system logs far outweigh the maintenance headache they may cause.

    Cheers.

    –JATF

    Comment by jfreivald — August 26, 2011 @ 7:05 pm

  56. Great Job !!! A really nice package and well document, it was a pleasure to have it working smoothly on my Alix Box.

    – I would add I had to remove yum cache to have it working properly to be able to install the wap_supplicant package (something like rm -rf /var/cache/yum/…

    – Now just a question: to create an image (I’d like to backup my CF) is it enough to do: dd if=/dev/hda of=/tmp/my-wifi-alix-centos.cf ?

    Regards,
    PhR.

    Comment by prochat — July 1, 2011 @ 3:56 am

  57. @prochat

    Interesting. I’m not sure why you would need to delete the cache, but it’s probably a good idea for me to remove the cache from future images anyway. Thanks for the heads up.

    The backup you suggest is the easiest and most complete way to do a backup of the compact flash. It will also take the longest time, since it is copying empty space as well as data. There are a variety of other, more efficient ways of doing it (just like any linux system), but the command you specify is certainly the simplest. I would suggest that you compress the image after the fact with bzip [ bzip /tmp/my-wifi-alix-centos.cf ] or during the process [ dd if=/dev/hda | bzip > /tmp/my-wifi-alix-centos.cf.bzip ] which will make the image much smaller, especially with all that empty space.

    –JATF

    Comment by jfreivald — August 26, 2011 @ 7:22 pm

  58. for anyone trying to use this image with an Alix 3D3 with vga, irqpoll must be added as kernel boot parameter.
    i had trouble without with irq sharing between USB controller and network card. none of them was working.

    Comment by !Cris — November 7, 2011 @ 3:48 am

  59. @!Cris

    Thanks for the information! I don’t have any Alix with the vga, so I’m unable to test. I’ll put your comment into the main post.

    –JATF

    Comment by jfreivald — November 7, 2011 @ 7:33 am

  60. Hi Joseph,

    I had iMedia Linux installed on my alix box, but was looking for something with better package management, etc. I flashed up my 2gb card with alix-centos-5.5-2gcf, but it won’t boot. I think I don’t have the right bootloader. The last bit that shows up before boot fails is:

    01F0 Master 045A InnoDisk Corp. – iCF4000 2GB
    Phys C/H/S 4063/16/63 Log C/H/S 1015/64/63
    Loading iMedia …Error 17

    Do I need to update the bootloader with GRUB or something like that? I followed the general directions for dd’ing the image, but that was apparently not enough.
    Thanks in advance for your help!
    -Casten

    Comment by casten — December 30, 2011 @ 10:01 pm

  61. @casten The boot loader is already configured on the image. It should ‘just work’.

    I expect that something is wrong with the process you used to copy the image to the flash. Could you enlighten me as to your procedure?

    –JATF

    Comment by jfreivald — December 30, 2011 @ 11:21 pm

  62. Hi Joe

    I just got my Alix 3d3 and installed Your latest CentOS 5.7 image.
    So far so great, thank’s for Your work.
    I see the boot process over the tty connection, but at the end there’s no login prompt.
    I get

    usbcore: registered new driver usbfs
    usbcore: registered new driver hub
    PCI: Probing PCI hardware
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
    NetLabel: Initializing
    NetLabel: domain hash size = 128
    NetLabel: protocols = UNLABELED CIPSOv4
    NetLabel: unlabeled traffic allowed by default

    and the last I get is

    Waiting for driver initialization.
    Scanning and configuring dmraid supported devices
    Scanning logical volumes
    Reading all physical volumes. This may take a while…
    Found volume group “VolGroup01” using metadata type lvm2
    Activating logical volumes
    1 logical volume(s) in volume group “VolGroup01” now active
    Creating root device.
    Mounting root filesystem.
    kjournald starting. Commit interval 5 seconds
    EXT3-fs: mounted filesystem with ordered data mode.
    Setting up other filesystems.
    Setting up new root fs
    no fstab.sys, mounting internal defaults
    Switching to new root and running init.
    unmounting old /dev
    unmounting old /proc
    unmounting old /sys

    What can I do ?

    How far is Your progress with CentOS 6 and maybe greater CF Cards, I use a 16 GB now.

    Best regards .. jr

    Comment by jr — May 11, 2012 @ 3:37 am

  63. how do you expand the 2gb image to a bigger cf?

    Comment by john — March 5, 2014 @ 1:00 pm

  64. Thanks for the effort in making the image. I have a couple if minor problems with the image that you may be able to help with.

    The first is permissions on /dev/ttyS0. They come up as 0600. I need them to be 0666 I tried changing that in rc.local but it doesn’t seem to have any effect. I also fiddled with udev rules for “console” but no result either.

    I can change the permissions if I log in as root after booting has completed. What I want to do is have them set to 0666 as part of the boot process. Any suggestions?

    The second problem is the ntp client. My boards don’t have batteries for the RTC and ntp refuses to adjust the time as the power-on difference is too great. Any suggestion on how to make the time always adjust?

    Thanks

    Comment by JeremyArdley — October 12, 2014 @ 7:34 pm

  65. Sorry for not getting back to you sooner.

    I can’t help you with the ttyS0. I think that because it is the console it will always come up 600.

    For time, in rc.local, run ntpdate first, then start the NTP server.

    –JATF

    Comment by jfreivald — March 19, 2015 @ 11:46 am

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress