Problem with Molecule [Solved]

If you are using the daily ISO, please report issues here to keep confusion down in other forums. Questions or issues with Molecule also here

Moderator: Moderators

Problem with Molecule [Solved]

Postby alexrenzi » Tue Jul 20, 2010 18:15

Hi,
I'm trying to create a custom live cd of Sabayon with Molecule, I followed this wiki:
http://wiki.sabayon.org/index.php?title=HOWTO:_Using_Molecule_Example
in wich there is an example, copying that example and adding few lines I've created this spec file:

Code: Select all
# Sabayon Linux 5 x86 Molecule spec file
# squashfs, mkisofs needed

# pre chroot command, example, for 32bit chroots on 64bit system, you always have to append "linux32"
# this is useful for inner_chroot_script
# prechroot:

# Release string
release_string: CustomSabayon

# Release Version
release_version: 0.1

# Release Version string description
release_desc: x86 KDE

# Define an alternative execution strategy, in this case, the value must be
# "iso_remaster"
execution_strategy: iso_remaster

# Path to source ISO file (MANDATORY)
source_iso: /home/alex/Sabayon Live/iso/Sabayon_Linux_DAILY_x86_K.iso

# Outer chroot script command, to be executed outside destination chroot before
# before entering it (and before inner_chroot_script)
outer_chroot_script: /home/alex/Desktop/alex/Sabayon Live/remaster_pre.sh

#Inner chroot script command, to be executed inside destination chroot before packing it
# - kmerge.sh - setup kernel bins
inner_chroot_script: /home/alex/Desktop/alex/Sabayon Live/inner_chroot_script.sh

# Outer chroot script command, to be executed outside destination chroot before
# before entering it (and AFTER inner_chroot_script)
outer_chroot_script_after: /home/alex/Desktop/alex/Sabayon Live/remaster_post.sh

# Extra mkisofs parameters, perhaps something to include/use your bootloader
extra_mkisofs_parameters: -b isolinux/isolinux.bin -c isolinux/boot.cat

# Destination directory for the ISO image path (MANDATORY)
destination_iso_directory: /home/alex/Sabayon Live/final

#FOR CD IMAGE Destination ISO image name, call whatever you want.iso, not mandatory
destination_iso_image_name: Sabayon_Custom_x86_K

#FOR DVD IMAGE Output iso image title
#iso_title: Sabayon_Custom_x86_K

# Merge directory with destination LiveCD root
# merge_livecd_root: /put/more/files/onto/CD/root

# List of packages that would be removed from chrooted system (comma separated)
#packages_to_remove: foo, foo2, foo3, foo4, foo5

# Custom shell call to packages removal (default is: equo remove)
# custom_packages_remove_cmd:

# List of packages that would be added from chrooted system (comma separated)
#packages_to_add: foo, foo2, foo3, foo4, foo5

# Custom shell call to packages add (default is: equo install)
# custom_packages_add_cmd:

# Custom command for updating repositories (default is: equo update)
# repositories_update_cmd:

# Determine whether repositories update should be run (if packages_to_add is set)
# (default is: no), values are: yes, no.
execute_repositories_update: yes

