Merge lp:~vorlon/lxc-android-config/apport-job-cleanup into lp:lxc-android-config

Proposed by Steve Langasek
Status: Needs review
Proposed branch: lp:~vorlon/lxc-android-config/apport-job-cleanup
Merge into: lp:lxc-android-config
Diff against target: 161 lines (+23/-101)
5 files modified
debian/changelog (+8/-0)
debian/lxc-android-config.maintscript (+2/-0)
etc/init/apport-config.conf (+13/-10)
etc/init/apport-reconfig.conf (+0/-33)
etc/init/apport.override (+0/-58)
To merge this branch: bzr merge lp:~vorlon/lxc-android-config/apport-job-cleanup
Reviewer Review Type Date Requested Status
Ken VanDine Needs Fixing
Review via email: mp+285016@code.launchpad.net

This proposal supersedes a proposal from 2015-10-15.

Commit message

Rework and simplify the apport overrides. Instead of adding two new upstart
jobs and an override for apport.conf, we can achieve everything we need to
with a single new apport job.

This leaves outstanding the issue that switching a device between channels
from the commandline will not cause the config to be correctly switched.

Description of the change

Rework and simplify the apport overrides. Instead of adding two new upstart
jobs and an override for apport.conf, we can achieve everything we need to
with a single new apport job.

This leaves outstanding the issue that switching a device between channels
from the commandline will not cause the config to be correctly switched.

Verified to work correctly on a stock Ubuntu 14.04 desktop system; will need
validating against the phone images also.

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote : Posted in a previous version of this proposal

This no longer merges cleanly, please update the branch

review: Needs Fixing
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks great and works well

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

QA failed this during landing. It seems to do the right thing at boot, but when toggling it via system-settings it no longer sets the core_pattern. It must not be starting and stopping the apport job on FILE=/var/lib/apport/autoreport

Not sure why though... but it does regress

review: Needs Fixing
Revision history for this message
Brian Murray (brian-murray) wrote :

It looks like there is an EVENT missing for the file watch, could that be the cause of the problem?

Revision history for this message
Ken VanDine (ken-vandine) wrote :

> It looks like there is an EVENT missing for the file watch, could that be the
> cause of the problem?

Oh, yeah I bet that's it, good catch. It needs the start on EVENT=create and stop on EVENT=delete.

Revision history for this message
Steve Langasek (vorlon) wrote :

On Fri, Feb 26, 2016 at 01:56:32PM -0000, Ken VanDine wrote:
> > It looks like there is an EVENT missing for the file watch, could that be the
> > cause of the problem?

> Oh, yeah I bet that's it, good catch. It needs the start on EVENT=create
> and stop on EVENT=delete.

FWIW I hadn't replied yet because I haven't had time to investigate for
sure, but I don't think this is the case. The EVENT= env var declaration
makes the match more specific; a match which does not include the EVENT=
should match a 'file' event with /any/ value of EVENT (or none at all).

Unmerged revisions

14. By Steve Langasek

Merge from trunk

13. By Steve Langasek

Further refinement: no apport override needed at all, do everything in the apport-config helper job

12. By Steve Langasek

rm -f is always polite

11. By Steve Langasek

Further reduction of the apport override

10. By Steve Langasek

