TurnKey Linux Virtual Appliance Library

tklpatch generates broken iso

Hello. As I posted http://www.turnkeylinux.org/docs/tklpatch/development#comment-1296 My patch conf looks like this :

#!/bin/bash -ex

HOSTNAME=somehost
# set hostname
echo "$HOSTNAME" > /etc/hostname
sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts
 

I have nothing in deb/ or overlay/

As I mentioned the result is iso that is loading busybox shell. couldn't see any errors on the kernel boot messages.

One thing I should mention is that I'm running the tklpatch from other distro and not ubuntu. don't know if that matters.

Any hints ?

Liraz Siri's picture

Questions and ideas

What Linux distribution are you using? We've only tested TKLPatch with Ubuntu so this may be related. TKLPatch depends on a few pieces of software which may behave differently on your distribution. Also if you could capture the output from running tklpatch to a file and attach it to your message it will be easier to pinpoint what is going on. You may also want to try using TKLPatch from inside a TurnKey or Ubuntu VM.

Hi Liraz I tried from gentoo.

Hi Liraz

I tried from gentoo. I had no error/warning messages using the patch creation.

I tried from turnkey and the generated ISO is OK.

Thanks for your advice.

Eric.

Stephen Weber's picture

I've got the same problem, from Ubuntu

I'm getting what seems to be a similar problem with my ISO, using Ubuntu 64-bit (Karmic). I'm patching Turnkey Core 2009.02 Hardy x86, and running the resulting ISO in Sun's VirtualBox 3.012 r54655. I've created some patches before, but I don't think I've gotten one to work yet.

The output from tklpatch:

user@divcom:~/tkl$ sudo tklpatch /home/mordel/Downloads/turnkey-core-2009.02-hardy-x86.iso tklopenfire
# extracting root filesystem and isolinux from ISO
Parallel unsquashfs: Using 2 processors
18573 inodes (18780 blocks) to write

[========================================================================================================================================|] 18780/18780 100%
created 17460 files
created 1986 directories
created 689 symlinks
created 41 devices
created 0 fifos
TKLPATCH_ISOLABEL: tklopenfire
# applying patch tklopenfire
# installing 1 debs from tklopenfire/debs
# chroot execute: dpkg -i /*.deb; rm -f /*.deb
Selecting previously deselected package openfire.
dpkg: regarding /openfire_3.6.4_all.deb containing openfire, pre-dependency problem:
 openfire pre-depends on sun-java5-jre | sun-java6-jre
  sun-java5-jre is not installed.
  sun-java6-jre is not installed.
dpkg: error processing /openfire_3.6.4_all.deb (--install):
 pre-dependency problem - not installing openfire
Errors were encountered while processing:
 /openfire_3.6.4_all.deb
# executing config script tklopenfire/conf
# chroot execute: /tmp/tklpatch/conf
+ HOSTNAME=openfire3
+ echo openfire3
+ sed -i 's|127.0.1.1 \(.*\)|127.0.1.1 openfire3|' /etc/hosts
+ echo '91.189.88.46    archive.ubuntu.com'
+ echo '91.189.88.46    security.ubuntu.com'
+ echo '97.107.134.22   archive.turnkeylinux.org'
+ sed -i 's/^# deb/deb/' /etc/apt/sources.list.d/sources.list
+ apt-get update
<<<snip>>>
Get:30 http://archive.ubuntu.com hardy-backports/multiverse Packages [15.4kB]                                                                               
Fetched 9402kB in 1min28s (106kB/s)                                                                                                                         
Reading package lists... Done
+ apt-get update
<<<snip>>>
Hit http://archive.turnkeylinux.org hardy/universe Packages
Reading package lists... Done                               
+ DEBIAN_FRONTEND=noninteractive
+ apt-get install -y openjdk-6-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  ca-certificates java-common libaccess-bridge-java libasound2 libcupsys2 libfreetype6 libgcrypt11 libgif4 libgnutls13 libgpg-error0 libjpeg62 liblcms1
  liblzo2-2 libopencdk10 libpng12-0 libtasn1-3 libx11-6 libx11-data libxau6 libxcb-xlib0 libxcb1 libxdmcp6 libxext6 libxi6 libxtst6 openjdk-6-jre-headless
  openjdk-6-jre-lib rhino x11-common
