/build/static/layout/Breadcrumb_cap_w.png

K2000 KBE Manipulator and Clonezilla

K2000 KBE Manipulator and Clonezilla

I am new to working with Kace environments but I am working in an organization that had established using a K2000 for their deployment of Windows and Mac systems. They recently decided to go with Ubuntu for several systems and wanted to be able to deploy using the K2000 boot environments. I found the KBE manipulator and tested but Clonezilla failed to finish booting. I am also new to Linux but muddled my way to a solution. Might be other more elegant ways but since I did not see any other ways to get it working here so I thought it was worth sharing.

As I said I am new to Linux so forgive any errors in my descriptions.   Clonezilla would begin to boot once in the Kace boot environment, but would fail in the middle looking for drivers. It took investigating how the boot process functioned before it was clear why. The boot process works in 3 steps. First is the Syslinux boot loader which loads the initrd.img that acts kind of like an intermediate filesystem. Initrd.dmg loads the initrmfs filesystem and then scripts run to find all the necessary components before it loads the final linux filesystem from a squashfs file. The problem was when it went looking for the squashfs file. Typically Clonezilla live (and Debian live) will look for available block storage devices for a /live directory (unless another path is specified in the syslinux.cfg file). It will mount the appropriate storage device and away it goes. But since it is only looking for physical storage it checks the CD drive (sr0) or the hard drive (sda) but it does not see the storage it booted from since it is not a storage device accessible once the initrd is loaded to RAM so it had no way to see the squashfs file. Typical linux pxe boot environments suggest you use a tftp server hosting the file and use the fetch command in the syslinux.cfg in order to get it and load it to RAM. This worked, but we are looking forKace to distribute this across multiple locations and it did not make sense to map a static IP for our TFTP server when we want the squashfs to load locally.

So we needed a solution for the entire filesystem to be contained on the ISO we would load into the Kace boot environment. The path I took to accomplish this was to extract the files in from the initrd.img image file and then include the filesystem and necessary changes to recognize it, without changing too much. I wanted to leave the boot processes and scripts intact so as not to affect Clonezilla from working differently as well as to do it simply without diving into changing scripts or areas of Linux with which I am not yet familiar. So I decided to create a disk image that could be mounted and act like it was a physical device that the scripts used in the initrmfs system would recognize. The steps to do this are below.   I believe further modifications of scripts and systems will allow us to run other Linux systems for other tasks as well.   


Extract files from Clonezilla ISO to a folder   We will extract files from the iso and get rid of what we don't need and customize the syslinux.cfg. I used 7-ZIP to extract.

  1. Right click iso file and click '7-zip' and then click 'Extract to "nameofisofile\"
  2. Navigate to the new folder with the name of your iso
  3. For clonezilla the boot information for the iso is the file isolinux\isolinux.bin
  4. Move the isolinux.bin to the syslinux directory
  5. delete the isolinux directory since we won't need it for our config.
  6. move the live\initrd and the live\filesystem.squashfs out to the desktop so we can use them in the next process on a linux computer.
  7. delete all files from the syslinux folder except leave the vmlinuz only
  8. customize the syslinux.cfg to include the parameters bootfrom=/dev/loop0 toram=filesystem.squashfs
  9. Customize any other syslinux options to boot and automate clonezilla

Extract and prepare initrd.img

You will need a linux computer to do the following commands. You may also need some utilities used to compress and extract. I used a Ubuntu 11.10 system and the command line utilities I used were included. We are also assuming you have the initrd.img file and the filesystem.squashfs files extracted from the iso and copied to the /temp directory for the commands.   Now we will extract the initrd.img file. It is compressed and a CPIO archive so I had to do two differenct commands.  

xzcat initrd.img > initrd
mkdir content
cd content
cpio -id < ../initrd

  Now you can add or change any files needed. I am adding an ISO that contains the filesystem.squashfs and some changes to the scripts to add the setup and association of the loop0 device.  

sudo nano /tmp/content/scripts/live-premount/ORDER

  This file tells what scripts to run. We will write a simple script and this will point at ours first. We will add the top two lines and this is what it will look like below.  

/scripts/live-premount/create-loop0
[ -e /conf/param.conf ] && . /conf/param.conf
/scripts/live-premount/select_eth_device
[ -e /conf/param.conf ] && . /conf/param.conf
/scripts/live-premount/readonly
[ -e /conf/param.conf ] && . /conf/param.conf
/scripts/live-premount/modules
[ -e /conf/param.conf ] && . /conf/param.conf

  Now we will exit out (ctrl x and then y and enter to save) and create our script  

sudo nano /tmp/content/scripts/live-premount/create-loop0

  Below is the script content

#!/bin/sh
#script to mount a loop device in place of the physical devices when looking
#for the filesystem
mknod /dev/loop0 b 7 0
losetup /dev/loop0 /fs.iso

  Now we will exit out (ctrl x and then y and enter to save) and make the script executable.  

sudo chmod +x /tmp/content/scripts/live-premount/create-loop0

Unsquashing and squashing

Any changes needed to the final boot environment in clonezilla (imaging, postimaging scripts), must be done to the filesystem.squashfs file. There is a process to "unsquash" make all necessary changes and then "makesquash".  This makes any quick changes to the script a bit tedious but we could script this creation process as well if we are making changes often.

  1. Sudo unsquashfs filesystem.squashfs
  2. make changes to /tmp/squashfs-root/
  3. sudo mksquashfs squashfs-root filesystem.squashfs.new

Now we will create the directories and the ISO to include the filesystem.squashfs  

