Sergio_L's picture

I am having trouble installing Turnkey based containers on debian stretch, here's what I did:

Installed debian minimal, installed lxc and bridge utils, set up a simple bridge and changed /etc/lxc/default.conf accordingly, so I can now create containers like the example "lxc-create -n <name> -t debian -- -r stretch" and everythig works just fine.

Then downloaded the turnkey template:

wget -O /usr/share/lxc/templates/lxc-turnkey "https://raw.githubusercontent.com/turnkeylinux-apps/lxc/master/overlay/usr/share/lxc/templates/lxc-turnkey"

Fixed permissions:

chmod 755 /usr/share/lxc/templates/lxc-turnkey

And tried to create a new container based on the turnket documentation:

cat > /root/wp1.conf <<EOF
export ROOT_PASS=secretrootpass
export DB_PASS=secretmysqlpass
export APP_PASS=secretadminwppass
export APP_EMAIL=admin@example.com
export APP_DOMAIN=www.example.com
export HUB_APIKEY=SKIP
export SEC_ALERTS=SKIP
export SEC_UPDATES=FORCE
EOF

Then:

lxc-create -n wp1 -t turnkey -- wordpress -i /root/wp1.conf

Returns this message:

/usr/share/lxc/templates/lxc-turnkey: línea 675: version_resolver: no se encontró la orden

FATAL [lxc-turnkey]: version not specified

lxc-create: lxccontainer.c: create_run_template: 1297 container creation template for wp1 failed

lxc-create: tools/lxc_create.c: main: 318 Error creating container wp1

I have tried:

lxc-create -n wp1 -t turnkey -- wordpress -v 16.0 -i /root/wp1.conf

lxc-create -n wp1 -t turnkey -- wordpress -v 15.3 -i /root/wp1.conf

lxc-create -n wp1 -t turnkey -- wordpress -i /root/wp1.conf -v 16.0

lxc-create -n wp1 -t turnkey -- wordpress -i /root/wp1.conf -v 15.3

With no success, I got the feeling I was just shooting blind here so I installed strace, and run it again:

strace -f lxc-create -n wp1 -t turnkey -- wordpress -i /root/wp1.conf 2>&1 | tee /root/lxc_strace.log

But honestly I coulnd't get much from such log, I don't know enough to notice what is an actuall error or an expected output, also tried get a similar log of the creation of a "normal" container but this last one was over 250000 lines, so, yeah, I'd like to have a life other than reading logs I can't understand...

Maybe someone here can point me in the right direction to get this working?

And while I could in a normal case just install Turnkey LXC, I am dealing with a project using a specific hardware and I can't get any Turnkey to install or even boot on it, not even Turnkey Core, but debian works, so I though this could be a good idea, and an oportunity to learn more about LXC.

Thank you all for your time.

Forum: 
Jeremy Davis's picture

