How to Edit Linux iso DVD CD Image

By | July 7, 2011

Its been quite a while since I updated this blog. So, I just dropped by to post an article that might really help few people out there who are struggling to edit their copy of DVD or CD iso linux image. I should say, this article is my first contribution for the opensource community. Drop me some comments if you really like my work.

Now, let’s get into the business. If you are here, then you must be looking for a way to edit your linux iso cd or dvd image. Editing in the sense, adding or removing packages to your linux image. I have personally edited debian lenny and this process should probably work on ubuntu too. If you are about to edit any other distribution, then the follow the “FLOW” which is right below the “PROCESS” to get things done in your distribution. Now, let’s check out the “PROCESS”.


Make sure to install “bsdtar” and “mkisofs” packages before you start anything.

apt-get install bsdtar mkisofs

1: Make a directory where you want to extract the original debian iso.

mkdir createiso

2: Extract the iso like this… Replace “debian.iso” with your iso file.

bsdtar -C createiso -xf debian.iso

3: Add or remove the packages in the pool/main directory. If you add packages, then you should make an entry to md5sum.txt. You also have to re-create the iso-repository which is in (dists/lenny/main/binary-amd64/ for amd64 bit os and dists/lenny/main/binary-i368/ for the 32 bit iso).

If you add a package pool/main/s/sample/sample.deb then you should create the repository entry. I imagine that you are in the “createiso” directory we initially created. So, here is how we create repository entry.

dpkg-scanpackages pool/main/s/sample /dev/null | gzip > Packages.gz

Extract “Packages.gz” to get “Packages”. Copy the text in Packages file and add it to dists/lenny/main/binary-amd64/Packages file. You will have to recreate dists/lenny/main/binary-amd64/Packages.gz file based on the changed package. Don’t forget to remove the extracted “Packages” file. You might getinto trouble if you forget removing it.

4: Once you re-create the repository files, then the MD5SUM of Packages.gz and Packages files in the directory “dists/lenny/main/binary-amd64/” changes. So you have to edit the file dists/lenny/Release and modify the md5sum and size of all the edited files (dists/lenny/main/binary-amd64/Packages, dists/lenny/main/binary-amd64/Packages.gz). Also make sure to change the md5sum of (dists/lenny/main/binary-amd64/Packages, dists/lenny/main/binary-amd64/Packages.gz, dists/lenny/Release) in the md5sum.txt in the createiso directory.

5: Don’t remove any packages from (createiso directory that we created initially), if you do then you might getinto some package installation problems.

6: If you decide to remove any packages, then make sure you don’t touch any packages that are mentioned in this file (dists/lenny/main/debian-installer/binary-amd64/Packages). These are critical debian-installer files. Removing packages is certainly not advised.

7: Once you make all the changes you wanted, then getout of createiso directory and run the following command. I imagine that you are in a directory where you could see “createiso” directory which we initially created to create a new iso image. Replace “debian-new.iso” with the name of newly generated iso.

mkisofs -o debian-new.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/ ./createiso

8: You can test your package using virtual box or vmware.


1: Extract your iso image.

2: Look for the place where you can add or remove packages. This is typically done from ( pool/main ) in the extracted debian iso image.

3: Once you add the packages, make sure to edit the md5sum.txt file where you should add or remove md5sum of the package along with the location of the package. Make sure to add the packages in sorted order.

4: Recreate the repository of the for the iso image (Packages.gz and Packages files). (This is a vital step). Make changes to the md5sum of the newly created files in the Release file.

5: Recreate the iso and boot it.

If you like this article, then please consider sharing it. Sharing really inspires us to do things much better!!

4 thoughts on “How to Edit Linux iso DVD CD Image

  1. william

    Instruction to merge:
    1. Download 3 cd’s of debian
    2. Extract the first cd in a folder
    3. Extract the packages of the other cd’s in folder pool of the first cd
    4. Use the steps show in this page to create a iso
    5. (Optional) Use unetbootin to create a usb installer

    enjoy 😀

    1. Vamsi M Post author

      Hey william, thanks for taking some time to put this write up. I wish your work helps some people out there.


Leave a Reply

Your email address will not be published. Required fields are marked *