Steps to create a LiveCD - DVD - USB from scratch in Debian and its derivatives.

Starting from the need to create my own LiveCD which I can periodically update and customize to my liking, and knowing the advances in computer technologies in the field of GNU / Linux, I realized the scarce need to install extra graphic programs.

Thanks to portables I will not need to install programs of daily use for me such as Gimp, Inskape, Blender, even Libreoffice for some occasions. Without these programs installed on my system I save several mega-bits in software and libraries.

The portables for Linux can be downloaded from the following site:

http://sourceforge.net/projects/portable/files

They can even make their own portables with the following programs from the same site:
- AppDirAssistant: Utility to port the programs, it is necessary to run AppDirAssistant before installing the software to be ported; such software cannot be installed before running AppDirAssistant.
- AppImageAssistant: Utility to compress the structure in a single self-executable file the folders created by

To create portables of some software already installed you can use the following program:

For 32 bit
https://github.com/downloads/pgbovine/CDE/cde_2011-08-15_32bit

For 64 bit
https://github.com/downloads/pgbovine/CDE/cde_2011-08-15_64bit

Creating portables with this method will not look for dependencies installed in your operating system, nor will it save the configuration in your user folder unless a symbolic link is created within cde-root or the cde.options file is indicated with a line similar to this:

ignore_prefix = / home

Seeing this we will realize that we can download or create the portables we want, eliminating the need to install extra applications outside our base system, and thus reduce your space when creating our own LiveCD.

Development
As the title says, we will see how to create our own LiveCD from scratch which will allow us to install the applications we want starting by installing our base system, there are several ways to achieve this, one by means of a text mode installation without actually installing the graphic system and another using debootstrap, this last case is the one that we will address in this manual because it allows us to create our system from scratch without any extra program to the base system.

Having a GNU / Linux system, already installed we will create a partition with the desired size to install the base system on said partition, let's see step by step how to create our base system with debootstrap:

Step 1
Install debootstrap

 # apt-get install debootstrap

Step 2
Mount the new partition in / mnt

 # mount / dev / sdax / mnt

Step 3
Install the base system on that partition:

For 32 bit

 # debootstrap --arch i386 distribution / mnt

For 64 bit

 # debootstrap --arch amd64 distribution / mnt

The distribution must be changed to the name of the version of GNU / Linux that we want to install, these files are found in / usr / share / debootstrap / scriptsIf the file with the name of the distribution that they are going to use does not exist, simply copy the one of the latest version with the name of the new version and open it with a text editor and where the web address is indicated, change it to the new one , example:

It occurs to me that I download the repository from another address and not from the official page, I will / usr / share / debootstrap / scripts I copy the latest version of this, in this case I use an Ubuntu repository (Oneiric) that is in this folder but the download address is different since it is on my pc's hard drive, we open the file and change

default_mirror http://archive.ubuntu.com/ubuntu

by

default_mirror file: /// path / to / repo / ubuntu

If they find more than one line with this shape, they have to change it too.

It is important that the file inside / usr / share / debootstrap / scripts has the key name of said distribution, if it is the Debian squeeze version, it must have that name, with the correct links to the web
It is not recommended to carry out this procedure directly on a USB memory, or an external disk, since copying files to the USB port is slower, in addition to that it could damage a pendrive due to the excessive copying and extraction of packages that were carried out in said partition .

Step 4
We change the working root from the terminal with chroot and proceed to install the essential software according to our needs.
- Changing the Cage

# mount -t proc none / mnt / proc # mount -o bind / dev / mnt / dev

- Mount the external disk that contains the repository

# mkdir / mnt / media / Disk-Name # mount / dev / sdax / mnt / media / Disk-Name # chroot / mnt

- Within the same cage indicate which are the repositories to use in /etc/apt/source.list
nano /etc/apt/source.list
in my case from my pc disk

