LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Making a LiveCD of my Debian Wheezy installation (https://www.linuxquestions.org/questions/linux-general-1/making-a-livecd-of-my-debian-wheezy-installation-944708/)

edbarx 05-13-2012 06:16 AM

Making a LiveCD of my Debian Wheezy installation
 
Is it possible to create a live CD of my Wheezy installation but without having to redownload all the packages?

I have been trying to find a command parameter for live-build which prevents the script from downloading all the packages: I only want a live image of my existing filesystem. However, because CDs/DVs are readonly, I have to change some configuration files before actually burning the iso onto a DVD. For sure I will need to edit the fstab file but I have no idea whether that would be enough.

TobiSGD 05-13-2012 06:25 AM

Normally live-build should make the changes that are needed for running the system as live-system.
The option are searching is for the config step:
Code:

--bootstrap copy
More info here: http://forums.debian.net/viewtopic.php?f=16&t=38870

edbarx 05-13-2012 01:38 PM

Thanks for your accurate and prompt reply.

The first attempt failed while attempting to read the filesystem (df). However, a second attempt seems to have worked but I still am without an iso!

Code:

[...]
P: Begin install linux-image...
cp: cannot stat `chroot/boot/vmlinuz-*': No such file or directory
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists... Done
Building dependency tree     
Reading state information... Done

These are the files under work/binary/live:
Code:

/home/edbarx/work/binary/live# ls -l
total 82160
-rw-r--r-- 1 root root    3524 May 13 20:37 filesystem.packages
-rw-r--r-- 1 root root      262 May 13 20:37 filesystem.packages-remove
-rw-r--r-- 1 root root 84119552 May 13 20:35 filesystem.squashfs

The third file is the compressed live filesystem. Apparently, this error was fatal:
Code:

P: Begin install linux-image...
cp: cannot stat `chroot/boot/vmlinuz-*': No such file or directory

I checked the chroot directory for an installed kernel but there are none!
Code:

work/chroot/boot# ls -l
total 0

How can I install a kernel manually so that the procedure would be able to provide an iso?


Any ideas as to how to circumvent?

edbarx 05-13-2012 02:19 PM

I chrooted to the chroot directory and manually installed a kernel there. After that, I issued these commands as shown:
Code:

work# /usr/share/live/build/scripts/build/lb_config --bootstrap copy
P: Considering defaults defined in /etc/live/build.conf
P: Updating config tree for a debian/amd64 system
root@edbarx-pc2:/home/edbarx/work# /usr/share/live/build/scripts/build/lb_build

And finally, the iso was created!
Code:

work# ls -l
total 98648
drwxr-xr-x  4 root root      4096 May 13 20:29 auto
drwxr-xr-x  6 root root      4096 May 13 21:15 binary
-rw-r--r--  1 root root 101711872 May 13 21:15 binary-hybrid.iso
-rw-r--r--  1 root root      1983 May 13 21:15 binary.list
-rw-r--r--  1 root root      3524 May 13 20:37 binary.packages
drwxr-xr-x  6 root root      4096 May 13 21:12 cache
drwxr-xr-x 22 root root      4096 May 13 21:15 chroot
-rw-r--r--  1 root root      3619 May 13 21:12 chroot.packages.install
-rw-r--r--  1 root root      3619 May 13 21:12 chroot.packages.live
drwxr-xr-x 21 root root      4096 May 13 20:29 config


edbarx 05-13-2012 02:31 PM

Although the iso was created, its size, ~100 MB is ridiculously small. Something must have gone very wrong! :( Hopefully, I didn't bork my system when I was fiddling with chroot installing a kernel.

TobiSGD 05-13-2012 02:40 PM

I am somewhat surprised about the order of the steps you have done:
1. the config stage usually happens only once, no need to launch it again.
2. When you want to chroot into the live system it is better to use the option that enbles you to chroot into the system when just before the squashfs and the iso are built, or to use the include directories to copy stuff to the system.
3. A live system usually needs no kernel, but only kernel modules in the squashfs. The kernel is started by the bootloader directly from the CD.

edbarx 05-13-2012 03:48 PM

I tried for a second time with a default configuration. The result is a failure to produce a .iso file! It seems Wheezy does not want me to have it portable.

This is the response of rerunning lb build:
Code:

work# lb build
[2012-05-13 23:01:56] lb_build
W: No config/ directory; using defaults for all options
[2012-05-13 23:01:56] lb_bootstrap
P: Setting up cleanup function
[2012-05-13 23:01:56] lb_bootstrap_cache restore
P: Restoring bootstrap stage from cache...
W: skipping bootstrap_cache.restore, already done
[2012-05-13 23:01:56] lb_bootstrap_copy
[2012-05-13 23:01:56] lb_bootstrap_cdebootstrap
[2012-05-13 23:01:56] lb_bootstrap_debootstrap
P: Begin bootstrapping system...
[2012-05-13 23:01:56] lb_testroot
W: skipping bootstrap, already done
[2012-05-13 23:01:56] lb_bootstrap_cache save
P: Saving bootstrap stage to cache...
W: skipping bootstrap_cache.save, already done
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists... Done
Building dependency tree... Done
[2012-05-13 23:01:57] lb_chroot
P: Setting up cleanup function
[2012-05-13 23:01:57] lb_chroot_cache restore
[2012-05-13 23:01:57] lb_chroot_devpts install
[2012-05-13 23:01:57] lb_testroot
P: Begin mounting /dev/pts...
[2012-05-13 23:01:57] lb_chroot_proc install
[2012-05-13 23:01:57] lb_testroot
P: Begin mounting /proc...
[2012-05-13 23:01:57] lb_chroot_selinuxfs install
[2012-05-13 23:01:57] lb_testroot
[2012-05-13 23:01:58] lb_chroot_sysfs install
[2012-05-13 23:01:58] lb_testroot
P: Begin mounting /sys...
[2012-05-13 23:01:58] lb_chroot_debianchroot install
P: Configuring file /etc/debian_chroot
W: skipping chroot_debianchroot, already done
[2012-05-13 23:01:58] lb_chroot_dpkg install
P: Configuring file /sbin/start-stop-daemon
W: skipping chroot_dpkg, already done
[2012-05-13 23:01:58] lb_chroot_tmpfs install
[2012-05-13 23:01:58] lb_chroot_sysv-rc install
P: Configuring file /usr/sbin/policy-rc.d
W: skipping chroot_sysv-rc, already done
[2012-05-13 23:01:58] lb_chroot_upstart install
P: Configuring file /sbin/initctl
W: skipping chroot_upstart, already done
[2012-05-13 23:01:58] lb_chroot_hosts install
P: Configuring file /etc/hosts
W: skipping chroot_hosts, already done
[2012-05-13 23:01:59] lb_chroot_resolv install
P: Configuring file /etc/resolv.conf
W: skipping chroot_resolv, already done
[2012-05-13 23:01:59] lb_chroot_hostname install
P: Configuring file /etc/hostname
W: skipping chroot_hostname, already done
[2012-05-13 23:01:59] lb_chroot_apt install
P: Configuring file /etc/apt/apt.conf
W: skipping chroot_apt, already done
[2012-05-13 23:01:59] lb_chroot_archives chroot install
P: Configuring file /etc/apt/sources.list
W: skipping chroot_archives, already done
[2012-05-13 23:01:59] lb_chroot_linux-image
W: skipping chroot_linux-image, already done
[2012-05-13 23:01:59] lb_chroot_preseed
P: Begin executing local preseeds...
W: skipping chroot_preseed, already done
[2012-05-13 23:01:59] lb_chroot_package-lists install
P: Begin queueing installation of package lists (install pass)...
W: skipping chroot_package-lists.install, already done
[2012-05-13 23:01:59] lb_chroot_install-packages install
P: Begin installing packages (install pass)...
[2012-05-13 23:02:00] lb_chroot_task-lists install
P: Begin installation of task lists (install pass)...
[2012-05-13 23:02:00] lb_chroot_package-lists live
P: Begin queueing installation of package lists (live pass)...
W: skipping chroot_package-lists.live, already done
[2012-05-13 23:02:00] lb_chroot_install-packages live
P: Begin installing packages (live pass)...
[2012-05-13 23:02:00] lb_chroot_task-lists live
P: Begin installation of task lists (live pass)...
[2012-05-13 23:02:00] lb_chroot_live-packages
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package auto
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists... Done
Building dependency tree... Done
work#

It is weird because without an iso it is impossible to make a LiveCD.

Post Scriptum:
Since this time I used the default settings, I am concluding the failure to create an iso is due to the error:
Code:

Building dependency tree... Done
E: Unable to locate package auto

In my previous posts, I said that I manually installed the kernel. I did this step because lb_build complained that there were no kernels installed in chroot/boot. Although, I knew kernels were not included in the compressed file system on live cds, I followed the intuition offered by that error. Moreover, the lb_build script appeared to behave inconsistently forcing me to try several 'bizarre' solutions.

Post Scriptum II:
Since I have a functioning Wheezy installation, is it possible that I use squashfs to compress it into an archive and create a Live CD from it? The problem is that I have no idea which configuration files I have to edit. Does it make sense to boot the compressed fs as read only to avoid the OS attempting to write to convfiguration files?

Thanks for trying to guide me.


All times are GMT -5. The time now is 05:33 AM.