TurnKey Linux Virtual Appliance Library

Problems with TKLPatch Ubuntu Lucid

Hi guys, I'm starting to work with TKLPatch, in an Ubuntu Lucid VM. I copied the iso inside the VM and did the following commands:

 

tklpatch-extract-iso turnkey-core-beta-lucid-x86.iso
tklpatch-chroot turnkey-core-beta-lucid-x86.rootfs/ apt-get update
But it seems that inside the rootfs of the extracted iso I can't get connection. I fix the issue "by hand" writing to /etc/resolv.conf to continue testing but then I'm stuck being unable to install mysql-server. 
 
The errors I'm getting are the following during package instalation:
 

Unpacking mysql-server-5.1 (from .../mysql-server-5.1_5.1.41-3ubuntu12.3_i386.deb) ...
df: Warning: cannot read table of mounted file systems: No such file or directory
 
Setting up mysql-server-5.1 (5.1.41-3ubuntu12.3) ...
status: Unknown job: mysql
start: Unknown job: mysql
 
root@core ~# service mysql status
status: Unknown job: mysql
root@core ~# service mysql start 
start: Unknown job: mysql
 
Any help will be appreciated. Thanks. The complete transcript of the session can be found at 
 

Does this have anything to do

Does your first issue have anything to do with the networking errors other people have reported on the new beta?  See http://www.turnkeylinux.org/blog/core-lucid-beta#comment-3182

Not exactly

I do have the problem mentioned on the refered post, not getting nameservers on first boot, and having to hit DHCP option in confconsole to resolve the problem. But once its solved, the VM has internet, I can ping and wget from console. It's just when I chroot to the extracted iso filesystem that I'm getting this error. 

The mysql error is stranger than the first. Has anybody had this issue? 

Liraz Siri's picture

Argh! Upstart services cannot be run in a chroot

I'm managed to reproduce the problem on my end and investigate what is going on. It turns out that in Lucid, a few server services including mysql have been converted to use upstart instead of sysvinit.

Unfortunately, upstart doesn't support chroots. This is a regression. Previously it was possible to start services inside a chroot environment, but not any more:

https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/430224

I'm looking for a workaround.

:(

This will delay the production of new turkeys based on 10.04 :( I already have my first patch ready to test. I hope there's a workaround for this. 

Liraz Siri's picture

Don't worry, I'll release the workaround today

It's really not that bad. All we have to do is start mysql ourselves inside the chroot, rather than ask upstart to do it for us. I'm testing a generic method that will hopefully work in tklpatch in all distributions. More to follow.
Liraz Siri's picture

New version of TKLPatch released

I pushed my changes to GitHub. Alon is updating the archive as we speak so you'll be able to update to the newest version of tklpatch by doing this:

apt-get update
apt-get install tklpatch

Changes:

  1. fixed resolv.conf handling in tklpatch-chroot (so you don't have to do this manually)
  2. add (tklpatch) to chroot shell prompt. That way you always know you're in the chroot shell.
  3. fixed TERM support in tklpatch-chroot. Now any program that needs a terminal will work (e.g., screen, less, vim). This also adds color to ls and grep.
  4. temporarily labotomize upstart to allow mysql service to start and stop normally inside chroot. It's a hack, but if we need we can extend this approach to other services as well.

Other server services which are known to use upstart in Lucid are samba, vsftpd, squid. But I think for tklpatch we only need the ability to start mysql within the chroot (e.g., to manipulate the databases).

Jeremy's picture

Geez you guys are clever :)

Nice work!

Liraz Siri's picture

Thank Adrian... :)

If he hadn't found that problem I wouldn't have had nearly as much fun today finding a solution!

Thanks!

I'll get it right now to test it and hopefully finish my first tklpatch :)

Everything went fine, only a little detail

Liraz, thanks for the update, everything worked as expected. But the final image gets (tklpatch) on the shell prompt. It's the only issue I found. I'm leaving tonight the final test of the patch running and tomorrow if everything went ok I'll publish it. 

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)