** Description changed: [Impact] - TODO Grant + This bug results in segfault messages interspersed within apt command + output. The segfaults do not prevent apt from doing its job, but they do + add noise and look concerning. Further, the user will not get the + messages that uatools needs to inject into apt output. This can include + important information, such as a warning that your esm contract is about + to expire. + + We fix this bug by adding a null-check on the Origin field of packages + in the uatools apt-esm-hook. This prevents the segfault when the user + has apt repos that leave the Origin field blank. [Test Plan] Reproduce the bug on a container by adding an apt repo that doesn't have an "Origin" speficied. When running apt update or apt upgrade you will see "Segmentation fault (core dumped)" in the output. For example: ``` lxc launch ubuntu-daily:bionic test-apt-hook-segfault lxc exec test-apt-hook-segfault -- bash # inside the container now wget -qO - https://packages.irods.org/irods-signing-key.asc | sudo apt-key add - echo "deb [arch=amd64] https://packages.irods.org/apt/ xenial main" | sudo tee /etc/apt/sources.list.d/renci-irods.list apt update apt install irods-dev=4.2.2 apt update ``` At the end of the output of the last apt update command, you will see the segfault. To see the fix in action, install the new ua version from our staging PPA. Continuing on the same container: ``` add-apt-repository ppa:ua-client/staging apt install ubuntu-advantage-tools apt update ``` There should be no segfaults anymore. [Where problems could occur] TODO Grant [Other Info] - + TODO Grant [Original Description] This bug has been brought to my attention by a UA Canonical customer. In this current situation, there is no attached UA subscription. They can repeatly reproduce the error on a newly installed Bionic system Support (STS/SEG) can't reproduce it so far. Still under testing and investigation. # dpkg ii ubuntu-advantage-tools 27.0.2~18.04.1 amd64 management tools for Ubuntu Advantage ii apt 1.6.13 amd64 commandline package manager ii python3 3.6.7-1~18.04 amd64 interactive high-level object-oriented language (default python3 version) # cat path_to_sosreport/sos_command/ubuntu/ua_status SERVICE AVAILABLE DESCRIPTION esm-infra yes UA Infra: Extended Security Maintenance (ESM) fips yes NIST-certified FIPS modules fips-updates yes Uncertified security updates to FIPS modules livepatch yes Canonical Livepatch service This machine is not attached to a UA subscription. # systemd service -* ua-messaging.service - Ubuntu Advantage APT and MOTD Messages Loaded: loaded (/lib/systemd/system/ua-messaging.service; static; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2021-05-20 09:25:13 BST; 57min ago Process: 54277 ExecStart=/usr/bin/python3 /usr/lib/ubuntu-advantage/ua_update_messaging.py (code=exited, status=1/FAILURE) Main PID: 54277 (code=exited, status=1/FAILURE) May 20 09:25:13 python3[54277]: File "/usr/lib/ubuntu-advantage/ua_update_messaging.py", line 297, in update_apt_and_motd_messages May 20 09:25:13 python3[54277]: util.subp(["/usr/lib/ubuntu-advantage/apt-esm-hook", Unit ypbind.service could not be found. "process-templates"]) May 20 09:25:13 python3[54277]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 608, in subp May 20 09:25:13 python3[54277]: out, err = _subp(args, rcs, capture, timeout, env=env) May 20 09:25:13 python3[54277]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 565, in _subp May 20 09:25:13 python3[54277]: stderr=err.decode("utf-8"), May 20 09:25:13 python3[54277]: uaclient.util.ProcessExecutionError: Failed running command '/usr/lib/ubuntu-advantage/apt-esm-hook process-templates' [exit(-11)]. Message: May 20 09:25:13 systemd[1]: ua-messaging.service: Main process exited, code=exited, status=1/FAILURE May 20 09:25:13 systemd[1]: ua-messaging.service: Failed with result 'exit-code'. May 20 09:25:13 systemd[1]: Failed to start Ubuntu Advantage APT and MOTD Messages. # logs 2021-05-20 09:25:11,842 - ua_update_messaging.py:(278) [DEBUG]: Updating UA messages for APT and MOTD. 2021-05-20 09:25:11,842 - util.py:(414) [DEBUG]: Reading file: /etc/os-release 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json syslog:May 20 09:25:25 kernel: [58330.647499] apt-esm-hook[54507]: segfault at 0 ip 00007f0045dc5426 sp 00007ffd10d0e738 error 4 in libc-2.27.so[7f0045d14000+1e7000] syslog:May 20 09:25:27 kernel: [58332.528175] apt-esm-hook[54512]: segfault at 0 ip 00007f9921565426 sp 00007ffdae974668 error 4 in libc-2.27.so[7f99214b4000+1e
** Description changed: [Impact] This bug results in segfault messages interspersed within apt command output. The segfaults do not prevent apt from doing its job, but they do add noise and look concerning. Further, the user will not get the messages that uatools needs to inject into apt output. This can include important information, such as a warning that your esm contract is about to expire. We fix this bug by adding a null-check on the Origin field of packages in the uatools apt-esm-hook. This prevents the segfault when the user has apt repos that leave the Origin field blank. [Test Plan] Reproduce the bug on a container by adding an apt repo that doesn't have - an "Origin" speficied. When running apt update or apt upgrade you will + an "Origin" specified. When running apt update or apt upgrade you will see "Segmentation fault (core dumped)" in the output. For example: ``` lxc launch ubuntu-daily:bionic test-apt-hook-segfault lxc exec test-apt-hook-segfault -- bash # inside the container now wget -qO - https://packages.irods.org/irods-signing-key.asc | sudo apt-key add - echo "deb [arch=amd64] https://packages.irods.org/apt/ xenial main" | sudo tee /etc/apt/sources.list.d/renci-irods.list apt update apt install irods-dev=4.2.2 apt update ``` At the end of the output of the last apt update command, you will see the segfault. To see the fix in action, install the new ua version from our staging PPA. Continuing on the same container: ``` add-apt-repository ppa:ua-client/staging apt install ubuntu-advantage-tools apt update ``` There should be no segfaults anymore. [Where problems could occur] - TODO Grant + We're using a function called DeNull, defined in an apt header file. If + a different version of apt comes out where the DeNull function is + removed, or if its behavior changes, it could cause a FTBFS or for this + bug to be reintroduced. [Other Info] TODO Grant [Original Description] This bug has been brought to my attention by a UA Canonical customer. In this current situation, there is no attached UA subscription. They can repeatly reproduce the error on a newly installed Bionic system Support (STS/SEG) can't reproduce it so far. Still under testing and investigation. # dpkg ii ubuntu-advantage-tools 27.0.2~18.04.1 amd64 management tools for Ubuntu Advantage ii apt 1.6.13 amd64 commandline package manager ii python3 3.6.7-1~18.04 amd64 interactive high-level object-oriented language (default python3 version) # cat path_to_sosreport/sos_command/ubuntu/ua_status SERVICE AVAILABLE DESCRIPTION esm-infra yes UA Infra: Extended Security Maintenance (ESM) fips yes NIST-certified FIPS modules fips-updates yes Uncertified security updates to FIPS modules livepatch yes Canonical Livepatch service This machine is not attached to a UA subscription. # systemd service -* ua-messaging.service - Ubuntu Advantage APT and MOTD Messages Loaded: loaded (/lib/systemd/system/ua-messaging.service; static; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2021-05-20 09:25:13 BST; 57min ago Process: 54277 ExecStart=/usr/bin/python3 /usr/lib/ubuntu-advantage/ua_update_messaging.py (code=exited, status=1/FAILURE) Main PID: 54277 (code=exited, status=1/FAILURE) May 20 09:25:13 python3[54277]: File "/usr/lib/ubuntu-advantage/ua_update_messaging.py", line 297, in update_apt_and_motd_messages May 20 09:25:13 python3[54277]: util.subp(["/usr/lib/ubuntu-advantage/apt-esm-hook", Unit ypbind.service could not be found. "process-templates"]) May 20 09:25:13 python3[54277]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 608, in subp May 20 09:25:13 python3[54277]: out, err = _subp(args, rcs, capture, timeout, env=env) May 20 09:25:13 python3[54277]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 565, in _subp May 20 09:25:13 python3[54277]: stderr=err.decode("utf-8"), May 20 09:25:13 python3[54277]: uaclient.util.ProcessExecutionError: Failed running command '/usr/lib/ubuntu-advantage/apt-esm-hook process-templates' [exit(-11)]. Message: May 20 09:25:13 systemd[1]: ua-messaging.service: Main process exited, code=exited, status=1/FAILURE May 20 09:25:13 systemd[1]: ua-messaging.service: Failed with result 'exit-code'. May 20 09:25:13 systemd[1]: Failed to start Ubuntu Advantage APT and MOTD Messages. # logs 2021-05-20 09:25:11,842 - ua_update_messaging.py:(278) [DEBUG]: Updating UA messages for APT and MOTD. 2021-05-20 09:25:11,842 - util.py:(414) [DEBUG]: Reading file: /etc/os-release 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json syslog:May 20 09:25:25 kernel: [58330.647499] apt-esm-hook[54507]: segfault at 0 ip 00007f0045dc5426 sp 00007ffd10d0e738 error 4 in libc-2.27.so[7f0045d14000+1e7000] syslog:May 20 09:25:27 kernel: [58332.528175] apt-esm-hook[54512]: segfault at 0 ip 00007f9921565426 sp 00007ffdae974668 error 4 in libc-2.27.so[7f99214b4000+1e ** Description changed: [Impact] This bug results in segfault messages interspersed within apt command output. The segfaults do not prevent apt from doing its job, but they do add noise and look concerning. Further, the user will not get the messages that uatools needs to inject into apt output. This can include important information, such as a warning that your esm contract is about to expire. We fix this bug by adding a null-check on the Origin field of packages in the uatools apt-esm-hook. This prevents the segfault when the user has apt repos that leave the Origin field blank. [Test Plan] Reproduce the bug on a container by adding an apt repo that doesn't have an "Origin" specified. When running apt update or apt upgrade you will see "Segmentation fault (core dumped)" in the output. For example: ``` lxc launch ubuntu-daily:bionic test-apt-hook-segfault lxc exec test-apt-hook-segfault -- bash # inside the container now wget -qO - https://packages.irods.org/irods-signing-key.asc | sudo apt-key add - echo "deb [arch=amd64] https://packages.irods.org/apt/ xenial main" | sudo tee /etc/apt/sources.list.d/renci-irods.list apt update apt install irods-dev=4.2.2 apt update ``` At the end of the output of the last apt update command, you will see the segfault. To see the fix in action, install the new ua version from our staging PPA. Continuing on the same container: ``` add-apt-repository ppa:ua-client/staging apt install ubuntu-advantage-tools apt update ``` There should be no segfaults anymore. [Where problems could occur] We're using a function called DeNull, defined in an apt header file. If a different version of apt comes out where the DeNull function is removed, or if its behavior changes, it could cause a FTBFS or for this bug to be reintroduced. [Other Info] - TODO Grant + We believe this is the same bug that caused uatools to be retracted from + focal by the phased updates system. See that error here: + https://errors.ubuntu.com/problem/4166288511f42a64aee694b80c7d9d3103bb8581 + + If we are correct, this bugfix will eliminate those recurring errors on + focal as well. [Original Description] This bug has been brought to my attention by a UA Canonical customer. In this current situation, there is no attached UA subscription. They can repeatly reproduce the error on a newly installed Bionic system Support (STS/SEG) can't reproduce it so far. Still under testing and investigation. # dpkg ii ubuntu-advantage-tools 27.0.2~18.04.1 amd64 management tools for Ubuntu Advantage ii apt 1.6.13 amd64 commandline package manager ii python3 3.6.7-1~18.04 amd64 interactive high-level object-oriented language (default python3 version) # cat path_to_sosreport/sos_command/ubuntu/ua_status SERVICE AVAILABLE DESCRIPTION esm-infra yes UA Infra: Extended Security Maintenance (ESM) fips yes NIST-certified FIPS modules fips-updates yes Uncertified security updates to FIPS modules livepatch yes Canonical Livepatch service This machine is not attached to a UA subscription. # systemd service -* ua-messaging.service - Ubuntu Advantage APT and MOTD Messages Loaded: loaded (/lib/systemd/system/ua-messaging.service; static; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2021-05-20 09:25:13 BST; 57min ago Process: 54277 ExecStart=/usr/bin/python3 /usr/lib/ubuntu-advantage/ua_update_messaging.py (code=exited, status=1/FAILURE) Main PID: 54277 (code=exited, status=1/FAILURE) May 20 09:25:13 python3[54277]: File "/usr/lib/ubuntu-advantage/ua_update_messaging.py", line 297, in update_apt_and_motd_messages May 20 09:25:13 python3[54277]: util.subp(["/usr/lib/ubuntu-advantage/apt-esm-hook", Unit ypbind.service could not be found. "process-templates"]) May 20 09:25:13 python3[54277]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 608, in subp May 20 09:25:13 python3[54277]: out, err = _subp(args, rcs, capture, timeout, env=env) May 20 09:25:13 python3[54277]: File "/usr/lib/python3/dist-packages/uaclient/util.py", line 565, in _subp May 20 09:25:13 python3[54277]: stderr=err.decode("utf-8"), May 20 09:25:13 python3[54277]: uaclient.util.ProcessExecutionError: Failed running command '/usr/lib/ubuntu-advantage/apt-esm-hook process-templates' [exit(-11)]. Message: May 20 09:25:13 systemd[1]: ua-messaging.service: Main process exited, code=exited, status=1/FAILURE May 20 09:25:13 systemd[1]: ua-messaging.service: Failed with result 'exit-code'. May 20 09:25:13 systemd[1]: Failed to start Ubuntu Advantage APT and MOTD Messages. # logs 2021-05-20 09:25:11,842 - ua_update_messaging.py:(278) [DEBUG]: Updating UA messages for APT and MOTD. 2021-05-20 09:25:11,842 - util.py:(414) [DEBUG]: Reading file: /etc/os-release 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/ubuntu-advantage/private/machine-token.json 2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/ubuntu-advantage/private/machine-token.json syslog:May 20 09:25:25 kernel: [58330.647499] apt-esm-hook[54507]: segfault at 0 ip 00007f0045dc5426 sp 00007ffd10d0e738 error 4 in libc-2.27.so[7f0045d14000+1e7000] syslog:May 20 09:25:27 kernel: [58332.528175] apt-esm-hook[54512]: segfault at 0 ip 00007f9921565426 sp 00007ffdae974668 error 4 in libc-2.27.so[7f99214b4000+1e -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1929123 Title: segfault in apt-esm-hook To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1929123/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs