# [HOWTO] Create a live cd with Catalyst 2.0

## manuels

Hi folks,

I found no howto for Catalyst 2.0 and its documentation is not really good I decided to write my own howto.

Comments are welcome.

Here I present how to create a minimal live CD with Catalyst 2.0 with automated hardware detection. I do not guarantee that it is complete and has no failures. If you find a failure or have ideas how to expand this howto send me a personal mail.

As nopaste deletes posts so fast I attached the needed files to this post.

Catalyst currently only works as superuser.

Contents

1. Installing and configurating Catalyst 2.0

2. Creating a portage snapshot

3. Creating a live cd stage 1

4. Creating a live cd stage 2

Appendix

- Troubleshooting

- Needed files

1. Installing and configurating Catalyst 2.0

Unmask it and install it the getnoo way

```
mkdir /etc/portage/package.keywords

echo "=dev-util/catalyst-2.0.5_pre3 ~*" >> /etc/portage/package.keywords/catalyst

emerge -av catalyst
```

Now you can adjust the numbers of CPUs used to compile the live cd's ebuilds. Edit /etc/catalyst/catalystrc and add this line

```
export MAKEOPTS="-jN"
```

Replace N with the number of CPUs to use +1.

You can do further configuration in /etc/catalyst/catalyst.conf but I didn't need this yet. If you want to do so you probably need the the documentation.

2. Creating a portage snapshot

You must create a portage snapshot of your current system's portage tree. So to use up to date ebuilds you should call

```
emerge --sync
```

if you didn't already execute it today.

Now we can create the snapshot:

```
catalyst -C target=snapshot version_stamp=my_date
```

 You can replace my_date with the current date but then you must make sure that you change it in the .spec file (see below) too!

3. Creating a live cd stage 1

Please note that a "live cd stage 1" has nothing to do with a "stage 1 gentoo linux installation"!

First he must get the current gentoo linux stage 3 installation tar ball from your gentoo linux mirror:

```

cd /var/tmp/catalyst/builds/default/

wget <your mirror>/releases/x86/2007.0/stages/stage3-x86-2007.0.tar.bz2 
```

And now we create some directories:

```
mkdir -p /root/catalyst/portage/package.keywords

mkdir -p /root/catalyst/kernel
```

Download the live cd stage 1 .spec file livecd-stage1.spec (see appendix below) and edit it.

You should adjust following values:

version_stamp

think about a nice name for your livecd

snapshot

paste portage snapshot name here

livecd/use

if you need global use flags put them here

livecd/packages

ebuilds that should be installed on the livecd are placed here if they do not depend on a configured kernel

now call 

```
catalyst -f /root/catalyst/livecd-stage1.spec
```

to create the live cd stage 1.

4. Creating a live cd stage 2

Now it's time to create the live cd stage 2.