deb file: /// media / Disk-Name / Oniric-Ocelot / mirror / ubuntu / oneiric main multiverse restricted universe deb file: /// media / Disk-Name / Oniric-Ocelot / mirror / ubuntu / oneiric-backports main multiverse restricted universe deb file: /// media / Disk-Name / Oniric-Ocelot / mirror / ubuntu / oneiric-proposed main multiverse restricted universe deb file: /// media / Disk-Name / Oniric-Ocelot / mirror / ubuntu / oneiric -security main multiverse restricted universe deb file: /// media / Disk-Name / Oniric-Ocelot / mirror / ubuntu / oneiric-updates main multiverse restricted universe deb file: /// media / Disk-Name / Oniric-Ocelot / mirror / medibuntu / oneiric free non-free deb file: /// media / Disk-Name / Oniric-Ocelot / mirror / canonical / oneiric partner

If we use the traditional method from a web page and we use a proxy address, we will need to tell it to use this proxy from the same cage with the following command:

# export http_proxy = "http: // user: password@proxy.name.org: 3128" # export ftp_proxy = "http: // user: password@proxy.name.org: 3128"

Step 5

# apt-get update # apt-get upgrade # apt-get upgrade # apt-get dist-upgrade

Step 6
Install the locales (languages)

# aptitude install locales # dpkg-reconfigure locales # aptitude install localepurge # localepurge

Step 7
Install the version of the kernel that we are going to use, example:

# apt-get install GNU / Linux-image-3.0.0-14-generic depmod 3.0.0-14-generic user-setup

Step 8
Proceed to install essential software for the correct boot of the system and subsequent creation of the LiveCD.

 # apt-get install aptitude grub2 sysGNU / Linux squashfs-tools casper archdetect-deb mkisofs genisoimage xorriso console-tools console-keymaps mc blkid parted

Step 9
Create some essential configuration files

 # mcedit / etc / network / interfaces

and add this:

auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp

Edit the file:

 # mcedit / etc / hostname

and add this:
Host-name

 # mcedit / etc / hosts

and add this:
127.0.0.1 localhost Host-Name

Step 10
Create the mtab and fstab file.

# grep -v rootfs / proc / mounts> / etc / mtab # grep / etc / mtab -e "/"> / etc / fstab

Note: To avoid conflicts it is recommended to give the address to the root disk by the uuid, with the blkid command you can obtain the uuid and replace / dev / sdax in / etc / fstab inside this cage with the uuid, for example if it is

 / dev / sda1 replace by UUID = uuid thus: UUID = 476efe22-73ec-4276-915d-c4gga65f668b / ext3 errors = remount-ro 0 0

Step # 11
Install the graphical environment -Optional if you do not need to install a graphical environment.

 # apt-get install xserver-xorg-video-all xorg xserver-xorg

Step 12
Install the grub, if we do not have any grub installed in the boot sector we can do it in the following way:

In case of not having any GNU / Linux system already installed, we will proceed as follows:
We left the cage:

# exit # sudo grub-install --root-directory = / mnt / dev / sda

We return to the cage:

# chroot / mnt # update-grub

- In case of having the grub file already installed, we simply edit the file
We left the cage:

# exit # update-grub

Step 13

We install our preferred desktop environment as well as our session manager that we want. In my case, I installed the desktop environment e17 (enlightenment) together with the spacefm file explorer and thus created my own LiveCD to make backup copies, as well as I included the debootstrap program to install my new operating systems directly from the repositories without need to use other LiveCDs or text mode installations.

 # apt-get install e17 e17-data gparted mtools testdisk secure-delete partimage gzip zip unzip tar pkill xterm

You can choose the desktop environment of your preference, as well as the set of applications to use.

The session manager.

- In this case I do not need a session manager that asks me for username and password since its objective is to directly start the session, for this we create a text file in / etc / startX

# touch /etc/init.d/startX # chmod + x /etc/init.d/startX

Copy the following into this file

#! / bin / sh. / lib / lsb / init-functions PATH = / sbin: / bin: / usr / sbin: / usr / bin case $ 1 in start) echo "Starting graphical system" echo "You can check the LOG in / var / log / boot_x. log "X: 0 1 >> / var / log / boot_x.log 2 >> / var / log / boot_x.log & DISPLAY =: 0 su root -c enlightenment_start 1> / dev / null 2> / dev / null & ;; stop) echo "Stopping all X processes" pkill X ;; *) echo "Invalid option" ;; esac exit 0