Suggested packages:
  equivs libasound2-plugins cupsys-common libfreetype6-dev rng-tools gnutls-bin liblcms-utils icedtea-gcjwebplugin sun-java6-fonts ttf-dejavu-core
  rhino-doc
Recommended packages:
  ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-bengali-fonts ttf-indic-fonts-core ttf-kannada-fonts ttf-kochi-gothic ttf-sazanami-gothic ttf-kochi-mincho
  ttf-sazanami-mincho ttf-oriya-fonts ttf-telugu-fonts ttf-wqy-zenhei ca-certificates-java libnss-mdns tzdata-java
The following NEW packages will be installed:
  ca-certificates java-common libaccess-bridge-java libasound2 libcupsys2 libfreetype6 libgcrypt11 libgif4 libgnutls13 libgpg-error0 libjpeg62 liblcms1
  liblzo2-2 libopencdk10 libpng12-0 libtasn1-3 libx11-6 libx11-data libxau6 libxcb-xlib0 libxcb1 libxdmcp6 libxext6 libxi6 libxtst6 openjdk-6-jre
  openjdk-6-jre-headless openjdk-6-jre-lib rhino x11-common
0 upgraded, 30 newly installed, 0 to remove and 48 not upgraded.
Need to get 33.2MB of archives.
After this operation, 93.3MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com hardy-updates/main x11-common 1:7.3+10ubuntu10.2 [364kB]
<<<snip>>>
Fetched 33.2MB in 5min18s (104kB/s)                                                                                                                         
debconf: delaying package configuration, since apt-utils is not installed
Selecting, Unpacking, Setting up ... all successful
ldconfig deferred processing now taking place
# preparing cdroot
Parallel mksquashfs: Using 2 processors
Creating 4.0 filesystem on turnkey-core-2009.02-hardy-x86.cdroot/casper/10root.squashfs, block size 131072.
[========================================================================================================================================-] 20908/20908 100%
Exportable Squashfs 4.0 filesystem, data block size 131072
    compressed data, compressed metadata, compressed fragments
    duplicates are removed
Filesystem size 187974.69 Kbytes (183.57 Mbytes)
    44.02% of uncompressed filesystem size (427015.96 Kbytes)
Inode table size 224352 bytes (219.09 Kbytes)
    30.25% of uncompressed inode table size (741648 bytes)
Directory table size 216313 bytes (211.24 Kbytes)
    47.42% of uncompressed directory table size (456203 bytes)
Number of duplicate files found 1345
Number of inodes 22097
Number of files 18873
Number of fragments 1190
Number of symbolic links  1023
Number of device nodes 41
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 2160
Number of ids (unique uids + gids) 17
Number of uids 5
    root (0)
    man (6)
    libuuid (100)
    syslog (101)
    news (9)
Number of gids 16
    root (0)
    kmem (15)
    disk (6)
    tty (5)
    shadow (42)
    bin (2)
    fuse (104)
    utmp (43)
    ssl-cert (105)
    staff (50)
    libuuid (101)
    src (40)
    lpadmin (106)
    adm (4)
    news (9)
    mail (8)
# generating turnkey-core-2009.02-hardy-x86-patched.iso
I: -input-charset not specified, using utf-8 (detected in locale settings)
Size of boot image is 4 sectors -> No emulation
  5.06% done, estimate finish Mon Jan  4 21:35:03 2010
 10.13% done, estimate finish Mon Jan  4 21:35:03 2010
 15.18% done, estimate finish Mon Jan  4 21:35:03 2010
 20.25% done, estimate finish Mon Jan  4 21:35:03 2010
 25.30% done, estimate finish Mon Jan  4 21:35:03 2010
 30.37% done, estimate finish Mon Jan  4 21:35:03 2010
 35.42% done, estimate finish Mon Jan  4 21:35:03 2010
 40.49% done, estimate finish Mon Jan  4 21:35:05 2010
 45.54% done, estimate finish Mon Jan  4 21:35:05 2010
 50.61% done, estimate finish Mon Jan  4 21:35:04 2010
 55.66% done, estimate finish Mon Jan  4 21:35:04 2010
 60.73% done, estimate finish Mon Jan  4 21:35:04 2010
 65.78% done, estimate finish Mon Jan  4 21:35:04 2010
 70.85% done, estimate finish Mon Jan  4 21:35:04 2010
 75.90% done, estimate finish Mon Jan  4 21:35:04 2010
 80.97% done, estimate finish Mon Jan  4 21:35:04 2010
 86.02% done, estimate finish Mon Jan  4 21:35:04 2010
 91.09% done, estimate finish Mon Jan  4 21:35:04 2010
 96.15% done, estimate finish Mon Jan  4 21:35:04 2010
