Uploaded image for project: 'Percona Toolkit'
  1. Percona Toolkit
  2. PT-1503

Post-install script fails on VM due to improper UUID file detection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 3.0.7
    • Fix Version/s: 3.0.8
    • Component/s: Packaging
    • Labels:
      None
    • Environment:

      Os: Ubuntu 16.04.4 LTS

      lxd: 2.0.0-0ubuntu4

      percona-toolkit: 3.0.7-1.jessie

      Description

      After implementing system UUID detection (PT-1487), it's not possible to clean install percona-toolkit at least on Ubuntu and Debian systems running under VM. It's related to lack of access to /sys/class/dmi/id/product_uuid along with broken fallback.

       

      root@VM:~# cat /sys/class/dmi/id/product_uuid
      cat: /sys/class/dmi/id/product_uuid: Permission denied

       

      Apt-get output:

       

      Setting up percona-toolkit (3.0.7-1.jessie) ...
      cat: /sys/class/dmi/id/product_uuid: Permission denied
      dpkg: error processing package percona-toolkit (--configure):
       subprocess installed post-installation script returned error exit status 1
      Errors were encountered while processing:
       percona-toolkit
      [master b6bb73c] committing changes in /etc after apt run
       2 files changed, 2 insertions(+)
       create mode 100644 percona-toolkit/.percona.toolkit.uuid
      E: Sub-process /usr/bin/dpkg returned an error code (1)
      

      Issue exists in both: config/deb/postinst and config/rpm/percona-toolkit.spec.  Example broken debian package code:

       

      if [ -e /sys/class/dmi/id/product_uuid ]; then
        cat /sys/class/dmi/id/product_uuid > /etc/percona-toolkit/.percona.toolkit.uuid
      else
        perl -e 'printf+($}="%04x")."$}-$}-$}-$}-".$}x3,map rand 65537,0..7;' > /etc/percona-toolkit/.percona.toolkit.uuid
      fi
      

      We can't assume file existence equals read permission. After using `cat` on product_uuid file, script simply fails. Best solution is to check if file is readable -r instead of only checking it's existence -e.

      - if [ -e /sys/class/dmi/id/product_uuid ]; then
      + if [ -r /sys/class/dmi/id/product_uuid ]; then
      

      As a workaround, following commit should be rolled back + package rebuild - https://github.com/percona/percona-toolkit/commit/92fc23d7b802637831200b07552bae9038ff5a46

      Issue is confirmed on lxd and linux-vserver by the reporter but possible under Xen (in paravirt mode), Virtuozzo/OpenVZ.

      Docker is not affected as file is freely accessible there (at least under OSX).

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                evgeniy.patlan Evgeniy Patlan
                Reporter:
                barteq Bartosz N
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h