You note that you are having troubles with some specific hardware?! Could you please elaborate on what is happening? When you say Debian boots ok, are you using the default Debian or the "unofficial" one that include "non-free" software by default? My initial guess there is some specific driver missing? Or perhaps it's something to do with UEFI boot? Currently TurnKey doesn't support UEFI boot (or secure boot; but I don't think that vanilla Debian Stretch supported it either).

FWIW most hardware I have encountered has an option to disable UEFI and/or enable "legacy" boot (so it's like a legacy BIOS hardware intialisation). You also note that Core wouldn't work either. Did you try the newer v16.0 release? Or was it the old v15.x release? If it wasn't v16.0 could you please try that? Also out of interest, if it still doesn't work, does it fail in the same way as v15.x? If Core v16.0 works ok, then please let me know and I can work to prioritise update of the v16.0 LXC appliance.

It's perhaps also worth noting, that whilst we aim to provide host agnostic LXC templates, they are primarily targeted to run on Proxmox VE (which is also based on Debian). Personally that's what I run all my TurnKey templates on. It's an awesome system that provides KVM and well as LXC and has powerful web based UI and even more power CLI (and API).

Whilst ideally our TurnKey LXC templates should run on any LXC server, we do not provide guarantees on that and I have zero experience using anything other than Proxmox or our LXC appliance. Regarding the LXC "template" script which is provided as a part of our LXC host appliance (i.e. the one that you are downloading), it's not designed as a "stand alone" script. It's designed as part of the TurnKey appliance. So to get it working, you may well need to do more work providing the environment that the script is expecting.

Regardless, I imagine that if you manually download the desired LXC template(s) from the mirror first. Then it should be possible to just launch them?! Although TBH, I'm not sure exactly how you do that. As I said, I have no real experience using vanilla LXC. Also, you will most likely need to manually initialise the containers (i.e. pre-seeding may not work).

If you want to press ahead with what you are doing at the moment, then it should be possible. TurnKey is essentially Debian under the hood anyway...

First up, the error that jumps out at me is: "version_resolver: no se encontró la orden". I'm an English only monoglot but online translation tools tell me that essentially essentially means: "version_resolver: command not found"! So at least the initial issue you are hitting is that you don't have the 'version_resolver' script. Downloading that, ensuring it's somewhere in your path (we use /usr/local/bin by default) and making it executable might get you a little closer?! Although there may be more things you need to get it working properly...

Sergio_L's picture

I'll try to answer all your questions, I am using the most "official" debian stretch I could find (https://www.debian.org/releases/stretch/debian-installer/debian-9.12.0-amd64-netinst.iso) the hardware is a collection of old mini pcs with atom processors, they are 64 bits but do not support VT-X, the idea is to deplooy them as a cheap/lightweight local servers with a few functions, like vpn, file server and stuff like that, for a maximum of 5 users each (this is for very small, almost family "companies" in a third world country durin a pandemic, so budget is minimal, and there are no other options), the machines are old, so no UEFI, if you want I can put another post with the installation problem, but I don't think is worth the hassle, with my limited knowledge of linux, troubleshooting that could en up in a nightmare...

While I understand there's no guarantee turnkey templates should work in any other plattaform other than Turnkey LXC, I got my hopes up after reading https://www.turnkeylinux.org/blog/announcing-turnkey-lxc ("and should be usable on any Linux distribution that supports LXC") so I tried doing that and tried it on stretch since is the same you use in the last Turnkey LXC.

Regarding "to get it working, you may well need to do more work providing the environment" I figured that much, I though maybe I'd get error messages I can google and work from there, and I got as far as "I no longer know what to do with that log, way over my head" so coming here was my next bet.

Now I think it was a great idea (posting here), since I did not notice that "version_resolver" was a script, I'll try downloading that, see what happens, and report later!

Thank you again! 

 

Jeremy Davis's picture

Hmmm, ok, well I have no idea why TurnKey isn't booting?!

It sounds like you are using the "official" Debian ISO, so it seems unlikely to be a driver related issue. We should be supplying the same "free" drivers that the default Debian one does.

If they're older hardware, then as you note, UEFI doesn't seem a likely cause either?!

So in my mind it should "just work"!? My only other thought is how you are preparing the install. I.e. I assume that you are "burning" the ISO to a USB stick? If so, how are you doing that? I've only tested doing it using the Linux commandline tool "dd" (which exactly writes the contents of ISO to the USB at the block level - apparently it has been ported ot Windows too, but I'm not sure). I have heard that some UI tools (IIRC UNetbootin is one that causes issues) won't work. I think Rufus may be a good one?! Although TBH I have no idea really...

In theory, anything that works for Debian, should also work for TurnKey. However, our v15.x (and earlier) used a custom live boot mechanism (we ported it from Ubuntu years ago and have been maintaining it ourselves). So there may be scenarios where TurnKey may not work where Debian does. As of the new v16.0, we've rebased on default Debian tools. So hopefully issues will be less likely.

If you can be bothered, I would still be interested in trying to understand what the issue might be, but I'll answer your other post in the hope of assisting you in your other pathway.

Sergio_L's picture

Downloaded cersion_resolver, made it executable, no luck, here's the error:

Traceback (most recent call last):
  File "/usr/local/bin/version_resolver", line 8, in <module>
    import requests
ImportError: No module named requests
FATAL [lxc-turnkey]: version not specified
lxc-create: lxccontainer.c: create_run_template: 1297 container creation template for wp1 failed
lxc-create: tools/lxc_create.c: main: 318 Error creating container wp1

Thinking about your last respose, if you have an idea (or is documented somewhere) what scripts/files Turnkey LXC hace that plain LXC doesn´t, I can just copy them all from a working Turnkey LXC (already did that with everything on /usr/local/bin/), other than that, I can only think awful things to try (like frankestain my debian dumping all files from Turnkey LXC on top, but that, even if it works, sounds like a terrible idea).

 
Jeremy Davis's picture

So I'll answer the specific things I can see here, and then move on to the more general question.

The error you are getting re "requests" is another missing dependency. The 'version_resolver' script is a python (2) script, so you'll need to install the python2 version of requests. The easiest way to do that is via the Debian package management system:

apt install python-requests

(Alternatively, you could have installed via the python package manager; pip - but we tend to prefer the Debian packages where available).

All the files that are needed to create the TurnKey LXC host appliance are within the buildcode repo (where you're downloading the "template" script, as well as the "version_resolver" script.

To fully understand how the buildcode works, I would encourage you to read though the TKLDev docs. (Note that some specifics need updating, but the general gist of them remains). To save you a bit of reading, I'll point out the 3 main components (in the context of what you're up to with the LXC appliance - there are other important components, but they don't apply in this instance):

  • conf.d/main - the only conf script in the LXC appliance. This script runs within the build chroot. In theory it could be run within your LXC server; although I'm not 100% whether that is a good idea... It's probably better to look through it and only apply the bits that you understand and/or make sense.
  • overlay/ - overlay files. The contents of this directory are relative to / (e.g. the contents of overlay/etc/ end up in /etc/). Mostly these are config files and/or scripts intended to be within the filesystem of the finished appliance. Again, it's probably not a good idea to blindly just copy them all.
  • plan/main - the "plan" is a list of Debian packages to be installed (they are all provided either by Debian or TurnKey apt repos). Note that it includes "python-requests"! :)

I hope that helps.

Sergio_L's picture

That was some gold you gave me there, I made a script to install everything in plan/main, and download everything in /overlay, and change the bits I want (like /etc/lxc/default.conf from natbridge to bridge), I did nothing after reading conf.d/main because I saw nothing relevant to my case there (so far at least) and I think I got a step forward, because when I run:

lxc-create -n wp1 -t turnkey -- wordpress -i /root/wp1.conf

I get:

FATAL [lxc-turnkey]: turnkey version 16.0-buster is not recognized:
lxc-create: lxccontainer.c: create_run_template: 1297 container creation template for wp1 failed
lxc-create: tools/lxc_create.c: main: 318 Error creating container wp1

So after your previous comment I thought "create_run_template must be a script missing I overlooked" so I went ahead and search for it on github, but there is no such file anywhere there.

Thus I think I am a few steps closer, but not yet there, and like before, I have no other place to go to bother people with this...

This "pet project" of mine is proving trickier than I anticipated....

 
Sergio_L's picture

So I started tinkering with the -v option, since the error keeps bringing that up, eventually I run:

lxc-create -n wp1 -t turnkey -- wordpress -i /root/wp1.conf -v 15.3-stretch

And I got a gpg error, a step forward non the less, after some googling I found I´m missing the turnkey.gpg file, so I added to my script:

wget -O /etc/apt/trusted.gpg.d/turnkey.gpg "https://github.com/turnkeylinux/turnkey-keyring/raw/master/turnkey-relea...

Run lxc-create again (now I can use the -f /etc/lxc/bridge.conf) and now:

"INFO [lxc-turnkey]: successfully completed creating container ncloud."

I tried installing a few more containers just to be sure, and everything works! At least in my testing VM, I'll repeat the experiment in another vm, then in hardware, ideally should be installing debian, run my script, and start using Turnkey containers right away, I'll make sure to report back, maybe some day this could help another lost soul like me.

One final question tho, to make it work, I must use "-v", I could use some guide to figure this out, since it only works with "-v 15.x-stretch" but it does not with "-v 16.0-buster", I get:

FATAL [lxc-turnkey]: turnkey version 16.0-buster is not recognized

figuring out the available "-v" options would be great cause I could use the lastest version of each one.

Add new comment