To tell the system to start this file with the system we execute the following from the console.

 # update-rc.d startX defaults 99

This is to avoid having to use any window manager like lxdm, gdm among others.

We restart the PC with the new installation.

As I had indicated install spacefm for this I download the source code from this page.

http://spacefm.sourceforge.net/ (el fichero .tar.gz o .tar.xz) al disco de la maquina.

I install the dependencies of this software:

# apt-get install autotools-dev bash desktop-file-utils build-essential libc6 libcairo2 libglib2.0-0 libgtk2.0-0 libgtk2.0-bin libpango1.0-0 libx11-6 shared-mime-info intltool pkg- config libgtk2.0-dev libglib2.0-dev fakeroot libudev0 libudev-dev

We uncompact said file

 tar -xf /path/file/spacefm.tar.xz cd / path / file / spacefm ./configure # make -s # make install # update-mime-database / usr / local / share / mime> / dev / null # update-desktop-database -q # gtk-update-icon-cache -q -t -f / usr / local / share / icons / hicolor # gtk-update-icon-cache -q -t -f / usr / local / share / icons / Faenza

With this, if there was no problem we will have spacefm installed.

Step 14

Install remastersys.

Remastersys can find it on their official website http://remastersys.sourceforge.net/, but I recommend you use the one that you attached to maintain compatibility, since it does not install or uninstall any application during the LiveCD creation process, as well as leave some scripts to install the LiveCD on a usb memory.

Download remastersys and install.

 # dpkg -i /path/a/remastersys.deb
Note: Ubiquity is the graphical installer for ubuntu, but it is not necessary to install it for later installation of the LiveCD on a PC.

Step 15

Creation of the LiveCD with remastersys.

Remastersys has 2 LiveCD creation modes, one saving the configuration of all users and another removing all configuration and registration of another user, which is what we are used to seeing in traditional Ubuntu LiveCDs.

To create LiveCD saving your settings.

 # remastersys backup

- To create LiveCD without users or configurations (Recommended).

# remastersys dist cdfs # remastersys dist iso custom.iso
Note: These files will be generated in / home / remastersys, to customize the user name and others can edit the /etc/remastersys.conf file. Because the root user does not delete his password, it is advisable not to have any compromising password as the root password.

Step 16

Installation of any Debian LiveCD or derivatives made with remastersys.
First verify that your partition is marked as boatable with gparted or parted as follows:

# parted / dev / sdb set 1 boot on - To activate it # parted / dev / sdb set 1 boot off - To deactivate it
Note: The number after set corresponds to the partition number of that memory.

- We install the iso on a cd dvd, or if you wish on a usb device in the following way (All this as root):

mkdir -p / mnt / cdrom mkdir -p / mnt / usb mount -o loop / path / file.iso / mnt / cdrom mount / dev / sdbx / mnt / usb cp -r / mnt / cdrom / * / mnt / usb cp -r / mnt / cdrom / isoGNU / Linux / * / mnt / usb mv /mnt/usb/isoGNU/Linux.cfg /mnt/usb/sysGNU/Linux.cfg umount / mnt / usb umount / mnt / cdrom

# EYE look at the partition of your usb device if the partition you mounted is / dev / sdb1 the boot sector will have to be installed in / dev / sdb

# cat /usr/lib/sysGNU/Linux/mbr.bin> / dev / sdb # sysGNU / Linux --install / dev / sdb1

Step # 16.1.

First we start from the LiveCD or usb if we have it in memory.

If the required partitions such as swap (swap area) are not created, as well as a partition of more than 1 GB or more depending on the size of the livecd.

Note-Important: / dev / sdax refers to whether it is / dev / sda1 or another number, we can check this by typing blkid in the console.

Step # 16.2.

Mount the partition created in / mnt

# fsck -a / dev / sdax # mount / dev / sdax / mnt

Step 16.3.

Copy all files inside the / rofs folder to / mnt

 # cp -r / rofs / * / mnt

Note: all this as root user.

Step # 16.4.

Install grub

 # grub-install --root-directory = / mnt / dev / sda

Step # 16.5.

Prepare the system to boot the grub properly.

mount -t proc none / mnt / proc mount -o bind / dev / mnt / dev chroot / mnt update-grub