Total translation table size: 2048
Total rockridge attributes bytes: 1810
Total directory bytes: 4574
Path table size(bytes): 40
Max brk space used 1d000
98814 extents written (192 MB)

Then I create a VirtualBox machine with my typical defaults, booting from the virtual CD image. I wanted to install to virtual disk, but trying to boot a live system does the same thing: boot message scroll by without looking suspicious to a careful eye, then dropping into the (initramfs) prompt. I can attempt to capture boot messages, but I wanted to run this by someone first.

My patch structure is:

  • conf
  • debs/openfire_3.6.4_all.deb

Note that in the above tklpatch log, the deb tries to install before the conf is run so it does not have its prerequisites yet and doesn't install. That's fine for right now, the conf installs OpenJVM JRE (as you'll see below) Conf contains these lines:

#!/bin/bash -ex

HOSTNAME=openfire3
# set hostname
echo "$HOSTNAME" > /etc/hostname
sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts

# add Ubuntu servers to hosts, apt has trouble looking it up
echo "91.189.88.46    archive.ubuntu.com" >> /etc/hosts
echo "91.189.88.46    security.ubuntu.com" >> /etc/hosts
echo "97.107.134.22   archive.turnkeylinux.org" >> /etc/hosts

# uncomment universe and multiverse in sources.lst
sed -i "s/^# deb/deb/" /etc/apt/sources.list.d/sources.list

# update apt now that sources point to the right location
apt-get update

# install java6-jre
apt-get update
DEBIAN_FRONTEND=noninteractive
    apt-get install -y openjdk-6-jre

Any thoughts?

Liraz Siri's picture

Try patching tklpatch-chroot

I don't think we've successfully tested applying a patch from a 64bit system, so beric may be right and this is an environment issue. If you chroot from a 64bit into a 32bit system, things can get a little bit hairy.

So try patching tklpatch-chroot. Prepend "linux32" to this command:

$bin $root env -i \
    HOME=/root \
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/bin:/usr/sbin \
    DEBIAN_FRONTEND=noninteractive \
    /bin/sh -c "$command"
So it looks like this:
linux32 $bin $root env -i \
    HOME=/root \
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/bin:/usr/sbin \
    DEBIAN_FRONTEND=noninteractive \
    /bin/sh -c "$command"
If that's the problem then we should be able to fix it somehow (e.g., maybe by detecting a 64bit environment, etc.)

I eneded up running tklpach from inside tk-core 32bit chroot.

I guess the environment makes the difference. I tried from 64bit gentoo.

I think that uname -r has something to do with this problem.

anyway to use tklpatch from gentoo I do "linux32 chroot core login" after /dev/pts and /proc are mounted properly.

you can try the same approach with karmic, hope that helps.

 

 

I am experiencing a similar issue

It appears as though I am experiencing the same or a similar issue. I have been attempting to create a patch that installs a single .deb, however installation of the patched .iso halts at the (initiramfs) prompt.

I came across this thread and have tried the fix suggested here without any success. I noticed originally that there were some error messages in relation to the locale. I found another thread which suggested changing the locale to en_GB, which I did. After that I no longer received any error in relation to the locale.

I have now created a very basic patch that does little more than change the hostname in the conf file.

HOSTNAME=testhost
# set hostname
echo "$HOSTNAME" > /etc/hostname
sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts

This patch has been applied to the turnkey core. The output of that operation is:

david@david-desktop:~/dev/tklpatch$ sudo tklpatch turnkey-core-2009.10-2-hardy-x86.iso testpatch
# extracting root filesystem and isolinux from ISO
Parallel unsquashfs: Using 2 processors
21074 inodes (21402 blocks) to write

[========================================================================================================================================/] 21402/21402 100%
created 19196 files
created 2167 directories
created 1450 symlinks
created 41 devices
created 0 fifos
TKLPATCH_ISOLABEL: testpatch
# applying patch testpatch
# applying overlay testpatch/overlay
# executing config script testpatch/conf
Adding `local diversion of /sbin/initctl to /sbin/initctl.distrib'
# chroot execute: /tmp/tklpatch/conf
Removing `local diversion of /sbin/initctl to /sbin/initctl.distrib'
# preparing cdroot
Parallel mksquashfs: Using 2 processors
Creating 4.0 filesystem on turnkey-core-2009.10-2-hardy-x86.cdroot/casper/10root.squashfs, block size 131072.
[========================================================================================================================================\] 19911/19911 100%
Exportable Squashfs 4.0 filesystem, data block size 131072
	compressed data, compressed metadata, compressed fragments
	duplicates are removed
Filesystem size 104425.84 Kbytes (101.98 Mbytes)
	40.61% of uncompressed filesystem size (257125.95 Kbytes)
Inode table size 225271 bytes (219.99 Kbytes)
	29.68% of uncompressed inode table size (758965 bytes)
Directory table size 222912 bytes (217.69 Kbytes)
	46.97% of uncompressed directory table size (474605 bytes)
Number of duplicate files found 1132
Number of inodes 22854
Number of files 19196
Number of fragments 1228
Number of symbolic links  1450
Number of device nodes 41
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 2167
Number of ids (unique uids + gids) 20
Number of uids 6
	root (0)
	man (6)
	dhcp (100)
	syslog (101)
	messagebus (103)
	news (9)
Number of gids 18
	root (0)
	kmem (15)
	disk (6)
	tty (5)
	shadow (42)
	david (1000)
	bin (2)
	scanner (104)
	utmp (43)
	nvram (105)
	staff (50)
	dhcp (101)
	src (40)
	fuse (106)
	ssl-cert (107)
	adm (4)
	news (9)
	mail (8)
# generating turnkey-core-2009.10-2-hardy-x86-patched.iso
Size of boot image is 4 sectors -> No emulation
  8.77% done, estimate finish Fri Sep 24 15:05:43 2010
 17.55% done, estimate finish Fri Sep 24 15:05:43 2010
 26.30% done, estimate finish Fri Sep 24 15:05:43 2010
 35.08% done, estimate finish Fri Sep 24 15:05:43 2010
 43.83% done, estimate finish Fri Sep 24 15:05:43 2010
 52.60% done, estimate finish Fri Sep 24 15:05:43 2010
 61.35% done, estimate finish Fri Sep 24 15:05:43 2010
 70.13% done, estimate finish Fri Sep 24 15:05:43 2010
 78.88% done, estimate finish Fri Sep 24 15:05:43 2010
 87.66% done, estimate finish Fri Sep 24 15:05:43 2010
 96.42% done, estimate finish Fri Sep 24 15:05:43 2010
Total translation table size: 2048
Total rockridge attributes bytes: 1810
Total directory bytes: 4574
Path table size(bytes): 40
Max brk space used 0
57053 extents written (111 MB)

This seemingly basic patched iso still fails to install, halting in exactly the same place. I'm not sure what to do next to get this working.


Liraz Siri's picture

You'll need to run TKLPatch inside a compatible distribution

You seem to be running TKLPatch on Ubuntu Lucid, trying to patch an Ubuntu Hardy based appliance. This doesn't work because the Lucid squashfs where the appliance's root filesystem is stored is incompatible with the Hardy squashfs.

I recommend you do your TKLPatching inside a compatible TurnKey Core VM.

If you're patching one of the existing appliances, you'll want to run tklpatch inside the released TurnKey Core (based on Hardy). If you're patching the Lucid TurnKey Core Beta you'll need to run tklpatch inside Lucid TurnKey Core Beta.

Thanks

Thanks Liraz. I shall try it first thing Monday morning. And let you know how I go.

Cheers!


Jeremy's picture

Easy workaround

Is to install TKL Core to a VM (I like VirtualBox but there are others). I use SSH (via Terminal) and SFTP (via FileZilla) to work in the system. Works nicely I reckon and keeps everything separate. I have different VMs for different patches I'm working on.

[edit] Liraz beat me - but I actually missed that bit about different versions of Ubuntu being incompatable...

Good idea

I like that idea. I think I will take the same approach!

 

Cheers!


Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)