TurnKey Linux Virtual Appliance Library

Problems testing tklpatch

turnkey_1972's picture

Has anyone had success developing a patch? I am using a TKL Core VM to develop the patch and whenever I chroot or try running tklpatch on an iso, it fails because it can't resolve the ubuntu repositories.

I get errors like this when executing 'apt-get update':

Err http://archive.ubuntu.com hardy-security Release.gpg
  Could not resolve 'archive.ubuntu.com'

Has anyone else run into this problem? I was following the drupal5 example and I did not see any code to initialize an internet connection before using apt-get, which leads me to believe it should work without me doing anything.

If I can get it working, I'd like to publish a tklpatch of TKL OpenVPN later tonight.

Note: I still can't figure out how to configure openvpn properly, but the server does seem to start so I'm blaming it on me misconfiguring it. I hope someone will be willing to test it once it's released.


Edit: So far even with the update to tklpatch, I still have a DNS issue. I am going to upload two files, the first is an unmodified patch, the second is an attempt at fixing the dns issue (remove overlay from the file name before use).

This patch needs to be applied to TKL Core and it will install openvpn and the webmin-openvpn module.

Neil Aggarwal's picture

That is a DNS problem

The Count not resolve 'archive.ubuntu.com' problem means your DNS is not working.

Check your DNS configuration and that you can resolve names correctly.

Stas Grishin's picture

My DNS works

I can ping various domain names. I can even ping and resolve from within the TKL Core virtual machine which I use to test the patch since my regular system is windows. However, once I chroot into the rootfs of the extracted iso, or if I try to apply the patch to the iso using tklpatch, it does not resolve. I would understand if I had to do something special when chrooting, but I beleive that tklpatch is supposed to "just work" when I apply a patch to the iso directly since I didn't see anything talking about this in the doc.

I don't know why, by basically DNS and internet works up until the point that I chroot and I think tklpatch might chroot internally also. Could it be a problem with my setup somehow? I am on a windows xp machine and use TKL Core in virtualbox. My router and dsl modem both are working without any problems right now.

Maybe I should release the patch file in the general forum and see if it works for someone else?

Liraz Siri's picture

The chrooted filesystem has its own DNS resolver

So even if you can resolve hostnames out of the chroot that doesn't mean it will work inside the chroot. Maybe what we should do is have tklpatch automatically add Google's public DNS servers (at least temporarily) to the chroot's resolv.conf:
cat > /etc/resolv.conf << EOF
It seems you're not the first person to come across this issue. Maybe we should regard this as a bug.
Stas Grishin's picture

That solves it

Thanks Liraz, that seemed to solve it. I will have my patch insert the Google DNS servers for now.

Stas Grishin's picture

I'm stuck

When I chroot manually and add the Google servers to resolv.conf, it works. If I run 'tklpatch file.iso patch.tar.gz' it still has problems. I tried both adding the nameservers through script and including a resolv.conf file in /overlay/etc/

I was thinking, something that might help the developers since some packages make more sense to install with apt-get, have a 4th file that we can put a list of packages to install. Small stuff makes sense to put in /deb, but some stuff would be nice to have a 4th file instead of having to write our own code and having the DNS issue.

Any advice about what I should do? Upload what I have so far? Wait for a fix?

Liraz Siri's picture

Upload the patch

I don't understand why editing resolv.conf from inside your patch failed. It should have worked...

So how about you upload your patch and We'll test it inside TurnKey Core. Once we can reproduce the issue it'll be easier to fix it. Note that you can upload your patch by editing the post and then adding a file to it.

Liraz Siri's picture

New version of tklpatch improves usability, fixes DNS issue

I just patched tklpatch to solve the DNS issue and pushed the update to GitHub. In a TurnKey Core VM I tested that everything works like this:

tklpatch-example helloworld
tklpatch turnkey-core.iso helloworld

I also updated the overview docs on the web site and improved usability a bit by making clean-ups more robust.

Stas Grishin's picture


Please see the edit and attached files in the first post.

Stas Grishin's picture

Good news

I decided to try this again and realized that tklpatch on github was updated, but the one in the repository was the version with the dns issue. I'm publishing the patch to the general forum since I noticed the attached files here were corrupted.

Can someone test this and let me know how it goes? I am still having trouble configuring openvpn the way I want it, but yesterday I was able to get a tunnel connection.



Alon Swartz's picture

Updated the package repository with new version of tklpatch

I just updated the package repository with new version of tklpatch, sorry about that.

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)