Remastering

From MEPIS Documentation Wiki

Jump to: navigation, search

Contents


These are basic instructions to remaster a MEPIS CD with your preferred packages.

These commands are advanced and a bit complicated. So, it is recommended that you first try this remastering script, which will configure chroot remastering environment and build the ISO with minimum input from you.

MEPIS 11

This article or section is a stub. You can help Mepis Documentation Project by expanding it.

MEPIS 8.5

This article or section is a stub. You can help Mepis Documentation Project by expanding it.

MEPIS 8.0

This article or section is a stub. You can help Mepis Documentation Project by expanding it.

Remastering SimplyMEPIS 6.5 and 7.0

NOTE 1: Use these instructions for MEPIS 6.5 and newer, including antiX.
NOTE 2: See also Remastering script

$ su
# apt-get install squashfs-tools
# mkdir work
# cd work
# mkdir iso new-iso squashfs new-squashfs
# mount -o loop /dev/hdc iso
# mount -t squashfs -o loop iso/mepis/mepis squashfs
# rsync -a iso/ new-iso --exclude=iso/mepis/mepis
# cp -a squashfs/* new-squashfs/
# chroot new-squashfs
# mount -t proc proc proc
# mount -t sysfs sys sys

If you'd like to use an iso image instead of a physical disk, change the line above from mount -o loop /dev/hdc iso to

# mount -o loop -t iso9660 path-to-image iso

See the section #Other_Modifications_and_Tweaks below if you'd like to personalize your remastered CD, or to make a special DVD that resembles your own system.

# chroot new-squashfs
# mount -t proc proc proc
# mount -t sysfs sys sys

Substitute eth0 with your LAN device.

# dhclient eth0

Edit /etc/apt/sources.list to add repo's.

# apt-get update
# apt-get remove kaquarium splashy
# apt-get install vpnc wpasupplicant vim
# umount /proc
# umount /sys
# exit
# rm new-squashfs/root/.bash_history
# mksquashfs new-squashfs new-iso/mepis/mepis
# cd new-iso
# mkisofs -l -r -R -v -V "Mepis" -no-emul-boot -boot-load-size 4 -boot-info-table -b 
boot/grub/stage2_eltorito -c boot.catalog -hide-rr-moved -o ../mepis.iso . # cd ..

Hint Before you run the command to build the cd image, have a look at the version file in the root of the new-iso folder and edit it to reflect the changes you made to the image. An example is provided below.

SimplyMEPIS-CD_7.0-rel_32-remastered
Originally published and prepared by: MEPIS LLC, www.mepis.com
Remastered by forum.mepiscommunity.org user m_pav

Test the mepis.iso with a virtual machine like qemu, virtualbox or vmware to see if it boots. Example command for qemu below

# apt-get install qemu
# qemu -m 256 -cdrom mepis.iso -boot d

This can take a long time to boot, VirtualBox will be much faster if you have it installed.

Burn the mepis.iso to CD or to a DVD if you made it too big for a CD.

Remastering SimplyMEPIS 6.0

NOTE: Use these instructions for MEPIS 6.0 and newer.

$ su
# apt-get install squashfs-tools
# mkdir work
# cd work
# mkdir iso
# mount -o loop /dev/hdc iso
# mkdir squashfs
# mount -t squashfs -o loop iso/linux/linux squashfs
# mkdir new-iso
# rsync -a iso/ new-iso
# rm new-iso/linux/linux
# mkdir new-squashfs
# cp -a squashfs/* new-squashfs/
# chroot new-squashfs
# mount -t proc proc proc
# mount -t sysfs sys sys

Substitute eth0 with your LAN device.

# dhclient eth0

Edit /etc/apt/sources.list to add repo's.

# apt-get update
# apt-get remove kaquarium splashy
# apt-get install vpnc wpasupplicant vim
# umount /proc
# umount /sys
# exit
# rm new-squashfs/root/.bash_history
# mksquashfs new-squashfs new-iso/linux/linux
# cd new-iso
# mkisofs -l -r -R -v -V "Mepis" -no-emul-boot -boot-load-size 4 -boot-info-table -b 
boot/grub/stage2_eltorito -c boot.catalog -hide-rr-moved -o ../mepis.iso . # cd ..

Test the mepis.iso with qemu to see if it boots.

# apt-get install qemu
# qemu -m 256 -cdrom mepis.iso -boot d

This can take a long time to boot.

Burn the mepis.iso to CD or to a DVD if you made it too big for a CD.

Remastering SimplyMEPIS 3.4

NOTE: Use these instructions up to and including MEPIS 6 Beta 5

$ su
# mkdir work
# cd work
# mkdir iso

Substitute /dev/hdc with your cdrom device.

