-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve debugging on lxc exec failure #373
Comments
I think the best thing we can do here, except record any future version of LXC's output, is to include a hint as part of the log? Say appending something like:
|
How about:
The internally logged message
|
Don't log the raw waitpid() result, convert it to a useful string first.
Your suggestion was blindingly obvious :) Glad I asked! The endianness issue was actually because it was logging the full wait status, I've replaced that with a neat string. All that code should eventually revert to using the subprocess package, but it's a relatively disruptive change so it's been perpetually delayed. |
- poller tests, event versioning - issue #373
I punted on including the exit status, it requires too much refactoring for now. In future we will be pulling all the process management code out into a new class of its own, so error reporting should improve by then Thanks for reporting! |
Adding configuration for USA IQSIM Device
lxc exec --mode=noninteractive
which is more widely compatible #372 patchThis was a really hard-to-debug issue - and even though the underlying issue turned out to be simple, I wonder if output can be improved to help others in future.
Here's the test case:
"gold-master" is a fresh ubuntu 16.04 container.
With mitogen commented out as shown, it works. With mitogen uncommented, it aborts like this:
Running with
MITOGEN_ROUTER_DEBUG=1
showsRunning with strace on top of that shows little more, but narrows it down to
lxc exec ...
terminating with exit code 255.The real clue is buried in
/var/log/lxd/gold-master/lxc.log
:And indeed it turns out I can reproduce this at the command line:
Sadly,
lxc exec
just aborts with 255 and no error message at all, if the target command does not exist.The reason that started all this is that I have been using ansible to prepare containers, and I have been using ansible's "raw" module to install python2 in the container, before continuing with real ansible commands:
This works with normal ansible, but fails with mitogen because mitogen depends on python already being installed in the container, even for "raw" actions. Of course it's obvious when you think about it.
I think this uncovers several issues.
It would be really helpful if mitogen could generate some output when 'lxc exec' fails - even if it just said
lxc exec failed with exit code 255, there may be more information in /var/log/lxd/<container>/lxc.log
lxc exec
itself is arguably broken by not generating any output on stderr, and returning an invalid exit code (should be 0 to 127; 128+ indicates that the process terminated with a signal). I'll raise that separately with lxd project. Iflxc exec
did generate stderr output, it should be passed through.Obviously I still have my underlying issue with bootstrapping containers. Probably the best long-term solution would be to use
ansible_python_interpreter=/usr/bin/python3
, since the container already has python3, as long as mitogen supports python3 (which I believe it does). Otherwise I should be able to disable mitogen while bootstrapping:The text was updated successfully, but these errors were encountered: