Assertion error during iso build

Bug #1824523 reported by Andreas Hasenack
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-advantage-tools (Ubuntu)
Fix Released
Critical
Unassigned

Bug Description

From https://launchpadlibrarian.net/418949790/buildlog_ubuntu_disco_amd64_ubuntu-server-live_BUILDING.txt.gz:
Processing triggers for initramfs-tools (0.131ubuntu18) ...
apt-esm-hook: hook.cc:186: int main(int, char**): Assertion `ppid == getppid_of("self")' failed.
Aborted (core dumped)
E: Problem executing scripts APT::Install::Post-Invoke-Success '[ ! -f /usr/lib/ubuntu-advantage/apt-esm-hook ] || /usr/lib/ubuntu-advantage/apt-esm-hook'
E: Sub-process returned an error code
E: config/hooks/032-installer-squashfs.binary failed (exit non-zero). You should check for errors.
P: Begin unmounting filesystems...
P: Saving caches...
P: Begin unmounting filesystems...
P: Saving caches...
Build failed

Upstream fix: https://github.com/CanonicalLtd/ubuntu-advantage-client/pull/362/files

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-advantage-tools - 19.3

---------------
ubuntu-advantage-tools (19.3) disco; urgency=medium

  * apt-hook: Do not crash/fail if we can't read /proc/self/status
    (LP: #1824523)

 -- Andreas Hasenack <email address hidden> Fri, 12 Apr 2019 09:25:15 -0300

Changed in ubuntu-advantage-tools (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

This still fails for me:

http://paste.ubuntu.com/p/vdN9dBxKBr/

....
Building bootmap in '/boot'
Adding IPL section 'ubuntu' (default)
Preparing boot device: vda (0000).
Done.
apt-esm-hook: hook.cc:184: int main(int, char**): Assertion `ppid == getppid_of("self")' failed.
Aborted (core dumped)
E: Problem executing scripts APT::Install::Post-Invoke-Success '[ ! -f /usr/lib/ubuntu-advantage/apt-esm-hook ] || /usr/lib/ubuntu-advantage/apt-esm-hook'
E: Sub-process returned an error code
Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
TIMED subp(['udevadm', 'settle']): 0.056
Running command ['umount', '/target/sys'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/proc'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/dev'] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-kernel: FAIL: installing kernel
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Traceback (most recent call last):
 ...
curtin.util.ProcessExecutionError: Unexpected error while running command.

Note this is the new code, as in it's now asserting in hook.cc:184 which the new line where the assert has moved.

I wonder if these things are racy or something.

At the moment, this fails whilst trying to install the kernel, when running subiquity -> curtin on s390x. With ubuntu-advantage-tools 19.3 everywhere.

Changed in ubuntu-advantage-tools (Ubuntu):
status: Fix Released → Confirmed
assignee: Andreas Hasenack (ahasenack) → nobody
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I think it is racy to assert things about getppid

       getppid() returns the process ID of the parent of the calling process.
       This will be either the ID of the process that created this process us‐
       ing fork(), or, if that process has already terminated, the ID of the
       process to which this process has been reparented (either init(1) or a
       "subreaper" process defined via the prctl(2) PR_SET_CHILD_SUBREAPER op‐
       eration).

As processes get reparented, the getppid will not match status.

I also do not understand the point of testing getppid() implementation. Since getppid() is actually never used. The only code path that is used is reading /proc/*/status files and parsing those.

the /proc/*/status parsing is used to determine whether or not to show UA output. When we fail to determine if we should show the output or not, we should not be crashing the whole transaction (and subiquity in this case).

A crashing hook, shouldn't crash apt return codes...

Please remove this selftest from production code:
   // Self testing
   if (access("/proc/self/status", R_OK) == 0) {
      std::string ppid;
      strprintf(ppid, "%d", getppid());
      assert(ppid == getppid_of("self"));
   }

As it will always crash apt, when it gets reparented.

Revision history for this message
Julian Andres Klode (juliank) wrote :

Ack

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-advantage-tools - 19.4

---------------
ubuntu-advantage-tools (19.4) disco; urgency=medium

  * Drop the self-test assert in the apt-hook, it's making the subiquity
    server install fail (LP: #1824523)

 -- Andreas Hasenack <email address hidden> Fri, 12 Apr 2019 17:59:16 -0300

Changed in ubuntu-advantage-tools (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.