# mount -o loop /dev/hdc iso
# mkdir compressedfs
# modprobe cloop file=iso/linux/linux
# mount -r -t iso9660 /dev/cloop0 compressedfs
# mkdir new-iso
# rsync -a iso/ new-iso
# rm new-iso/linux/linux
# mkdir new-compressedfs
# cp -a compressedfs/* new-compressedfs/
# chroot new-compressedfs
# mount -t proc proc proc

Substitute eth0 with your LAN device.

# ifup eth0

Edit /etc/apt/sources.list to add repo's.

# apt-get update
# apt-get remove kaquarium splashy
# apt-get install vpnc wpasupplicant
# umount /proc
# exit
# rm new-compressedfs/root/.bash_history
# mkisofs -R -U -V "Mepis" -publisher "me" -hide-rr-moved -cache-inodes -no-bak -pad new-compressedfs
| nice -5 /usr/bin/create_compressed_fs - 65536 > new-iso/linux/linux

There is a warning message that can be ignored. You need enough free space in swap and memory to create the CD or DVD.

# cd new-iso
# mkisofs -l -r -R -v -V "Mepis" -no-emul-boot -boot-load-size 4 -boot-info-table -b 
boot/grub/stage2_eltorito -c boot.catalog -hide-rr-moved -o ../mepis.iso . # cd ..

Test the mepis.iso with qenu to see if it boots.

# apt-get install qemu
# qemu -m 256 -cdrom mepis.iso -boot d

This can take a long time to boot.

Burn the mepis.iso to CD or to a DVD if you made it too big for a CD.

Other Modifications and Tweaks

Put in some confirmed changes in this section. Some ideas for this section: Configuring fluxbox. Updating firewall with new defaults. Changing wallpaper. Turning on or off bootup processes by default. Using deborphan to find orphaned packages and save some space. Run apt-get clean to free some space.


How to Personalize your Remastered CD

This method involves a fair bit of doubling up of the contents of your apt cache folders and with the mounted iso images can consume quite a large amount of hard disk space during the build process, so make sure you have at least double your installed systems space available. For example, the test system I used had an installed base size of 4.1Gb, which includes about 1Gb of apt cache files. I started with 10Gb of available space and came very close to using all of it up during the hefty installation stage. The remastered LiveCD measured just under 1.2Gb when I used the options to match the installed packages on my system.

It may be possible to symlink the folders from the new-squashfs folder to the actual folders on your hard disk, but this was not tested.

Before you start, make a backup copy of your /etc/skel folder

# mkdir /etc/skel-1
# cp -a /etc/skel/* /etc/skel-1/

Compare the files and folders from the user account you want to copy with those in the /etc/skel and copy (overwrite) the files and folders in /etc/skel with the same files and folders from the user account you want to copy. If you have a different window manager like fluxbox installed, copy the .fluxbox folder the the /etc/skel folder too. Remember that you'll have to install fluxbox or any other program you want to add to the remastered disk in command line mode for it to work later on.

Make sure every repo is available and online by running apt-get update until no errors are encountered. If you have not keet the downloaded files in your apt-cache, you might like to go through the process of pre-downloading all of the files needed for the programs you like to use ahead of time for copying to the new image before you start working in command line mode. We'll show you how to copy these from your system to the live system later on. I usually do this by setting a fresh copy of MEPIS and before I start downloading anything, I make sure that synaptic will not delete any of the files I just downloaded and I check the MEPIS System Assistant to make sure that the "clear packages cache at boot" option does not have a checkmark in the box.

Ready to go? Good. Put a disk with the version of MEPIS (version 6 or later for this walk-through) you want to remaster into your optical drive and let's get started. From here on, it's all command line based, so grab a coffee and open a konsole window.

$ su
# apt-get install squashfs-tools
# mkdir work
# cd work
# mkdir iso

This next step will take a few minutes

# mount -o loop /dev/hdc iso
# mkdir squashfs
# mount -t squashfs -o loop iso/mepis/mepis squashfs
# mkdir new-iso
# rsync -a iso/ new-iso
# rm new-iso/mepis/mepis
# mkdir new-squashfs
# cp -a squashfs/* new-squashfs/

Alternatively, if you have an iso file on hard-disk, in this example on sdb5 in folder Mepis.

# mount -o loop /mnt/sdb5/Mepis/[full name of iso file] iso
# mkdir squashfs
# mount -t squashfs -o loop iso/mepis/mepis squashfs
# mkdir new-iso
# rsync -a iso/ new-iso
# rm new-iso/mepis/mepis
# mkdir new-squashfs
# cp -a squashfs/* new-squashfs/

You now have your basic MEPIS Live CD layout copied to your hard disk. The next step to personalize it is to copy certain files from your system to the correct folders in the new-squashfs folder, taking care not to try to do too much, but first you have to remove the existing files. We now copy the files you have prepped from your system to the new-squashfs folder. Note we are copying your skeleton file and all files required for apt-get including the caches it uses. If you keep your installed MEPIS systems apt cache populated and up to date, the process of installing programs to the soon to be remastered CD will take seconds instead of minutes and you can skip the apt-get update. This is especially handy if you have dial-up, limited bandwidth or a buggy connection like I have.

