Articles

  • Run SuSE Studio images without persistence

    UPDATE (20/07/2013): A new workaround has been found that works with OpenSuSE 12.x.


    UPDATE (10/03/2012): This trick no longer works as of OpenSuSE 12.1 because the code that checks for USB boot devices during boot has been removed; only CD/DVD devices are checked on boot. (The code commit that changed this can be seen here.) The functions to perform the check are still there though, so if you modify linuxrc or the include file inside the initrd to call them, everything should just work. Unfortunately, SuSE Studio doesn't offer a way for you to hook into Kiwi so you can perform these changes before initrd is built (even though Kiwi itself has these hooks). Therefore as far as I know, this trick will only work with v11.4 or earlier.


    I've been playing with SuSE Studio recently - it allows you to build custom Linux images (on top of the OpenSuSE/SLED base) via a nifty web interface, test drive them before downloading them in a range of formats, including LiveCD, disk image or as a Xen/VMware image. 

    The beauty of it is it allows you to make easily reproducible Linux images, without having to keep the build configuration somewhere local. The downside however is that you need to download the entire image again every time you make a change, no matter how minor. (It'd be great if you could download binary diffs from previous versions, or better yet, be able to make limited local modifications without the build system.)

    I wanted to make a bootable USB stick, but without persistence so I can play around all I want without having to worry about breaking it. I'm using it as a replacement for Slax, which is unfortunately no longer being actively developed.

    Getting the custom Linux image to boot was easy - SuSE has a useful Image Writer tool for Windows users, and Linux people can simply use dd. However, it requires you to use the disk image format, which means changes are persisted on to whatever you put it on; the USB stick in this case.

    The only format without persistence is the Live CD format, but it isn't just a case of writing that image to the USB stick, because it uses ISOLINUX to boot, i.e. expects to be booted from a CDROM, or something emulating a CDROM. (At least from my experience anyway. The OpenSuSE instructions here seem to suggest otherwise. So give that a shot first, and come back here if it doesn't work.)

    What was needed was to use SYSLINUX instead, which is designed to boot off standard hard/flash drives, as well as some tricks to make the OpenSuSE startup code think it is a CDROM. Because of this though, this trick will not work if the system you're booting on actually has a CDROM (or some other optical drive) installed/attached.

    The following instructions are for a 32-bit image and to be performed on Windows, but should be easily adjustable for 64-bit and/or Linux.

    Prep the drive

    You'll need a USB that is at least the size of the ISO image. It will most likely need to be completely toasted, so make sure you have a backup of whatever is on there already. Don't expect to be able to use the remaining space for other purposes (more on this later).

    1. Plug the drive into your computer.
    2. Go to My Computer, right-click on the aforementioned USB drive (make sure this is the right drive!) and click Format.
    3. For the File System option, select FAT32 (this will most likely not be the default option). Then type in a volume label if you want, and click Start.

    Load the image on to the drive

    Now that the drive is ready, you will need to build and download your SuSE Studio machine in Live CD/DVD format if you haven't already. You will also need to download a tool to crack open the ISO image file if you don't have one already. Some recommendations are:

    • Virtual Clone Drive lets you 'mount' the ISO file as a CD drive, so you interact with it as if you had burnt that ISO image on to a disc. This is probably the easiest option; and it is a useful tool anyway.
    • WinImage or PeaZip lets you open ISO files as if they were ZIP files so you can extract files from them, but it doesn't let the image pretend to be an actual disc inserted into the system.

    If you're using Linux, you can simply mount the ISO file using the mount command.

    Once you have one of those tools (or something else), copy everything in the ISO image file on to the USB drive. There should be a boot directory, and two other files, config.isoclient and one named after your machine name and version.

    Let the trickery begin

    1. Download SYSLINUX 3.86. Don't download the 4.x versions, because the graphical boot menu that OpenSuSE doesn't work with it.
    2. Once downloaded, open the ZIP file and copy win32\syslinux.exe to the root of your USB drive (linux\syslinux for Linux users).
    3. On your USB drive, go to boot\i386\loader. (Amend accordingly if using 64-bit).
    4. Rename isolinux.cfg to syslinux.cfg.
    5. Open up syslinux.cfg in a decent text editor (i.e. one that understands Unix files - if it is all one big mess, try Notepad++).
    6. The file is split into a number of sections - the header (all the lines before the first 'label' line, then each line starting with 'label' denotes a new section. Find the 'append' lines for each section except the header and the Failsafe section, and add the following parameter to the end -
      cdinst=1
      For example,
      append initrd=initrd ramdisk_size=512000 ramdisk_blocksize=4096 splash=silent showopts cdinst=1
    7. Save the file.
    8. Go back to the root of your USB drive. Create a directory named 'etc' (without quotes).
    9. Inside the etc directory, create a file named 'ImageVersion' (without quotes). Make sure it is named exactly that (it is case-sensitive), and has no file extension. It should not contain anything. This is simply a marker file so the OpenSuSE scripts think this is a live image and will boot accordingly.
    10. Finally, you need to make this drive bootable by initializing SYSLINUX. Go to Start -> All Programs -> Accessories -> Command Prompt. Right-click on this, and select 'Run as administrator'. (Just click on it if you're using Windows XP.)
    11. Change the current drive to the USB drive, so if the USB drive was H drive, type -
      H:
      and press ENTER.
    12. Now type the following and press ENTER to initialize SYSLINUX on the USB drive.
      syslinux.exe -fma -d /boot/i386/loader H:
      Amended /boot/i386/loader if you're using 64-bit, and change H: to whatever your USB drive letter is. It won't say anything, but it needs a few seconds to do its work. When the light on your USB drive stops flashing, it should be done.

    Cross your fingers and reboot

    That should be it - reboot your computer, making sure that you tell your BIOS to boot from the USB drive first (usually F12 on Lenovo computers, F9 on HP computers).

    If it works, congratulations - you're done.

    If it doesn't, read on.

    'Boot error' message appears

    This usually occurs because you changed things on the USB drive after you initialized SYSLINUX. It may also occur seemingly randomly, as Windows sometimes does what it thinks are harmless operations on the drive, which end up breaking SYSLINUX. This why it isn't recommended to use this drive to store other files. To fix this situation, simply re-run steps 7-9 from the Let the trickery begin section above.

    'No DEFAULT or UI configuration directive found!' message appears

    This message seems to be referring to an error in the configuration file syslinux.cfg, but in fact can appear when SYSLINUX can't find the file for whatever reason.

    In our case, it seems to happen because it can't find the configuration file located in boot\i386\loader even though this is officially supported. SYSLINUX 4.0 seems to be more resilient and reliable (maybe because the file system code was re-written), but unfortunately we can't use it with OpenSuSE's graphical boot. So the other option is to copy the contents of boot\i386\loader to the root of the USB drive, then reinitialize SYSLINUX. It makes things a bit messier, but SYSLINUX 3.86 seems to be happier. 

    You can still use steps 10-12 above to initialize SYSLINUX even though the location has moved - when SYSLINUX is told /boot/i386/loader, it actually tries /boot/i386/loader/syslinux.cfg, /boot/i386/syslinux.cfg, /boot/syslinux.cfg, and finally /syslinux.cfg, in that order.

    'No devices matches MBR identifier: 0x01fe4d2 !' message appears (or some other hex code)

    This message means the cdinst=1 boot parameter is missing from the boot line. Check steps 5-7 in the instructions above.

    I need to update my image

    When updating your image (i.e. you re-built the image on SuSE Studio for whatever reason), you don't need to format the USB drive again. Just delete everything on it, then start at the Load the image on to the drive section.

    Final notes

    This should also work for the official OpenSuSE Live CD/DVD images because they presumably use the same booting process; I haven't tested this though. 

    The procedure here should also work for memory cards - that's what I used, and because the SD card sits flush in my ThinkPad, I have access to a full-featured Linux machine without having to install anything on to the hard drive or have anything sticking out of some port.

    Sidenote - my wireless or ethernet is connected but doesn't seem to be able to send anything

    I encountered an issue where my wireless connection had an IP address and the DNS and gateway settings were all set up properly, but nothing was going in or out - no pings, no DNS lookups, no direct IP address connections, nothing. This turned out to be IPv6 interfering and also probably because it isn't configured properly (actually not at all) on my network. OpenSuSE now enables IPv6 support in the kernel by default, therefore to switch it off, it is necessary to use the following boot parameter -

    ipv6.disable=1
     

    Changelog

    1.

    Added warning that this procedure will not work if the system used to boot the image has an optical drive installed or attached. Thanks Hakan for pointing this out.

    13th February 2011 5:21 PM
     
    2.

    Added UPDATE indicating that this trick does not work with OpenSuSE 12.1.

    10th March 2012 10:45 PM
     
    3.

    Modified instructions to include the cdinst=1 boot parameter which is required for later revisions of OpenSuSE 11.4. It shouldn't have any effect on revisions that don't require that parameter. Also added some notes on disabling IPv6.

    18th March 2012 9:04 AM
     
    4.

    Added link to the new workaround for OpenSuSE 12.x.

    20th July 2013 8:57 PM
     

Comments

1.

I have done everything you wrote but it errors

"Couldnt find live image configuration file"

I have used susestudio customized 64 bit live iso and extracted to usb with 7zip

Posted by Hakan Erdemir, 13th February 2011 7:16 AM
 
2.

 

@Hakan:

Just managed to reproduce that error on my system. Turns out the trick I used above only works if the system does not have an optical drive installed/attached. Thanks for letting me know; I have updated the article accordingly.

Posted by [edgylogic] sam, 13th February 2011 5:16 PM
 
3.

I'm a little late to the party, but I notice the page has been updated recently. I've had great luck making USB sticks bootable with just the Studio CD images using this tool: https://github.com/cyberorg/live-fat-stick

Posted by bob, 8th March 2014 3:49 AM
 

Leave a comment