cd /tmp
mkdir fs
mkdir fs/live
mv /tmp/filesystem.squashfs /tmp/fs/live/filesystem.squashfs
mkisofs -J -r -o fs.iso fs
cp /tmp/fs.iso /tmp/content/fs.iso

  Recreate initrd.img   Now it is time to recreate our CPIO archive and recompress. Make sure you are still in the /tmp/content directory as the paths in the commands are relative.  

find ./ | cpio -H newc -o > /tmp/new-initrd.cpio
cd ..
xz -c --check=crc32 new-initrd.cpio > new-initrd.img

  Add initrd.img file and create new bootable ISO file     Back on the windows 7 computer I used imgburn to complete our iso creation process.

  1. Copy your new-initrd.img file into the folder you have been customizing for your new ISO in the \live directory and rename it initrd.img
  2. Finish any other customizations within the folder and the syslinux.cfg
  3. Open ImgBurn and on the main menu pick 'create image file from files/folders'
  4. Use the folder with the magnifying glass icon to browse and pick your source folder. This is the folder we have been customizing.
  5. Click the 'Advanced' tab and choose 'Bootable Disc'
  6. Check the box for 'Make Image Bootable'
  7. Next to 'Boot Image:' Click the folder with the magnifying glass icon to browse to your boot image file. (This should be isolinux.bin that we moved to the syslinux folder.) and check the box 'Patch Boot Information Table'
  8. Under Destination click the folder icon and pick a destination folder and name
  9. now click the picture that shows folder > disk image and click yes when asking if it is your root folder and yes to accept the default iso labels. Then Click OK and you should get an 'Operation Successfully Completed' message.
  10. Now test your ISO image. And use KBE Manipulator to use this iso to create the custom boot environment.

 

To make changes to your new initrd.img and filesystem.squashfs

Commands would be like so. (assumes initrd.img is in the /tmp folder)

Commands to uncompress squash and initrd

xzcat /tmp/initrd.img > /tmp/initrd
mkdir /tmp/content
cd /tmp/content
cpio -id < ../initrd
sudo mount /tmp/content/fs.iso /mnt
cp /mnt/live/filesystem.squashfs /tmp/filesystem.squashfs
sudo umount /mnt
cd /tmp
sudo unsquashfs /tmp/filesystem.squashfs

  Make Changes to any scripts or files in /tmp/squashfs-root/   Commands to re compress squash and initrd

cd /tmp
sudo mksquashfs /tmp/squashfs-root /tmp/filesystem.squashfs.new
sudo rm -rf /tmp/squashfs-root
sudo rm -rf /tmp/filesystem.squashfs
sudo mv /tmp/filesystem.squashfs.new /tmp/filesystem.squashfs
mkdir /tmp/fs
mkdir /tmp/fs/live
sudo mv /tmp/filesystem.squashfs /tmp/fs/live/filesystem.squashfs
mkisofs -J -r -o /tmp/fs.iso /tmp/fs
sudo rm -rf /tmp/content/fs.iso
cp /tmp/fs.iso /tmp/content/fs.iso
cd /tmp/content
find ./ | cpio -H newc -o > /tmp/new-initrd.cpio
cd ..
xz -c --check=crc32 /tmp/new-initrd.cpio > /tmp/new-initrd.img
sudo rm -rf /tmp/content /tmp/fs.iso /tmp/filesystem.squashfs /tmp/initrd /tmp/new-initrd.cpio /tmp/fs /tmp/initrd.img
sudo mv /tmp/new-initrd.img /tmp/initrd.img

  Copy initrd.img and replace in the live folder use imgburn to create iso Create your KBE again with KBE Manipulator  


Comments

  • This worked for me. It took 2 tries because I found that I skipped a step the 1st time. - flip1001 11 years ago
    • Hello,
      please I have to do this too
      I need to deploy by K2000 my double boot image /Windows/Ubuntu
      Can you send une Iso KBE Clonezila for me to test ?
      Regards - ENPCAssistance 7 years ago
    • Hello
      the KBE clonezilla works for you ?
      I would like so much to use that KBE,
      can you send it for me ?
      thank - ENPCAssistance 6 years ago
  • It would be wonderful if you could upload the modified ISO somewhere. I've tried this twice and couldn't get it working. Third try will have to be after the weekend. =\ - lan.pham 11 years ago
  • Question regarding the unsquashing section can you help - GRRMichigan 10 years ago
  • Anyone else get this to work? No comments in a while. I would really like to get this working on a live Ubuntu distro. - Atomic83 10 years ago
  • hi sorry i need help can you read and answer my question i don't know what can i do. help please! - FREDDY 10 years ago
  • Hi. anyone have a working K2000 clonezilla KBE? I've tried several times to use this article as a guide, using Ubuntu 16.04 and latest Clonezilla (yakkety), but with new version of Clonezilla, there are variations to directory structure, I keep getting "unable to find /root in /etc/fstab, error" when trying to boot. Anyone have a working pkg available that I can import and try? Greatly appreciated, thank you. - Chief 7 years ago
  • Just an update to my progress, i was updating the ORDER file in the wrong section. I was editing the file in local-premount instead of init-premount. The KBE has gone further into the boot, but at the moment stuck in a loop with:
    "Unable to find /dev/sda"
    "Unable to find /dev/sdb"
    A work in progress, not sure if I can come out on top :( . We'll see. - Chief 7 years ago
    • you dont need to do all this process anymore on the recent versions of clonezilla. You just need to put the filesystem.squashfs on an http server, edit the boot menu entry on the live cd to download this file from the server and it will work. - eduardo.caron 7 years ago
This post is locked

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