Step # 16.6.

Without leaving the chroot cage we prepare the essential files / etc / fstab and / etc / mtab

grep -v rootfs / proc / mounts> / etc / mtab grep / etc / mtab -e "/"> / etc / fstab
Note: If necessary create a new user other than root if you wish through the console with the following command:
useradd -m -c "Administrative User" -G adm, admin, sudo, dialout, cdrom, plugdev, lpadmin, sambashare -d / home / user -s / bin / bash user

Conclusions

With this, this broad but simple guide is finished, which you can put into practice if you wish and share your own livecd with your friends, the quality of all livecd / dvd relies on the user's own knowledge, the implementation of new technologies that save hard disk space.

As you saw, it is not necessary to use unetbootin to convert a LiveCD into live usb, if you use spacefm you will have everything you need in terms of a graphical application either to convert videos, audio files among others, you will only need the program that performs this from command line and create or download a plugin to perform these tasks.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

12 comments, leave yours

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   keopety said

    all that noise to create a cd? '? I think it happened from the cd

  2.   pandev92 said

    There was no website that made you a live debian cd? oO

    1.    eliotime3000 said

      How frustrating this procedure is for lazy people who easily go to live.debian.org and port it to USB.

  3.   PEPPER said

    Too complicated, on my other PC I use Remastersys in Xubuntu 13.04 and I generate my iso live cd perfectly and in 13 min, from the system already installed and customized with the programs that are of interest to me. Today, that there are only remasters to achieve this is totally reprehensible, there are others and other ways, but they are still tedious like the one described in this post.

    1.    eliotime3000 said

      Or at least, they would have made a small script in .sh and the issue solved (it could even be assisted).

  4.   manolox said

    Well, it seems to me a very good manual that when I have time I will try.
    Perhaps there are faster ways to do the same, but what you learn along the way (probably won't come the first time) is priceless.

  5.   tahed said

    It happened to me that those who do not install ubiquity are advised to install the following dependencies.

    accountsservice apt-clone btrfs-tools console-setup cryptsetup dmidecode dmraid dpkg-repack ecryptfs-utils gconf2 gconf2-common gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-gstreamer-0.10 gir1.2 .3.0-gtk-1.2 gir1.0-pango-1.2 gir2.4-soup-1.2 gir1.0-timezonemap-1.2 gir2.90-vte-1.2 gir3.0-webkit-0 indicator-application kbd keyutils language-selector- common laptop-detect libaccountsservice1 libappindicator3 libappindicator1-0 libbsd0 libcap-ng2 libcap4-bin libdbusmenu-glib3 libdbusmenu-gtk4-4 libdbusmenu-gtk0 libdebconfclient1.0.0 libdmraid16.rc0g libcrypt 3 libcrypt 0.rc1g-0g libcrypt 2 -4 libgtk-3-1 libgtk-3-bin libgtk-0-common libgtop3-3 libgtop2-common libicu7 libindicator2-44 libindicator3 libiw6 libnss6-30d libp3-kit1 libpam-gnome-keyring libstartup-notification11 libtimezonemap0-0vtevte-1 -common libwebkitgtk-2.90-9 libwebkitgtk-3.0-common libxklavier0 lsof psmisc python-appindicator python-argparse python-libxml3.0 python-pyicu python-xklavier rd ate reiserfsprogs rsync

    I know this guide can be tedious, but if I can get my own live cd with no more than 215 MB I prefer to reread this guide again.

  6.   Miguel said

    Excellent thank you very much

  7.   Notes said

    The procedure is interesting but you want to complicate your life.

    # apt-get install live-magic
    $ live-magic

    And with a few clicks you have your live CD or USB.

  8.   Frank Davila said

    Thanks for the info, does this work for any linux distro? Can the portables be put into that personalized live? Thank you.

  9.   Ricardo said

    Excellent information, I have already used remastersys before, in the same way I find the article very good and explained.

    NOTE: the remastersys download link that you have published is wrongly linked, it should say https://blog.desdelinux.net/wp-content/uploads/2013/05/remastersys.zip

    1.    elav said

      Thanks for the information .. We immediately corrected the link.