Creating a CentOS text-only CD / DVD

Some HP ProLiant systems come with a stripped down version of ILO (Integrated Lights-Out) management card that, without an additional license, supports only text mode remote console. While this is indeed a big problem for Windows users who are therefore forced to purchase the Advanced ILO license, Linux can happily run in a text mode. With one exception though: installation disks of most current distributions boot up into a graphical mode first and only then allow selecting a text-only installation. That’s true at least for RedHat Enterprise, CentOS, OpenSUSE and Ubuntu.

CentOS graphical boot splash
Useless CentOS boot-time graphical splash screen.

Since the boot-time graphics is totally useless let’s build a custom installation CD with a text-only boot loader. In the following how-to we are going to rebuild the first CD of CentOS 5.3 in x86_64 version. However the general concept should be applicable to the installation CDs or DVDs of any current distribution as long as they use isolinux boot loader. Majority of them do.

Text-only CentOS

  1. Download CentOS-5.3-x86_64-bin-1of7.iso from your favourite CentOS mirror.
  2. Mount it as a loop-back device so that we can access its content:
    ~# mount -oloop,ro /data/iso/CentOS/CentOS-5.3-x86_64-bin-1of7.iso /mnt
    ~# cd /mnt
    
  3. Copy isolinux subdirectory to some writable location, for instance to /tmp:
    ~# cp -a /mnt/isolinux /tmp
    ~# cd /tmp/isolinux
    /tmp/isolinux# ls -l
    total 8616
    -r--r--r-- 1 root root    2048 Mar 22 02:14 boot.cat
    -rw-r--r-- 1 root root     292 Mar 22 02:14 boot.msg
    -rw-r--r-- 1 root root     919 Mar 22 02:14 general.msg
    -rw-r--r-- 1 root root 6640927 Mar 22 02:13 initrd.img
    -r--r--r-- 1 root root   10648 Mar 22 02:13 isolinux.bin
    -r-xr-xr-x 1 root root     364 Mar 22 02:14 isolinux.cfg*
    -r--r--r-- 1 root root   94600 Mar 22 02:14 memtest
    -rw-r--r-- 1 root root     817 Mar 22 02:14 options.msg
    -rw-r--r-- 1 root root     517 Mar 22 02:14 param.msg
    -rw-r--r-- 1 root root     490 Mar 22 02:14 rescue.msg
    -rw-r--r-- 1 root root   63803 Mar 22 02:14 splash.lss
    -r--r--r-- 1 root root    2659 Mar 22 02:14 TRANS.TBL
    -rw-r--r-- 1 root root 1889308 Mar 22 02:13 vmlinuz
    
  4. Remove boot.cat file—it will be re-created later. Also remove splash.lss as that’s the boot-loader image we don’t like.
    /tmp/isolinux# rm -f boot.cat splash.lss
    
  5. Edit boot.msg file and remove the reference to splash.lss (it’s on the 2nd line, remove the whole line). Eventually replace it with a custom message saying it’s a CentOS 5.3 installation. Also change the first hint message (you’ll see later why):
    ^L
    ^Xsplash.lss[[CentOS 5.3 x86-64]]
     —  To install or upgrade in graphical mode, boot from the hard drive press the ^O0b^O07 key.
     —  To install or upgrade in text mode, type: ^O0blinux text ^O07. [...]
    
  6. Optionally edit isolinux.cfg and change the first line from default linux to default local
    default linuxlocal
    prompt 1
    timeout 600
    display boot.msg
    

    This change will make the CD boot from the harddrive by default. That means you can leave the CD in the drive and the server will come up properly even after reboot. Original CD starts the graphical installation by default which is IMHO a bad idea.

  7. Now with all the changes done we need to put the modified files back into the CD tree and recreate the ISO image.
    • One way is to copy everything off /mnt and place the changes there. That's a needlessly space-consuming approach, especially with DVDs.
    • Better way is to bind-mount /tmp/isolinux back to /mnt/isolinux and effectively replace the old directory with our modified one:
    ~# mount --bind /tmp/isolinux /mnt/isolinux
  8. Now compile the new text-only bootable ISO image using mkisofs:
    ~# mkisofs -R -J -T -v -V "CentOS 5.3 x86-64 text" 
            -no-emul-boot -boot-load-size 4 -boot-info-table 
            -b isolinux/isolinux.bin -c isolinux/boot.cat 
            -o /data/iso/CentOS/CentOS-5.3-x86_64-bin-1of7-text.iso /mnt
    mkisofs 2.01 (cpu-pc-linux-gnu)
    Scanning /mnt
    Scanning /mnt/CentOS
    Excluded: /mnt/CentOS/TRANS.TBL
    Scanning /mnt/images
    [...]
     97.59% done, estimate finish Thu Jul  2 13:03:10 2009
     99.16% done, estimate finish Thu Jul  2 13:03:10 2009
    Total translation table size: 197177
    Total rockridge attributes bytes: 83484
    Total directory bytes: 129024
    Path table size(bytes): 112
    Done with: The File(s)                             Block(s)    317394
    Writing:   Ending Padblock                         Start Block 317533
    Done with: Ending Padblock                         Block(s)    150
    Max brk space used c6000
    317683 extents written (620 MB)
    
  9. That's it. Now burn the ISO onto a CD and enjoy a pure text-only CentOS installation!

CentOS textual boot splash
New text-only CentOS boot loader

Here we go, this disk will work nicely even on a ProLiant with a crippled ILO :-)
Oh, by the way, you may wonder how did I make the purple colour for the [[ CentOS 5.3 x86-64 ]] title... The trick is: isolinux can interpret some special character sequences as colour-codes and I simply wrapped the title with these. Have a look here for a list of these codes or download IsoLinux Mate if you want a user-friendly tool for creating custom isolinux boot screens.