Debian User Forums Forum Index Debian User Forums
Go to Debian website
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   You have no new messagesYou have no new messages   Log out [ Bro.Tiag ]Log out [ Bro.Tiag ] 

live-helper create image and customize environment howto!
Goto page 1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    Debian User Forums Forum Index -> Docs, Howtos, Tips & Tricks
View previous topic :: View next topic  
Author Message
MeanDean



Joined: 31 Aug 2007
Posts: 1221

PostPosted: 2008-04-05 19:21    Post subject: live-helper create image and customize environment howto! Reply with quote

CREATE A LIVE IMAGE USING LIVE-HELPER

software required
live-helper - recent version

basic commands
lh_config - creates the configuration file, this is where you specify desktop, architecture, extra software, include installer, and so forth.
lh_build - command to start the build

other important commands
lh_clean --binary use this to clean things up before building another image using the same config
lh_clean use this to clean things up before building another image when the config has changed
lh_clean --purge use this to do a super-clean, this will purge all packages from the cache

some lh_config options
-p use a package list from /usr/share/live-helper/lists or specify your own file
-d specify the distribution (etch/lenny/sid)
-a specify the architecture (i386/amd64/?)
--debian-installer=businesscard include the business card installer
--debian-installer=enabled include the installer
--packages specify packages you want to include


examples
example 1 - to build a sid live image for i386 with the gnome-core predefined package list and medit
mkdir livebuild
cd livebuild
su
lh_config -d sid -a i386 -p gnome-core --packages medit
lh_build

when it is done, look in the livebuild folder for the binary.iso

example 2 - to build a lenny live image for amd64 with kde predefined package list, audacious and the debian installer
mkdir livebuild
cd livebuild
su
lh_config -d lenny -a amd64 -p kde --packages audacious --debian-installer=enabled
lh_build

when it is done, look in the livebuild folder for the binary.iso

example 3 - to build a sid live image for i386 with studio-xfce predefined package list, cowsay and the debian installer
mkdir livebuild
cd livebuild
su
lh_config -d sid -a i386 -p studio-xfce --packages cowsay --debian-installer=enabled
lh_build

when it is done, look in the livebuild folder for the binary.iso

example 4 - to build a lenny live image for i386 with myfavs package list and the debian installer
mkdir livebuild
cd livebuild
su
lh_config -d lenny -a i386 -p myfavs --debian-installer=enabled
lh_build

when it is done, look in the livebuild folder for the binary.iso


fyi
fyi - a basic GUI called live-magic is available in lenny/sid for building live images

fyi - you can also just download a prebuilt image from http://live.debian.net/cdimage/

fyi - The above method does not even scratch the surface of what you can do with live-helper. As far as I know you can configure live-helper to inject custom files, use local packages, even open a chroot shell during the build process. Using live-helper to customize the build would would probably eliminate the need to customize the ISO manually. I am not familiar with doing this but you can get more info at the debian live project homepage or the wiki

fyi - personally I build a standard base image only, then I customize it manually. That way I can reuse it with different software without having to build a new base image.

fyi - you can test the image without burning it to a disk by using qemu

fyi - The wiki and mailing list provides plenty more info...

.


Last edited by MeanDean on 2008-04-22 18:50; edited 42 times in total
Back to top
View user's profile Send private message Send e-mail  
MeanDean



Joined: 31 Aug 2007
Posts: 1221

PostPosted: 2008-04-05 19:24    Post subject: Reply with quote

CURRENTLY BEING TESTED - USE AT YOUR OWN RISK

METHODS TO CUSTOMIZE THE ISO

First, you do not have to to customize manually. The ISO you built in the previous step is perfectly usable as is. You may want to customize the ISO manually if you want to add some software, configure the environment, edit configuration files and so forth...

software required
squashfs-tools
squashfs-modules
xnest - if you are going to use xnest
qemu - if you want to use qemu to test the ISO

method 1- customize via the command line.

change to root since some of the commands require root privys
su

