Remastering script

From MEPIS Documentation Wiki

Revision as of 23:27, 20 August 2013 by Kmathern (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This script has been written by MEPIS users to make it easier to remaster the CD, please see remastering article for more details, please improve the script and add suggestion in the discussion page.



  1. creates your remastering environment
  2. mounts the CD/ISO and squashfs
  3. logs in to chroot, the remastering environment, where you can customize the image, run updates, remove programs that you don't need, add new programs, etc.
  4. has a -b or --build-iso option (as in: sh -b) to skip creating the remastering environment and go straight into rebuilding the iso
  5. has a -c or --chroot option (as in: sh -c) to skip creating the remastering environment and log in directly to chroot
  6. has a -d or --from-hdd option for remastering from hard disk (this is an experimental feature, use it with caution), there are two options in this mode:
    1. create a "generic ISO" (you'll lose your accounts and passwords, you will have to use demo/demo and root/root as from the normal Live CD)
    2. create a "custom ISO", not working yet is a work in progress, when is done you should be able to log in using your own account and password from the HDD, for now this works only in CLI, and /home is not preserved.
  7. has in-built "version" file editing
  8. does basic clean-up: removes .bash_history and the content of /var/lib/apt/lists/
  9. creates the ISO file after you exit from chroot


Because of SquashFS changes you probably won't be able to remaster MEPIS 8 from within MEPIS 7 and the other way round.

Remastering is a resource intensive operations, you need to take into consideration that these operations will tie down your computer for some time, don't run the script if you have other things going at the same time (especially if you burn CDs or DVDs.)

Run X-based (GUI) programs in chroot

Disclaimer: This process seems to work only if the drivers are present in the chroot remaster project for your particular video card. If you run proprietary drivers like Nvidia or ATI that has been installed through smxi or via the Mepis Assistants, it may be better to make a copy of the xorg.conf created by the SimplyMEPIS Live-CD and keep it on file for this very purpose. As a further recommendation, it may be beneficial to boot the Live-CD with the simplest driver like vesa and copy the xorg.conf from that for use with this process.

Type this in console as normal user (not in chroot) before starting:

DISPLAY=:0.0 xhost +

After you are in your chroot, open another terminal and enter:

kwrite /etc/X11/xorg.conf

Then in the first terminal:

nano /etc/X11/xorg.conf (this file will be blank)

Copy the first (your machines xorg.conf) into the second (your chroot's xorg.conf) and save it, then run:

startx -- :1

Your chroot's gui should be on Ctrl+Alt+F8 and your original on Ctrl+Alt+F7, delete the xorg.conf when you are done.

Alternative way to run GUI programs

Once you are in the chroot environment you can run different commands in the console. However there's a little trick you need to start GUI programs:

  • install xnest
apt-get install xnest
  • outside of chroot run this command in console (this should open a window)
Xnest -ac :1
  • within chroot run this command:
export DISPLAY=localhost:1

Then, when you start a command in chroot, for example "synaptic", the GUI should appear in the window opened before.

Download/clone the script from the git repository

Install git.

  • MEPIS 11.0 and newer, install git on your system through Synaptic or apt-get.
  • MEPIS 8.0 or MEPIS 8.5
add the lenny-backports repo
deb lenny-backports main contrib non-free
if using Synaptic, temporarily set 'lenny-backports' as the preferred distro, install git, reset preferred distro setting to previous setting
if using the command line, run (as root) 'apt-get install git/lenny-backports'

Git clone the remastering-script.

(the commands below will create a new remastering-script folder in the current directory that will contain the remastering script)
  • For MEPIS 11.0 and newer copy&paste following command:
git clone git://
  • For MEPIS 8.5 copy&paste following command:
git clone -b 8.5 git://
  • For antiX and MEPIS 8.0 copy&paste following command:
git clone -b antiX git://

Running the Script

cd remastering-script        # change directory to the downloaded script
su                           # change to root user, enter the root password when prompted
./ filename.iso   # run script where filename.iso is the name of the ISO you want to remaster (use TAB for autocompletion)
exit                         # switch back to regular user when finished

Testing resulting ISO

You can test the resulting ISO without burning it with kvm, qemu, or VirtualBox.

Personal tools