Simplify apport handling, to avoid duplication of the main apport.conf
where avoidable and to simplify the event start model (avoiding possible
deadlocks).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-11-12 12:52:17 +0000
3+++ debian/changelog 2016-02-04 07:06:39 +0000
4@@ -1,3 +1,11 @@
5+lxc-android-config (0.230+16.04.20151112-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * Simplify apport handling, to avoid duplication of the main apport.conf
8+ where avoidable and to simplify the event start model (avoiding possible
9+ deadlocks).
10+
11+ -- Steve Langasek <steve.langasek@ubuntu.com> Wed, 14 Oct 2015 10:08:00 -0700
12+
13 lxc-android-config (0.230+16.04.20151112-0ubuntu1) xenial; urgency=medium
14
15 [ CI Train Bot ]
16
17=== modified file 'debian/lxc-android-config.maintscript'
18--- debian/lxc-android-config.maintscript 2015-10-12 06:20:39 +0000
19+++ debian/lxc-android-config.maintscript 2016-02-04 07:06:39 +0000
20@@ -4,3 +4,5 @@
21 rm_conffile /etc/init/bluetooth.override 0.230+15.10.20150930.2-0ubuntu1
22 rm_conffile /etc/bluetooth/touch.conf 0.230+15.10.20150930.2-0ubuntu1
23 rm_conffile /etc/init/set.pretty-hostname.conf 0.230+15.10.20150930.2-0ubuntu1
24+rm_conffile /etc/init/apport-reconfig.conf 0.230+16.04.20151112-0ubuntu2~
25+rm_conffile /etc/init/apport.override 0.230+16.04.20151112-0ubuntu2~
26
27=== modified file 'etc/init/apport-config.conf'
28--- etc/init/apport-config.conf 2015-09-30 17:17:07 +0000
29+++ etc/init/apport-config.conf 2016-02-04 07:06:39 +0000
30@@ -1,17 +1,20 @@
31 description "Configure autoreport of crashes for all channels other than stable"
32
33-start on runlevel [2345]
34+start on starting apport or file FILE=/var/lib/apport/autoreport
35
36 task
37
38 script
39- if [ -f "/var/lib/apport/.apport-config-has-run" ]; then
40- stop; exit 0
41- fi
42- channel="$(cat /etc/system-image/channel.ini | grep channel | awk -F '/' '{print $2}')"
43- if [ "$channel" = "stable" ]; then
44- rm /var/lib/apport/autoreport || true
45- fi
46- touch /var/lib/apport/.apport-config-has-run
47- stop; exit 0
48+ if [ ! -f "/var/lib/apport/.apport-config-has-run" ]; then
49+ channel="$(cat /etc/system-image/channel.ini | grep channel | awk -F '/' '{print $2}')"
50+ if [ "$channel" = "stable" ]; then
51+ rm -f /var/lib/apport/autoreport || true
52+ fi
53+ touch /var/lib/apport/.apport-config-has-run
54+ fi
55+ if [ -e /var/lib/apport/autoreport ]; then
56+ start apport || true
57+ else
58+ stop apport || true
59+ fi
60 end script
61
62=== removed file 'etc/init/apport-reconfig.conf'
63--- etc/init/apport-reconfig.conf 2015-10-14 13:36:55 +0000
64+++ etc/init/apport-reconfig.conf 1970-01-01 00:00:00 +0000
65@@ -1,33 +0,0 @@
66-# apport - automatic crash report generation
67-#
68-# While this job is active, core dumps will captured by apport and
69-# used to generate automatic crash reports.
70-
71-description "automatic crash report generation"
72-
73-start on file FILE=/var/lib/apport/autoreport EVENT=create
74-stop on file FILE=/var/lib/apport/autoreport EVENT=delete
75-
76-pre-start script
77- # don't start in containers
78- /bin/running-in-container && exit 0
79-
80- # Only enable crash file generation if autoreport is enabled (LP: #1494442)
81- [ -e /var/lib/apport/autoreport ] || exit 0
82-
83- echo "|/usr/share/apport/apport %p %s %c %P" > /proc/sys/kernel/core_pattern
84- echo 2 > /proc/sys/fs/suid_dumpable
85-end script
86-
87-post-stop script
88- # don't stop in containers
89- /bin/running-in-container && exit 0
90-
91- if [ "`dd if=/proc/sys/kernel/core_pattern count=1 bs=1 2>/dev/null`" != "|" ]
92- then
93- exit 1
94- else
95- echo 0 > /proc/sys/fs/suid_dumpable
96- echo "core" > /proc/sys/kernel/core_pattern
97- fi
98-end script
99
100=== removed file 'etc/init/apport.override'
101--- etc/init/apport.override 2015-10-14 13:36:55 +0000
102+++ etc/init/apport.override 1970-01-01 00:00:00 +0000
103@@ -1,58 +0,0 @@
104-# apport - automatic crash report generation
105-#
106-# While this job is active, core dumps will captured by apport and
107-# used to generate automatic crash reports.
108-
109-description "automatic crash report generation"
110-
111-start on runlevel [2345] and started apport-config
112-stop on runlevel [!2345]
113-
114-env enabled=1
115-
116-pre-start script
117- # don't start in containers
118- /bin/running-in-container && exit 0
119-
120- # Only enable crash file generation if autoreport is enabled (LP: #1494442)
121- [ -e /var/lib/apport/autoreport ] || exit 0
122-
123- mkdir -p -m 1777 /var/crash
124-
125- # check for kernel crash dump, convert it to apport report
126- if [ -e /var/crash/vmcore ] || [ -n "`ls /var/crash | egrep ^[0-9]{12}$`" ]
127- then
128- /usr/share/apport/kernel_crashdump || true
129- fi
130-
131- # check for incomplete suspend/resume or hibernate
132- if [ -e /var/lib/pm-utils/status ]
133- then
134- /usr/share/apport/apportcheckresume || true
135- rm -f /var/lib/pm-utils/status
136- rm -f /var/lib/pm-utils/resume-hang.log
137- fi
138-
139- echo "|/usr/share/apport/apport %p %s %c %P" > /proc/sys/kernel/core_pattern
140- echo 2 > /proc/sys/fs/suid_dumpable
141-end script
142-
143-post-stop script
144- # don't stop in containers
145- /bin/running-in-container && exit 0
146-
147- # Check for a hung resume. If we find one try and grab everything
148- # we can to aid in its discovery
149- if [ -e /var/lib/pm-utils/status ]
150- then
151- ps -wwef > /var/lib/pm-utils/resume-hang.log
152- fi
153-
154- if [ "`dd if=/proc/sys/kernel/core_pattern count=1 bs=1 2>/dev/null`" != "|" ]
155- then
156- exit 1
157- else
158- echo 0 > /proc/sys/fs/suid_dumpable
159- echo "core" > /proc/sys/kernel/core_pattern
160- fi
161-end script

Subscribers

People subscribed via source and target branches