Additional context on the root cause and a tested workaround: 1. WHY UNOWNED FILES EXIST IN /usr/share/cacti/resource: In prior Cacti versions (<= 1.2.30), whenever a user imports official device templates via Cacti's web UI (Console > Import / Export > Import Templates, or during initial wizard setup for devices like Aruba, AKCP, MikroTik, APC, HP iLO, etc.), Cacti writes XML query definitions and helper scripts into: - /usr/share/cacti/resource/script_queries/ - /usr/share/cacti/resource/snmp_queries/ - /usr/share/cacti/resource/script_server/ - /usr/share/cacti/site/scripts/
Because these files were generated dynamically by the web application at runtime, 'dpkg -S' does not list them as owned by 'cacti:all'. 2. WHY dpkg-maintscript-helper FAILS: In cacti.preinst: dpkg-maintscript-helper dir_to_symlink /usr/share/cacti/resource /var/lib/cacti/resource 1.2.31+ds1-1~ -- "$@" Inside dpkg-maintscript-helper's prepare_dir_to_symlink(), it validates ownership: find "$DPKG_ROOT$PATHNAME" -print0 | xargs -0 -n1 "$0" _internal_pkg_must_own_file "$PACKAGE" Because the template files are not in the dpkg manifest, it immediately aborts: "dpkg-maintscript-helper: error: directory '/usr/share/cacti/resource' contains files not owned by package cacti:all, cannot switch to symlink" 3. SUGGESTED PACKAGING FIX: In preinst, before invoking dpkg-maintscript-helper dir_to_symlink, detect if /usr/share/cacti/resource is a directory. If so, copy/move any existing files into /var/lib/cacti/resource/ and /var/lib/cacti/scripts/ (preserving www-data ownership) and replace the directories with symlinks before dpkg-maintscript-helper checks them. If the path is already a symlink, prepare_dir_to_symlink cleanly bypasses the check. 4. MANUAL WORKAROUND FOR AFFECTED USERS: sudo mkdir -p /var/lib/cacti/resource /var/lib/cacti/scripts sudo cp -a /usr/share/cacti/resource/. /var/lib/cacti/resource/ sudo cp -a /usr/share/cacti/site/scripts/. /var/lib/cacti/scripts/ sudo chown -R www-data:www-data /var/lib/cacti/resource /var/lib/cacti/scripts sudo rm -rf /usr/share/cacti/resource /usr/share/cacti/site/scripts sudo ln -s /var/lib/cacti/resource /usr/share/cacti/resource sudo ln -s /var/lib/cacti/scripts /usr/share/cacti/site/scripts sudo apt --fix-broken install -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2172261 Title: package cacti 1.2.30+ds1-1ubuntu2 failed to install/upgrade: new cacti package preinst maintainer script subprocess failed with exit status 1 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cacti/+bug/2172261/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