# Directories to remove completely (comma separated)
paths_to_remove:
    /var/lib/entropy/client/database/amd64/sabayonlinux.org,
    /boot/grub/grub.conf,
    /root/.subversion,
    /lib/udev-state/devices.tar.bz2,
    /var/log/scrollkeeper.log, /var/log/genkernel.log,
    /var/log/emerge.log, /usr/tmp/portage/*,
    /root/.bash_history,
    /usr/share/slocate/slocate.db,
    /root/test-results.txt,
    /root/test.sh,
    /usr/portage/distfiles/*,
    /usr/portage/packages/*,
    /root/.revdep*,
    /install-data/games/*,
    /var/lib/entropy/store/*,
    /var/log/entropy/*,
    /var/lib/entropy/caches/*,
    /var/lib/entropy/smartapps/amd64/*,
    /var/lib/entropy/smartapps/amd64/*,
    /var/lib/entropy/tmp/*,
    /var/lib/entropy/packages*/*,
    /var/tmp/entropy/*,
    /*.txt,
    /usr/portage/a*,
    /usr/portage/b*,
    /usr/portage/c*,
    /usr/portage/d*,
    /usr/portage/e*,
    /usr/portage/f*,
    /usr/portage/g*,
    /usr/portage/h*,
    /usr/portage/i*,
    /usr/portage/j*,
    /usr/portage/k*,
    /usr/portage/licenses,
    /usr/portage/lxde*,
    /usr/portage/m*,
    /usr/portage/n*,
    /usr/portage/o*,
    /usr/portage/packages,
    /usr/portage/pe*,
    /usr/portage/q*,
    /usr/portage/r*,
    /usr/portage/s*,
    /usr/portage/t*,
    /usr/portage/u*,
    /usr/portage/v*,
    /usr/portage/w*,
    /usr/portage/x*,
    /usr/portage/y*,
    /usr/portage/z*,
    /etc/ssh/ssh_host_*,
    /var/run/screen*,
    /entropy,
    /tmp/equoerror.txt,
    /var/cache/man,
    /var/lib/entropy/glsa/*,
    /opt/anaconda/usr/lib32,
    /opt/anaconda/usr/share/anaconda/po,
    /var/log/entropy/*.log,
    /etc/mtab,
    /boot/grub/grub.c*,
    /tmp/.ICE-unix*,
    /tmp/*.txt,
    /tmp/.X*,
    /boot/grub/device.map

# Directories to empty (comma separated)
paths_to_empty:
    /home/sabayonuser/.thumbnails/,
    /var/tmp,
    /root/.ccache,
    /var/tmp/portage,
    /var/tmp/ccache,
    /var/tmp/portage-pkg,
    /var/tmp/binpkgs,
    /var/lib/entropy/portage,
    /var/lib/entropy/logs,
    /var/lib/entropy/packages/amd64/4,
    /var/cache/genkernel


I've also copied the two scripts remaster_pre.sh and remaster_post.sh and created my own inner_chroot_script.sh in order to install some additional software, these scripts are the following:

remaster_pre.sh:
Code: Select all
#!/bin/sh
PKGS_DIR="/sabayon/remaster/pkgs"
CHROOT_PKGS_DIR="${CHROOT_DIR}/var/lib/entropy/packages"
[[ ! -d "${PKGS_DIR}" ]] && mkdir -p "${PKGS_DIR}"
[[ ! -d "${CHROOT_PKGS_DIR}" ]] && mkdir -p "${CHROOT_PKGS_DIR}"
echo "Mounting packages over"
rm -rf "${CHROOT_PKGS_DIR}"/*
cp ${PKGS_DIR}/* "${CHROOT_PKGS_DIR}"/ -Ra
exit 0


remaster_post.sh:
Code: Select all
#!/bin/sh
PKGS_DIR="/sabayon/remaster/pkgs"
CHROOT_PKGS_DIR="${CHROOT_DIR}/var/lib/entropy/packages"
echo "Merging back packages"
cp "${CHROOT_PKGS_DIR}"/* "${PKGS_DIR}"/ -Ra
rm -rf "${CHROOT_PKGS_DIR}"{,-nonfree,-restricted}/*
cp /home/alex/Sabayon Live/background/background.png "${CHROOT_DIR}/usr/share/backgrounds/background.png"
is_64=$(file "${CHROOT_DIR}"/bin/bash | grep "x86-64")
if [ -n "${is_64}" ]; then
    echo "equo cleanup" | chroot "${CHROOT_DIR}"
else
    echo "equo cleanup" | linux32 chroot "${CHROOT_DIR}"
fi


inner_chroot_script.sh:
Code: Select all
#!/bin/bash

# Package manager update
equo update
equo install entropy equo --multifetch=10

# Unwanted package removal
equo remove kopete

#Software installation
equo install www-client/chromium   www-client/opera    net-analyzer/wireshark    kde-base/step    media-gfx/blender    app-cdr/acetoneiso    media-sound/audacity    kde-base/kmplot    media-gfx/inkscape    net-im/amsn    amsn-skins    net-im/emesene    dev-util/kdevelop    net-print/hplip    net-im/skype    net-analyzer/wireshark   apache   arping   eclipse-sdk   ethtool   gnu-netcat   gparted   hping   sys-boot/unetbootin   playonlinux   sun-jdk   tcpdump   tuprolog   virtualbox-bin   virtualbox-guest-additions   virtualbox-modules   --multifetch=10
equo conf update

# Java configuration
java-config -S sun-jdk-1.6
java-config-2 -S sun-jdk-1.6

# Modules configuration
echo modules=\"vboxdrv vboxnetflt vboxnetadp b43\" >> /etc/conf.d/modules

#Cleanup
equo cleanup
equo rescue vacuum


But when I try to run molecule I get this:
Code: Select all
Sabayon-Alex Sabayon Live # molecule sabayon.spec
>>  (0/4) [Runner|sabayon.spec] preparing execution
>>  (1/4) [Runner|sabayon.spec] executing molecule.specs.plugins.remaster_plugin.IsoUnpackHandler
>> [IsoUnpackHandler|sabayon.spec] executing pre_run
>> [IsoUnpackHandler|sabayon.spec] spawning: ['mount', '-o', 'loop', '-t', 'iso9660', u'/home/alex/Sabayon Live/iso/Sabayon_Linux_DAILY_x86_K.iso', '/var/tmp/moleculeIAKVob']
Usage: mount -V                 : print version
       mount -h                 : print this help
       mount                    : list mounted filesystems
       mount -l                 : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
       mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
       mount device             : mount device at the known place
       mount directory          : mount known device here
       mount -t type dev dir    : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
       mount --bind olddir newdir
or move a subtree:
       mount --move olddir newdir
One can change the type of mount containing the directory dir:
       mount --make-shared dir
       mount --make-slave dir
       mount --make-private dir
       mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
       mount --make-rshared dir
       mount --make-rslave dir
       mount --make-rprivate dir
       mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using  -L label  or by uuid, using  -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say  man 8 mount .
>> [IsoUnpackHandler|sabayon.spec] iso mount failed: 1
>> [IsoUnpackHandler|sabayon.spec] executing kill


So it stop and I can't understand what it's wrong, there's someone that can kindly help me?
Thank you very much ^^
Last edited by alexrenzi on Tue Oct 05, 2010 17:53, edited 2 times in total.
alexrenzi
Baby Hen
 
Posts: 18
Joined: Wed Dec 02, 2009 11:29

Re: Problem with Molecule

Postby wolfden » Wed Jul 21, 2010 6:21

hmmm have not seen that error before, looks like Fabio will have to take a look. Seems like a mounting issue

I wouldn't be using such a path, Sabayon Live has a blank space and afaik with shell scripts, it's a failed path. Keep your paths short and simple.
Code: Select all
/home/alex/Desktop/alex/Sabayon Live/remaster_pre.sh



I am curious as to why you don't put the package removal and packages to add in the spec file?

Code: Select all
# List of packages that would be removed from chrooted system (comma separated)
#packages_to_remove: foo, foo2, foo3, foo4, foo5



Code: Select all
# List of packages that would be added from chrooted system (comma separated)
#packages_to_add: foo, foo2, foo3, foo4, foo5
User avatar
wolfden
Sharecropper
 
Posts: 8824
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: Problem with Molecule

Postby alexrenzi » Wed Jul 21, 2010 10:06

I don't believe, the problem was the space in the name of the folder XD, now it seems to be ok.
But for the remaster_pre.sh script i had to set the executable flag in the properties because otherwise it says that i don't have the permission to run the script, the strange thing is that for the other two scripts it wasn't needed.

About the package removal and packages to add, in another try they didn't work and i wasn't sure about how they work, then i followed an example of a friend that have yet used this tool.
Moreover i can configure things like virtualbox and make other configuration that i will add in future. If there is a better way to do this i really appreciate if you can explain to me :D
In particular i was confused about packages_to_add and custom_packages_add_cmd usage and difference.
alexrenzi
Baby Hen
 
Posts: 18
Joined: Wed Dec 02, 2009 11:29

Re: Problem with Molecule

Postby wolfden » Wed Jul 21, 2010 11:02

weird that it can work with the space

The wiki page says they have to be executable to work in the first line of the shell script area:
I want to stress that these are for the more advanced stuff and are not needed. They need to be executable in order to run them.


confused?

Packages you do not want on your custom iso are listed here, notice the example foo packages. In this it will remove 5 packages, foo, foo2 etc... Just simple replace the name of the files
Code: Select all
# List of packages that would be removed from chrooted system (comma separated)
packages_to_remove: foo, foo2, foo3, foo4, foo5


example 2
Code: Select all
# List of packages that would be removed from chrooted system (comma separated)
packages_to_remove: kopete


Use this area to put the packages you want to install. This will install 5 packages foo, foo2, et....
Code: Select all
# List of packages that would be added from chrooted system (comma separated)
packages_to_add: foo, foo2, foo3, foo4, foo5


so example 2
Code: Select all
packages_to_add: www-client/chromium, www-client/opera, net-analyzer/wireshark, kde-base/step, media-gfx/blender, app-cdr/acetoneiso, media-sound/audacity, kde-base/kmplot, media-gfx/inkscape, net-im/amsn, amsn-skins
User avatar
wolfden
Sharecropper
 
Posts: 8824
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: Problem with Molecule

Postby alexrenzi » Wed Jul 21, 2010 13:06

Sorry, i didn't noticed that the scripts had to be executable ^^", and what about the custom_packages_add_cmd command?
alexrenzi
Baby Hen
 
Posts: 18
Joined: Wed Dec 02, 2009 11:29

Re: Problem with Molecule

Postby wolfden » Wed Jul 21, 2010 23:52

I'm not sure, Fabio is trying to get to proper documentation of it, till than we just kinda have to wing it. He is a busy busy guy and understands it the most.
User avatar
wolfden
Sharecropper
 
Posts: 8824
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: Problem with Molecule

Postby alexrenzi » Sun Jul 25, 2010 13:49

hello again ^^"
now i'm having another problem with the remaster_post.sh script, in the example you change the desktop background simply coping the file in the proper directory and i made the same:
Code: Select all
cp /home/alex/Sabayon/file/background.png "${CHROOT_DIR}/usr/share/backgrounds/sabayonlinux.png"
cp /home/alex/Sabayon/file/background.jpg "${CHROOT_DIR}/usr/share/backgrounds/sabayonlinux.jpg"


then i thought, to change some default configuration or, for example, to add an autostart entry it will be sufficient to copy all the files in their respective directory:
Code: Select all
cp /home/alex/Desktop/alex/Sabayon/file/Yakuake.desktop "${CHROOT_DIR}/home/sabayonuser/.config/autostart/Yakuake.desktop"


but it didn't work:
Code: Select all
cp: impossibile creare il file regolare "/var/tmp/moleculeAOJtqcchroot/root/home/sabayonuser/.config/autostart/Yakuake.desktop": No such file or directory
>> [ChrootHandler|sabayon.spec] outer chroot hook (after inner) failed: 1
>> [ChrootHandler|sabayon.spec] executing kill


why the directory should not exist???
alexrenzi
Baby Hen
 
Posts: 18
Joined: Wed Dec 02, 2009 11:29

Re: Problem with Molecule

Postby alexrenzi » Sun Jul 25, 2010 21:41

I tried to copy in ${CHROOT_DIR}/etc/skel/.config/autostart/, but it didn't work, i mean that once the live cd started the autorun didn't work
alexrenzi
Baby Hen
 
Posts: 18
Joined: Wed Dec 02, 2009 11:29

Re: Problem with Molecule

Postby wolfden » Tue Jul 27, 2010 6:51

Code: Select all
"${CHROOT_DIR}/home/sabayonuser/.config/autostart/Yakuake.desktop"


You can't do things like that, the sabayonuser account is created on the fly, so another words, it doesn't exist till booted. I found that out the hard way.
User avatar
wolfden
Sharecropper
 
Posts: 8824
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: Problem with Molecule

Postby joost » Tue Jul 27, 2010 9:01

You can do that kinda stuff in /etc/skel

Anything in /etc/skel will be copied to the userdir when its account is created.
User avatar
joost
Sagely Hen
 
Posts: 2332
Joined: Fri Nov 17, 2006 12:11
Location: The Netherlands

Next

Return to ISO Testing & Molecule

Who is online

Users browsing this forum: No registered users and 0 guests