<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Except for the part where a coredump for an unknown binary is useless.</blockquote><div><br></div><div>If I have a service that crashes in a container. I'd like to get back into the container and inspect why. Simply throwing out unknown binary crashes doesn't exactly seem like a stellar decision to me. And unknown binary to whom?. It may not be known in the ubuntu/debian repos - that doesn't mean the devs don't have debug symbols, and reproducible binary builds which they can corelate with in post-mortem circumstances with or without the actual environment. In fact, I'd presume that's true in 100% of container usages. So, I'm not entirely sure what you're talking about in terms of a small user base.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">That's why our current setup is to forward the crash to the containers<br>when the containers are detected to know how to handle coredumps and<br>otherwise throw them out as they're not going to be of any use.</blockquote><div><br></div><div>This raises all the alarms for me, and is the biggest problem I have with apport as the default. Debian simply dumps to a 'core' file. RHEL/Fedora/CentOS does either that, or handles it with systemd-coredump which ends up with a dump in "/var/lib/systemd/coredump". Apport cannot auto report. But throwing out the whole dump is just plain wrong to me. By what I'm proposing everyone's happy. Any of the potential solutions I state, leaves the dump intact, and apport can just sit on top of it, and analyse the files and throw dumps that it handles away, or even just become a pure reporter instead of handling the dumps on its own.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 6, 2019 at 4:02 AM Stéphane Graber <<a href="mailto:stgraber@ubuntu.com">stgraber@ubuntu.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Feb 06, 2019 at 03:35:23AM +0530, Prasanna V. Loganathar wrote:<br>
> ><br>
> > You need to have apport itself installed in the container, I suspect<br>
> > that the Docker containers do not have it.<br>
> <br>
> <br>
> This will make no difference. Doing an `apt update && apt install -y<br>
> apport` will not do any good, as apport is set to disable itself on<br>
> containers.<br>
<br>
And indeed Docker doesn't even have an init system running so that'd be<br>
pretty useless as the apport forwarding service wouldn't work.<br>
<br>
> > Having the dump handled by apport on the host would be useless as the<br>
> > host doesn't know what binary was used to produce the dump (and so can't<br>
> > be used with retracers) nor can it capture any of the crash environment<br>
> > information as the relevant data is in the container, not in the host.<br>
> ><br>
> <br>
> Precisely my point. But this is not a problem with systemd-coredump, as it<br>
> simply just manages the dumps. Doesn't need retracing. All<br>
> RHEL/Fedora/CentOS based distros work without any modifications, as<br>
> expected. With containers everywhere, I think it's reconsidering the<br>
> default and unifying things around system-coredump effort simplifies things<br>
> for everyone. coredumpctl is also much nicer to work with. apport should<br>
> easily be able to just watch over the dumps and do it's reporting on<br>
> desktop systems from there.<br>
<br>
Except for the part where a coredump for an unknown binary is useless.<br>
<br>
So having all the dumps centralized on the host when you don't know what<br>
container it came from and may no longer have any of the environment<br>
information is completely useless.<br>
<br>
That's why our current setup is to forward the crash to the containers<br>
when the containers are detected to know how to handle coredumps and<br>
otherwise throw them out as they're not going to be of any use.<br>
<br>
<br>
For people who are actively debugging a container that's getting crashes<br>
and know what binary to use with the dumped core file, it's not a huge<br>
deal to change the core dump handler (stopping the apport service will<br>
even do that for you).<br>
<br>
Those people make for a fraction of a percent of Ubuntu's userbase,<br>
everyone else strongly benefits from crash reports being handed over to<br>
apport where extra data is captured and the resulting crashes can be<br>
send to <a href="http://errors.ubuntu.com" rel="noreferrer" target="_blank">errors.ubuntu.com</a> for retracing and aggregation.<br>
<br>
<br>
> On Wed, Feb 6, 2019 at 3:22 AM Stéphane Graber <<a href="mailto:stgraber@ubuntu.com" target="_blank">stgraber@ubuntu.com</a>> wrote:<br>
> <br>
> > On Wed, Feb 06, 2019 at 03:05:20AM +0530, Prasanna V. Loganathar wrote:<br>
> > > Hi Stephane,<br>
> > ><br>
> > > Ah. I had overlooked this one. It does work well in lxc. Thanks for<br>
> > > pointing that out.<br>
> > > However, apport's default is to do nothing in containers.<br>
> > ><br>
> > > docker run --name testbox --rm -it ubuntu bash<br>
> > > > sleep 10 & kill -ABRT $(pgrep sleep)<br>
> > ><br>
> > > This has no /var/crash directory. There are no dumps. Doesn't help<br>
> > > with "--ulimit core=x:x" to docker option either.<br>
> ><br>
> > You need to have apport itself installed in the container, I suspect<br>
> > that the Docker containers do not have it.<br>
> ><br>
> > Having the dump handled by apport on the host would be useless as the<br>
> > host doesn't know what binary was used to produce the dump (and so can't<br>
> > be used with retracers) nor can it capture any of the crash environment<br>
> > information as the relevant data is in the container, not in the host.<br>
> ><br>
> > ><br>
> > > On Tue, Feb 5, 2019 at 10:32 PM Stéphane Graber <<a href="mailto:stgraber@ubuntu.com" target="_blank">stgraber@ubuntu.com</a>><br>
> > wrote:<br>
> > > ><br>
> > > > On Tue, Feb 05, 2019 at 06:36:48AM +0530, Prasanna V. Loganathar wrote:<br>
> > > > > Hi Stephane,<br>
> > > > ><br>
> > > > > Thanks for the reply. Please correct me if I'm wrong.<br>
> > > > ><br>
> > > > > lxc launch ubuntu:18:04 testbox<br>
> > > > > lxc exec testbox bash<br>
> > > > > sleep 100 & kill -ABRT $(pgrep sleep)<br>
> > > ><br>
> > > > stgraber@castiana:~$ lxc launch ubuntu:18.04 testbox<br>
> > > > Creating testbox<br>
> > > > Starting testbox<br>
> > > > stgraber@castiana:~$ lxc exec testbox bash<br>
> > > > root@testbox:~# sleep 10 &<br>
> > > > [1] 303<br>
> > > > root@testbox:~# kill -ABRT 303<br>
> > > > root@testbox:~#<br>
> > > > [1]+  Aborted                 (core dumped) sleep 10<br>
> > > > root@testbox:~# ls -lh /var/crash<br>
> > > > total 512<br>
> > > > -rw-r----- 1 root root 34K Feb  5 17:02 _bin_sleep.0.crash<br>
> > > > root@testbox:~#<br>
> > > ><br>
> > > > > There's no crash dump anywhere.<br>
> > > > ><br>
> > > > > /var/crash is empty. No `core` file, etc. The default is<br>
> > > > > crashes just vaporises itself - that's my biggest concern. While, for<br>
> > > > > instance on a debian - you can rely on a 'core' file, or on<br>
> > > > > CentOS/RHEL, you can always rely on a systemd-coredump<br>
> > infrastructure,<br>
> > > > > and addressed so nicely by the coredumpctl command.<br>
> > > > ><br>
> > > > > With systemd being the init, and coredumpctl being very well<br>
> > > > > architectured to manage this, I just don't see why Ubuntu shouldn't<br>
> > > > > make use of that and have apport only do what it does best - which is<br>
> > > > > primarily reporting.<br>
> > > > ><br>
> > > > ><br>
> > > > ><br>
> > > > > On Tue, Feb 5, 2019 at 1:57 AM Stéphane Graber <<a href="mailto:stgraber@ubuntu.com" target="_blank">stgraber@ubuntu.com</a>><br>
> > wrote:<br>
> > > > > ><br>
> > > > > > On Sat, Feb 02, 2019 at 03:34:22AM +0530, Prasanna V. Loganathar<br>
> > wrote:<br>
> > > > > > > Hi folks,<br>
> > > > > > ><br>
> > > > > > > Currently, `$ sysctl kernel.core_pattern` gives<br>
> > > > > > > `kernel.core_pattern = |/usr/share/apport/apport %p %s %c %d %P`<br>
> > > > > > ><br>
> > > > > > > This is usually fine, however, when run from containers or lxc<br>
> > this<br>
> > > > > > > will just error out, with no core dump being produced, due to it<br>
> > being<br>
> > > > > > > disabled. Adding to the problem: with container or lxc, you<br>
> > can't just<br>
> > > > > > > change it per container, and should be changed on the host. And<br>
> > it's<br>
> > > > > > > not reasonable to expect apport in all containers either. Since,<br>
> > this<br>
> > > > > > > is a common problem, I think it's important to consider a change<br>
> > in<br>
> > > > > > > the default handling.<br>
> > > > > > ><br>
> > > > > > > There are multiple options to deal with this:<br>
> > > > > > ><br>
> > > > > > > 1. Drop apport as default core_pattern handler and switch to a<br>
> > simple<br>
> > > > > > > file in either /var/crash (this requires creating /var/crash as<br>
> > a part<br>
> > > > > > > of the installation as it's currently created by apport), or<br>
> > /tmp and<br>
> > > > > > > let apport handle the core dump after the fact, and report it.<br>
> > > > > > ><br>
> > > > > > > 2. Switch to systemd-coredump, and default to it, since it<br>
> > already<br>
> > > > > > > does this very well and provides "coredumpctl" which is much<br>
> > nicer to<br>
> > > > > > > work with. systemd-coredump also is a part of the systemd suite<br>
> > of<br>
> > > > > > > utils and doesn't pull in a larger dependency as apport -- which<br>
> > to<br>
> > > > > > > date, isn't as robust (I still have "core" files being left all<br>
> > over<br>
> > > > > > > the place due to the fact that apport reset's itself and crashes<br>
> > > > > > > during startup aren't handled properly). This also has a nice<br>
> > > > > > > advantage of unifying the OSS community in terms of coredump<br>
> > handler.<br>
> > > > > > > apport can handle things from the core dumps that systemd<br>
> > generates,<br>
> > > > > > > further on desktops.<br>
> > > > > > ><br>
> > > > > > > 3. Employ a tiny helper script, as the default core dump handler,<br>
> > > > > > > which looks for specified programs such as "apport", "abrt",<br>
> > > > > > > systemd-coredump" and pipes to them, or pipes it to /var/crash,<br>
> > or<br>
> > > > > > > /tmp during it's absence. This does have the disadvantage of<br>
> > growing<br>
> > > > > > > with it's own config, rather quickly.<br>
> > > > > > ><br>
> > > > > > > That being said, I highly suggest option 2 be used in the<br>
> > upcoming<br>
> > > > > > > versions, and apport be a layer sitting on top of the coredumps<br>
> > > > > > > generated by systemd-coredumps by either hooking into it, or by<br>
> > > > > > > watching it's folders.<br>
> > > > > > ><br>
> > > > > > > I've also filed this as a bug here:<br>
> > > > > > > <a href="https://bugs.launchpad.net/ubuntu/+bug/1813403" rel="noreferrer" target="_blank">https://bugs.launchpad.net/ubuntu/+bug/1813403</a><br>
> > > > > ><br>
> > > > > > Are you aware that apport is aware of containers (LXC & LXD) and<br>
> > will<br>
> > > > > > just forward your crash to apport inside the container?<br>
> > > > > ><br>
> > > > > > That actually tends to be a better way to handle things that<br>
> > > > > > centralizing all crashes on the host as monitoring tools running<br>
> > inside<br>
> > > > > > the containers will operate as normal, reporting on the presence<br>
> > of a<br>
> > > > > > crash file, as well, sending the bug report to Launchpad will then<br>
> > work<br>
> > > > > > properly, capturing the details from the container rather than<br>
> > > > > > confusingly mixing package details of the host with a crash that<br>
> > may<br>
> > > > > > have come from a completely different release.<br>
> > > > > ><br>
> > > > > > There's obviously nothing wrong with someone opting out of apport<br>
> > and<br>
> > > > > > switching to whatever core dump handler they want, but for Ubuntu,<br>
> > > > > > apport has much better integration with the distribution, has<br>
> > hooks in<br>
> > > > > > many packages and was designed with proper container support.<br>
> > > > > ><br>
> > > > > > --<br>
> > > > > > Stéphane Graber<br>
> > > > > > Ubuntu developer<br>
> > > > > > <a href="http://www.ubuntu.com" rel="noreferrer" target="_blank">http://www.ubuntu.com</a><br>
> > > ><br>
> > > > --<br>
> > > > Stéphane Graber<br>
> > > > Ubuntu developer<br>
> > > > <a href="http://www.ubuntu.com" rel="noreferrer" target="_blank">http://www.ubuntu.com</a><br>
> ><br>
> > --<br>
> > Stéphane Graber<br>
> > Ubuntu developer<br>
> > <a href="http://www.ubuntu.com" rel="noreferrer" target="_blank">http://www.ubuntu.com</a><br>
> ><br>
<br>
-- <br>
Stéphane Graber<br>
Ubuntu developer<br>
<a href="http://www.ubuntu.com" rel="noreferrer" target="_blank">http://www.ubuntu.com</a><br>
</blockquote></div>