# rm new-squashfs/etc/skel/*
# rm new-squashfs/var/cache/apt/archives/*
# rm new-squashfs/var/lib/apt/lists/*
# rm new-squashfs/etc/apt/*
# cp -a /etc/skel/* new-squashfs/etc/skel/
# cp -a /var/cache/apt/archives/* new-squashfs/var/cache/apt/archives/
# cp -a /var/lib/apt/lists/* new-squashfs/var/lib/apt/lists/
# cp -a /etc/apt/sources.list new-squashfs/etc/apt/

Great, now you can chroot in to the new-squashfs folder and operate in CLI mode to add and remove the programs you want to

# chroot new-squashfs
# mount -t proc proc proc
# mount -t sysfs sys sys

Substitute eth0 with your LAN device. The following creates a virtual network for the chrooted environment

# dhclient eth0

You only need to run apt-get update if you did not copy an up to date sources.list, apt-list cache and apt-cache, If you want an up to date liveCD or DVD, you'll need to run the apt-get upgrade.command Removing kaquarium and splashy is not strictly necessary, but if you want to keep your finished product small enough to fit on a cd, and you want to add some stuff, you'll have to remove something.

This is the fun part. Install anything you want to, as long as it is available through the repositories and remember to clean up the apt cache when you're finished, or your iso image will be much larger than you expected, unless you really want to keep them there.

See the section below titled Installing Additional Packages to your Remastered Live CD for how to further customize your remastered CD

# apt-get update
# apt-get upgrade
# apt-get remove kaquarium splashy [alternatively use apt-get remove --purge splashy]
# apt-get install vpnc wpasupplicant vim
# apt-get clean
# umount /proc
# umount /sys
# exit
# rm new-squashfs/root/.bash_history
# rm new-squashfs/var/lib/apt/lists/*

Depending on how many packages you installed and what you achieved whilst chrooted into the new-squashfs folder, the umount /proc command may report it is busy and can not be unmounted. This has not been a problem during testing because the commands that generate the iso image ignore the mounted /proc folder. However an umnounted /proc may make the final iso size much bigger than it should be.

Prepare the re-mastered mepis file and copy it to the new-iso folder that contains the boot data

# mksquashfs new-squashfs new-iso/mepis/mepis
# cd new-iso
# mkisofs -l -r -R -v -V "Mepis" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/grub/stage2_eltorito -c boot.catalog -hide-rr-moved -o ../mepis.iso .
# cd ..

You do not have to name the iso image mepis. You might like to use something like mepis-yourname-date_or_purpose.iso Test the mepis.iso with qemu or vmware to see if it boots. With vmware, you do not have to copy the image to the folder where your virtual machine images are stored, you can create a symlink from the vmware folder to the image and that will work just fine, provided you have sufficient permissions.

# apt-get install qemu
# qemu -m 256 -cdrom mepis.iso -boot d

Installing Additional Packages to your Remastered CD

The following will add support for vmware server to MEPIS 6.5 when run during the chroot session, after the apt-get upgrade and before the apt-get clean commands. One word of caution here though, in my own testing, this has to be run on a 32-bit system if you're intending to remaster a 32-bit CD.

# apt-get install libx11-6 libx11-dev libxtst6 xlibs-dev xinetd wget
# apt-get install linux-headers-`uname -r` build-essential
# apt-get install gcc binutils-doc cpp-doc make manpages-dev autoconf automake1.9 libtool flex bison gdb gcc-doc gcc-4.0-doc libc6-dev-amd64 lib64gcc1

If you want to make a Live CD backup of your installed system (without data), the following will help you to match the installed base on the remastered LiveCD (most likely will end up a DVD) to the installed base on your own system.

# dpkg --get-selections >>list_packages.txt

Copy the list_packages.txt file to the /root folder inside your new-squashfs folder and run the following command while chrooted into the new-squashfs folder.

dpkg --set-selections <list_packages.txt>

Apt will ignore all packages already installed and install only those that are not installed.

Your Remastered CD has grown beyond 700Mb and is now a DVD

If you try to burn an image created by the method above that ends up larger than 700MB by clicking on the iso file to open K3b, it will be seen as a CD image and not a DVD, and you will not be able to burn it to a disk this way. This may be a bug or a limitation of K3b, or it may be a reflection on something missed in the remastering process above, maybe somebody more knowledgeable than I can help here?. Open K3b first, then select the Burn DVD iso Image option, point K3b to the location of your remastered image and it will burn to DVD just fine.

If you'd like to place feedback or ask any questions about this procedure, send a message to user m_pav on the MEPIS Community forum.

Personal tools