unpack the ISO
mkdir iso
mkdir temp
mount binary.iso -o loop temp/
cp -a temp/* iso/
umount temp/


Unpack the squash file system. This is the actual filesystem that is run when you use the livecd.
mount -t squashfs -o loop iso/live/filesystem.squashfs temp/
mkdir fs
cp -a temp/* fs/
umount temp/
rm -rf temp/


remove the old squash from the iso since we will build a new one with our changes
rm iso/live/filesystem.squashfs

copy a couple of files from our system to the extracted filesystem, if needed
cp /etc/hosts fs/etc/
cp /etc/resolv.conf fs/etc/


need to mount a few things in the extracted filesystem so the system is usable
chroot fs mount -t proc none /proc
chroot fs mount -t sysfs none /sys
chroot fs mount -t devpts none /dev/pts


change root to the extracted filesystem so we can work in it
chroot fs

export our locale thingy so we dont get irritating messages when we install software
export LC_ALL=C

You are now using the CLI in the system you want to customize.
You are root. You can su to other users if needed.
You can add/remove software, add users, set passwords, edit files, etc...

exit the chroot back to our system
exit

unmount a few things in the extracted filesystem
chroot fs umount /proc
chroot fs umount /sys
chroot fs umount /dev/pts
chroot fs rm -rf /tmp/*


remove those files we copied over and create new empty ones, if desired
rm fs/etc/resolv.conf
rm fs/etc/hosts
touch fs/etc/resolv.conf
touch fs/etc/hosts


make the new squash filesystem from the folder we have been making changes to
mksquashfs fs/ iso/live/filesystem.squashfs

make the new ISO
mkisofs -r -V "cd" -cache-inodes -J -l -o newcd.iso \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table iso/

if you copy/paste the above commands be sure not to have a space after the \

newcd.iso should be on your desktop, it is owned by root so we need to chown/chgrp it
chgrp YourUserName newcd.iso
chown YourUserName newcd.iso


you can test newcd.iso using qemu
qemu -cdrom newcd.iso

If you aren't happy with the newcd (forgot to include something or forgot to tweak something) delete newcd.iso and you can keep the work you have done so far by starting back to rm iso/live/filesystem.squashfs

otherwise remove the following folders
rm -rf fs/
rm -rf iso/


exit

All done!


method 2- customize via the command line and use a xnest session (separate graphical environment in a window) to make changes to a particular users environment or simply to check and verify your CLI tweaks.

change to root since some of the commands require root privys
su

unpack the ISO
mkdir iso
mkdir temp
mount binary.iso -o loop temp/
cp -a temp/* iso/
umount temp/


Unpack the squash file system. This is the actual filesystem that is run when you use the livecd.
mount -t squashfs -o loop iso/live/filesystem.squashfs temp/
mkdir fs
cp -a temp/* fs/
umount temp/
rm -rf temp/


remove the old squash from the iso since we will build a new one with our changes
rm iso/live/filesystem.squashfs

start a xnest (separate graphical screen inside a window) session to be used later
Xnest -ac :2 &
if :2 does not work then use a different number, just be sure to use the same number later also

copy a couple of files from our system to the extracted filesystem, if needed
cp /etc/hosts fs/etc/
cp /etc/resolv.conf fs/etc/


need to mount a few things in the extracted filesystem so the system is usable
chroot fs mount -t proc none /proc
chroot fs mount -t sysfs none /sys
chroot fs mount -t devpts none /dev/pts


change root to the extracted filesystem so we can work in it
chroot fs

export our locale thingy so we dont get irritating messages when we install software
export LC_ALL=C

You are now using the CLI in the system you want to customize.
You are root. You can su to other users if needed.
You can add/remove software, add users, set passwords, edit files, etc...

switch to the user whose environment you want to customize
*if you want to customize the root account then skip this step
su username

Now you can start the graphical environment in the xnest window.
if you have e17 installed then start it with the following command
env DISPLAY=":2" enlightenment_start &
or if you have icewm installed then start it with the following command
env DISPLAY=":2" icewm-session &
or if you have fluxbox installed then start it with the following command
env DISPLAY=":2" startfluxbox &
or if you have a environment that is very 'component-ized' then you probably need to startup the seperate components
env DISPLAY=":2" sawfish &
env DISPLAY=":2" pypanel &


You should see the environment startup in the xnest window.
Make whatever changes you wish then logout of environment.
Close the xnest window.

exit the user su
*if you are customizing the root account then skip this step
exit

exit the chroot back to our system
exit

unmount a few things in the extracted filesystem
chroot fs umount /proc
chroot fs umount /sys
chroot fs umount /dev/pts
chroot fs rm -rf /tmp/*


remove those files we copied over and create new empty ones, if desired
rm fs/etc/resolv.conf
rm fs/etc/hosts
touch fs/etc/resolv.conf
touch fs/etc/hosts


make the new squash filesystem from the folder we have been making changes to
mksquashfs fs/ iso/live/filesystem.squashfs

make the new ISO
mkisofs -r -V "cd" -cache-inodes -J -l -o newcd.iso \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table iso/

if you copy/paste the above commands be sure not to have a space after the \

newcd.iso should be on your desktop, it is owned by root so we need to chown/chgrp it
chgrp YourUserName newcd.iso
chown YourUserName newcd.iso


you can test newcd.iso using qemu
qemu -cdrom newcd.iso

If you aren't happy with the newcd (forgot to include something or forgot to tweak something) delete newcd.iso and you can keep the work you have done so far by starting back to rm iso/live/filesystem.squashfs

otherwise remove the following folders
rm -rf fs/
rm -rf iso/


exit

All done!


fyi
fyi - The file fs/etc/inittab is setup to automatically login the 'user' user when running live. Edit the file if that is not the desired behavior. You can edit inside the chroot or outside - but you need to have root privys

fyi - you can open a filemanager as root and move custom content from your system to the fs/ folder at any time

fyi - you can reuse the xnest window for other users, when you Make whatever changes you wish then logout of environment. dont close the xnest window, exit the current user su, then su username to the next user you want to configure and startup the environment again

fyi - One easy way to customize the user(s) environment using your currently installed system is to create a new user on your current system. Login as that user. Customize anything you wish. Save the config files that are created in /home/username. Now follow method 1 or 2 and sometime after you unpack the squashfs move those config files to the fs/home/username folder and that user will have those configs - be sure to have proper ownership/permissions on them. You could also put those files in /etc/skel/ and then while in the chroot create users and they will automatically inherit those config files.

fyi - you can test the image without burning it to a disk by using qemu

.


Last edited by MeanDean on 2008-04-23 09:52; edited 48 times in total
Back to top
View user's profile Send private message Send e-mail  
MeanDean



Joined: 31 Aug 2007
Posts: 1221

PostPosted: 2008-04-05 19:32    Post subject: Reply with quote

reserved for a actual walkthru of the customization process....

hopefully can create a recordmydesktop video of the process...


Last edited by MeanDean on 2008-04-22 20:34; edited 37 times in total
Back to top
View user's profile Send private message Send e-mail  
Bro.Tiag



Joined: 02 Jun 2007
Posts: 530

PostPosted: 2008-04-05 19:45    Post subject: Reply with quote Edit/Delete this post

Well I can confirm that at least the binary.iso was built in the time it tock you to make this post. Now as to whether it's bootable, I'll let ya know once my cd-rw is finished writing & I've tested it.

Cheers
Back to top
View user's profile Send private message  
Bro.Tiag



Joined: 02 Jun 2007
Posts: 530

PostPosted: 2008-04-05 19:55    Post subject: Reply with quote Edit/Delete this post

Bro.Tiag wrote:
Well I can confirm that at least the binary.iso was built in the time it tock you to make this post. Now as to whether it's bootable, I'll let ya know once my cd-rw is finished writing & I've tested it.

Cheers


You've got to be kidding! I'm back & can confirm that it does make a LiveCD that quickly. I'd like to say I'm posting from said LiveCD, but I figured the 19 sec reboot to sid would be faster then my sorting out links to post a reply.

Well done Dean, Well Done!

Cheers
Back to top
View user's profile Send private message  
MeanDean



Joined: 31 Aug 2007
Posts: 1221

PostPosted: 2008-04-05 20:46    Post subject: Reply with quote

Now that you have the basic idea, some great examples are listed here
http://wiki.debian.org/DebianLive/Examples

I test the images using qemu
qemu -cdrom binary.iso

The guy to thank is Daniel Baumann for his awesome work! live-helper is amazing IMO, as simple or as complex as you want to make it.

The debian live mailing list is a superb mailing list to subscribe to!
Back to top
View user's profile Send private message Send e-mail  
Bro.Tiag



Joined: 02 Jun 2007
Posts: 530

PostPosted: 2008-04-05 21:01    Post subject: Reply with quote Edit/Delete this post

MeanDean wrote:
Now that you have the basic idea, some great examples are listed here
http://wiki.debian.org/DebianLive/Examples

I test the images using qemu
qemu -cdrom binary.iso

The guy to thank is Daniel Baumann for his awesome work! live-helper is amazing IMO, as simple or as complex as you want to make it.

The debian live mailing list is a superb mailing list to subscribe to!


Go on dean, you did the second hardest part, reading. Thanks.

I'm working through a package list I want to include. That seems to be the long part right now. Should have a nice new LiveCD tonight, least I run out of beer.

Cheers
Back to top
View user's profile Send private message  
Bro.Tiag



Joined: 02 Jun 2007
Posts: 530

PostPosted: 2008-04-06 00:33    Post subject: Reply with quote Edit/Delete this post

Hum, things seemed to work OK. But somehow I wound up with a gnome desktop & not e17. Me thinks you tricked me. Very Happy I'll sort it out tomorrow.

Cheers
ps - this time I am posting from said LiveCD.
Back to top
View user's profile Send private message  
MeanDean



Joined: 31 Aug 2007
Posts: 1221

PostPosted: 2008-04-06 00:59    Post subject: Reply with quote

Bro.Tiag wrote:
But somehow I wound up with a gnome desktop & not e17.

too much beer?
Back to top
View user's profile Send private message Send e-mail  
Noven



Joined: 17 Mar 2007
Posts: 189

PostPosted: 2008-04-06 01:38    Post subject: Reply with quote

How would I make a Lenny livecd with openbox and that uses gdm? I know I can add packages with --packages, but how do I have those packages automatically configured, IE: pypanel is installed, but configured to start when openbox starts, or tilda is installed, but has a certain configuration and starts upon login.
_________________
Back to top
View user's profile Send private message  
Bro.Tiag



Joined: 02 Jun 2007
Posts: 530

PostPosted: 2008-04-06 06:14    Post subject: Reply with quote Edit/Delete this post

MeanDean wrote:
Bro.Tiag wrote:
But somehow I wound up with a gnome desktop & not e17.

too much beer?

Is there such a thing?

Actually, I used the package list from yur sid-e17 LiveCD, but must have missed removing something gnome related.

Cheers
Back to top
View user's profile Send private message  
ingo



Joined: 15 Apr 2007
Posts: 181
Location: capital of beer

PostPosted: 2008-04-07 14:47    Post subject: Reply with quote

Yeah, live-helper is nice but I am not sure to what extend I can customise my live CD with it. I am not saying that it isn't possible, but I can't see the wood for all the trees at the mo...

You see, I've got a splashy theme (I know...), a kdm theme, a ksplash theme, a totally different looking kde desktop not using any of the menus out there but my own and I only know how to do that by mounting the squashfs from a normal live CD (building as I type), chrooting into it and doing it all from there.

Having said that - I am not sure how to pack the squashfs into the new iso again, but that cannot be too difficult Rolling Eyes

Anyway, thank you MeanDean for getting this rolling!

Hm, just read that lh_config starts a proper config file. One should be able to do a fair amount of tweaking there... Got to look into it.
_________________
AMD Athlon XP 2600+ - nVidia GeForce FX 5200 - 1024MB Ram on Debian Lenny / T41 on Kubuntu 7.10
Back to top
View user's profile Send private message  
MeanDean



Joined: 31 Aug 2007
Posts: 1221

PostPosted: 2008-04-08 08:54    Post subject: Reply with quote

part2 is done...I think...

feel free to ask any questions (even i f I do crack a joke about your sweaty little hand)

need any or all the sections explained then just let me know but don't forget that man is your friend too and is always there to help you

Laughing
_________________
How to ask questions the smart way!
Back to top
View user's profile Send private message Send e-mail  
MeanDean



Joined: 31 Aug 2007
Posts: 1221

PostPosted: 2008-04-08 09:01    Post subject: Reply with quote

ingo wrote:

You see, I've got a splashy theme (I know...), a kdm theme, a ksplash theme, a totally different looking kde desktop not using any of the menus out there but my own and I only know how to do that by mounting the squashfs from a normal live CD (building as I type), chrooting into it and doing it all from there.

Having said that - I am not sure how to pack the squashfs into the new iso again, but that cannot be too difficult

part2 is where I would probably start integrating my custom stuff and then I would finish it up in part3 if I needed to do more

extract the filesystem contained within the squash to folderX, move the stuff in, chroot in, configure and tweak, exit chroot, then simply squash folderX again with mksquashfs folderX/ path/to/filesystem.squashfs

hope this helps....always welcome...
_________________
How to ask questions the smart way!
Back to top
View user's profile Send private message Send e-mail  
ingo



Joined: 15 Apr 2007
Posts: 181
Location: capital of beer

PostPosted: 2008-04-08 09:03    Post subject: Reply with quote

Funny you should say that Wink

I made myself a basic lenny kde cd last night (weyhey!), so far so good. I checked the man pages and found them to be either non-existent or just as helpful - but that is just me, my brain is not sufficiently geeky to make sense of ANY man pages (I can just about make sense of the flags...).

Anyway, I have a working system to play with. Aim is to mount the squashfs, chroot into it, mount proc and sys, get on the net and do what a man has got to do - no sweat.

If you could now supply me with the proper mkisofs command to tie my work up and pack it into a nice iso I'd be more than grateful!!! I'd like to extract it from live-helper but that is a closed book as far as I am concerned...

Right, time to crack your jokes Embarassed
_________________
AMD Athlon XP 2600+ - nVidia GeForce FX 5200 - 1024MB Ram on Debian Lenny / T41 on Kubuntu 7.10
Back to top
View user's profile Send private message  
Display posts from previous:   
Post new topic   Reply to topic    Debian User Forums Forum Index -> Docs, Howtos, Tips & Tricks All times are GMT - 4 Hours
Goto page 1, 2, 3, 4, 5, 6  Next
Page 1 of 6
Stop watching this topic
 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum


Powered by phpBB 2.0.21-6fdn4 (Debian) 2001, 2005 phpBB Group