First get a kernel config file (see appendix below, there is knoppix's .config file (slightly modify to work with catalyst)). Paste it to /root/catalyst/kernel/current.config

 Download the livecd-stage2.spec file (see appendix below) to /root/catalyst/ and edit it.

You should be interested in following values:

version_stamp

once again the name of your live cd

snapshot

and the portage snapshots name

source_subpath

subpath (relative to /var/tmp/catalyst/builds/) of the live cd stage1. Probably something like default/livecd-stage1-i586-my_livecd

livecd/iso

output iso file (your live cd image)

livecd/rcadd

If you want to start some /etc/init.d/ services at boot put them here

livecd/rcdel

Or do you want to remove some?

livecd/root_overlay

If you want to put some files on the live cd that are not included in any ebuild (like custom configuration files) you can specify a directory with root directory tree (eg. /etc-directory, /root/-directory)

livecd/xdm

You'd like to start kdm at start up? put it here

livecd/volid

Your custom Volume ID

boot/kernel/gentoo/config

Path to kernel config file (eg. /root/catalyst/kernel/current.config)

boot/kernel/gentoo/packages

Kernel dependent ebuilds must be written down here

Now run 

```
catalyst -f livecd-stage2.spec
```

 and catalyst will bake the kernel and place your live cd's iso image in livecd/iso (see above).

Good luck.

Appendix

Troubleshooting

I get an error like "System.map not found"

This is a bug in genkernel. Use the latest genkernel version:

```
echo "=sys-kernel/genkernel-3.4.9_pre2        ~*      # otherwise we get a --System.map not found-- error" > /root/catalyst/portage/package.keywords/genkernel

```

Please also note the error described below!

(livecd stage2) I have changed files in the livecd's portage directory but it doesn't take effect.

If you change something in /root/catalyst/portage you must recreate live cd stage 1!

Needed files

current.config

livecd-stage1.spec

livecd-stage2.spec

----------

## steveL

WOW! Thanks manuels, I gave up on catalyst, but this means I might be able to get somewhere with it.

I'll have a go with this next week. Very much appreciated.

----------

## manuels

You're welcome. Let me know whether it works or there are any errors.

Cheers,

Manuel

----------

## jfall

I'm getting "ERROR: Could not copy System.map for the kernel package!", and I modified portage/package.keywords/genkernel according to your suggestion and re-ran stage1.  When I did, I kept getting an error message about an invalid atom in package.keywords (the line I just added) and of course when I ran stage2, it failed on me with the same error message.  So, I tried adding an = sign in front of the line in portage/package.keywords/genkernel, and re-ran stage1.  No complaints about an invalid atom, however when I run stage2 it still emerges genkernel-3.4.8, not 3.4.9_pre2.

So, I looked into /var/tmp/catalyst/tmp/default/livecd-stage1-i686-2007.7/etc/portage/package.keywords, and there is a genkernel file that is a copy of the one I setup.  However, in /var/tmp/catalyst/tmp/default/livecd-stage2-i686-2007.7/etc/portage, there is no package.keywords at all, and that's probably why it's still emerging the old version.  The question is, why is catalyst not copying the file into stage2?  I have the portage_confdir listed in my spec file.  Is there a way to get catalyst to re-create stage2 from scratch?

Or, do you have any other ideas?

Thanks

----------

## manuels

Hi,

I've corrected this = sign in my howto, thanks.

I think you can delete the whole /var/tmp/catalyst/tmp/default/livecd-stage2-i686-2007.7/ directory so catalyst will recreate it from scratch.

Did stage1 finish without any errors?

Cheers

Manuel

----------

## Januszzz

Hmm very nice!

But for beginners there is also good start point here: http://www.gentoo.org/proj/en/base/embedded/gnap.xml

Should be faster and easier to start, but if you become more advanced you just finish with... catalyst. Although GNAP isn't very frequently updated, its as good written as Portage (btw GNAP depends on Portage heavily). Because of some "little breaks" GNAP is ultimate introduction to Catalyst, which any serious Linux and especially Gentoo Fan should take!

Regards.

----------

## Januszzz

Hey, what's that:

 *Quote:*   

> mkdir /etc/portage/package.keywords

 

shouldn't it be i.e. "touch /etc/portage/package.keywords?"  :Wink: 

Regards, I will try to follow your howto anyway in just minutes so expect some more reports  :Wink: 

----------

## manuels

It can be both.

You can either create a file /etc/portage/packages.keywords and put all your lines in there or you can create a directory /etc/portage/packages.keywords and create files like /etc/portage/packages.keywords/gentoolkit and /etc/portage/packages.keywords/gentoo-sources and put your lines into these files.

I like the second way because it is more cheerful.   :Very Happy: 

----------

## Treggats

My stage1 fails. Catalyst thinks my portage version is too low. 

But as shown it is not.

```
ERROR: Your portage version is too low in your seed stage.  Portage version

2.0.51 or greater is required.

Traceback (most recent call last):

  File "modules/livecd_stage1_target.py", line 21, in run_local

    cmd("/bin/bash "+self.settings["sharedir"]+\

  File "/usr/lib/catalyst/modules/catalyst_support.py", line 102, in cmd

    raise CatalystError,myexc

CatalystError: <unprintable instance object>

None

!!! catalyst: LiveCD stage1 build aborting due to error.

Zebaoth catalyst # emerge -V

Portage 2.1.3.9 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.22-gentoo-r8 x86_64)

```

Any ideas how this can be fixed?

----------

## manuels

from which date is your catalyst portage snapshot?

----------

## tcostigl

Does catalyst support creating LiveUSB's? I assume not since booting live cd's off usb flash memory is not supported by the developers. But if you know how to do it it would be a great addition to the howto.

See https://forums.gentoo.org/viewtopic-t-590705-highlight-.html

----------

## likewhoa

see www.gentoo.org/doc/en/liveusb.xml

----------

## tcostigl

That how-to led to the problem I mentioned in the post I linked to. JackFrost showed me a work around but I would like to know if there is a cleaner way to do it. Specifically, if I can change some catalyst settings to target usb booting?

----------

## manuels

not to my knowledge

----------

## likewhoa

 *tcostigl wrote:*   

> That how-to led to the problem I mentioned in the post I linked to. JackFrost showed me a work around but I would like to know if there is a cleaner way to do it. Specifically, if I can change some catalyst settings to target usb booting?

 

no, you're best bet is to setup tinygentoo, google for it or search the wiki on it. I run a tinygentoo of my own on a usb stick loaded with extlinux.

----------

## alienhunter3

i'm having a problem after i run 

```
catalyst -f livecd-stage1.spec
```

here's a snippet of the error:

```

emerge --quiet --usepkg --buildpkg --newuse livecd-tools dhcpcd acpid gentoo-sources syslog-ng links dosfstools nfs-utils jfsutils xfsprogs e2fsprogs reiserfsprogs ntfsprogs pwgen iputils hwsetup lvm2 evms wireless-tools app-misc/livecd-tools

!!! Error: the <sys-fs/udev-115-r1 package conflicts with another package;

!!!        the two packages cannot be installed on the same system together.

!!!        Please use 'emerge --pretend' to determine blockers.

!!! catalyst: Error in attempt to build packages

```

any suggestions?  do you require more information for a diagnosis?

thanks

----------

## jaylmaz

I'm trying to create a minimal livecd by following the [HOWTO] Create a live cd with Catalyst 2.0 in this forum. When I try to create the livecd-stage1, I get an error message about UDEV is blocked, cannot be installed with another package, run --pretend.

When I try the emerge --pretend (with all the packages Catalyst is trying to emerge), nothing shows up as blocked. 

I'm trying to do this from a minimal fresh install, no use flags set. Maybe that's the problem?

All suggestions will be appreciated.

----------

## desultory

Merged the above post.

----------

## Shamus397

I'm running into this too when trying to make a stage1 CD install. It's udev-115-r1 blocking against device-mapper-1.02.22-r5. A quick look at the ebuild for device-mapper shows:

```
RDEPEND="!<sys-fs/udev-115-r1

                ${DEPEND}"
```

And, of course, the latest stable version of udev is 115-r1. So this looks like a bug in portage to me. Any devs care to comment?  :Smile: 

EDIT:

It seems that you need to update udev from inside the chroot. So run catalyst, wait for the part where it says it will merge packages in reverse order and press a key when it says 'press any key within 15 seconds'. Then:

```
cd /var/tmp/catalyst/tmp/default/livecd-stage1-[arch]-[livecdname]

chroot . /bin/bash

emerge udev

exit
```

Then you can press any key again and it should get past the block. Apparently the udev from the 2007.1 snapshot is too old for the latest device-mapper and must be updated by hand. If you ask me, this is stupid and something that portage should be able to handle automatically--simply putting udev before device-mapper in the merge order would do it. *shrug*

----------

## jaylmaz

 *Quote:*   

> It seems that you need to update udev from inside the chroot. So run catalyst, wait for the part where it says it will merge packages in reverse order and press a key when it says 'press any key within 15 seconds'. Then: 
> 
> Code: 
> 
> cd /var/tmp/catalyst/tmp/default/livecd-stage1-[arch]-[livecdname] 
> ...

 

How do you actually do this? After it says "press any key within 15 seconds", it immediately continues when I try to cd /var/tmp   etc.. since I'm pressing another key.

----------

## jaylmaz

 *Quote:*   

> How do you actually do this? After it says "press any key within 15 seconds", it immediately continues when I try to cd /var/tmp etc.. since I'm pressing another key.

 

OK, got past this by opening another console, no more blocking problem.

But, now stage2 fails, callback fails. I'm not at home and don't have the whole error message. I can post more when I get home. What information should I post that would be the most useful in troubleshooting?

Thanks.

----------

## aZZe

To fix the udev Problem do a chroot as Shamus397 has described in his post. But you don't need to press any key to stop the process. When the command fails first do the chroot, do a emerge --sync, then emerge udev an leave the chroot. Then run catalyst again.

----------

## energyman76b

Hi,

I get this error:

* Messages for package x11-libs/gtk+-2.12.5-r1:

 * Please re-emerge x11-libs/cairo with the X USE flag set

 *

 * ERROR: x11-libs/gtk+-2.12.5-r1 failed.

 * Call stack:

 *               ebuild.sh, line   49:  Called pkg_setup

 *   gtk+-2.12.5-r1.ebuild, line   54:  Called die

 * The specific snippet of code:

 *              die "cairo needs the X flag set"

 *  The die message:

 *   cairo needs the X flag set

 *

 * If you need support, post the topmost build error, and the call stack if relevant.

 * A complete build log is located at '/var/tmp/portage/x11-libs/gtk+-2.12.5-r1/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/x11-libs/gtk+-2.12.5-r1/temp/die.env'.

 *

!!! catalyst: Error in attempt to build packages

Traceback (most recent call last):

  File "modules/generic_stage_target.py", line 1392, in build_packages

    "Error in attempt to build packages",env=self.env)

  File "/usr/lib64/catalyst/modules/catalyst_support.py", line 535, in cmd

    raise CatalystError,myexc

CatalystError

None

!!! catalyst: livecdbuild aborting due to error.

!!! catalyst: Error encountered during run of target livecd-stage1

Catalyst aborting....

so how do I get catalyst to rebuilt the cairo package? Or accept the cairo package that I built with the X flag and copied in?

EDIT:

nevermind, the chroot did the trick. Thank you guys.

----------

## jaylmaz

I have now managed to produce a livecd that will boot, but not do much else. I have attempted to X working and firefox. During stage2, I get an error that says both xorg-server and mesa must be built with the same nptl flag set. So I tried package.use with nptl set, no go, same error. Tried package.use with -nptl set, same error again.

I'm stuck, any suggestions?

----------

## manuels

Perhaps FAQ point two can help:

 *Quote:*   

> (livecd stage2) I have changed files in the livecd's portage directory but it doesn't take effect.
> 
> If you change something in /root/catalyst/portage you must recreate live cd stage 1! 

 

----------

## Anon-E-moose

Anyone know if this is still accurate for catalyst 3? 

If not, any idea where it differs?

(and yeah, I'm aware of a hell of a necro bump   :Laughing:   )

----------

