** Description changed: - After the most recent upgrade of ubuntu-advantage-tools/ubuntu-pro- - client (34~22.04), running apt upgrade --simulate (as non-root) prints - the following: + [ Impact ] + The Pro Client apt-hook which runs after `apt upgrade` needs root permissions to write the logs to /var/log. + That is generally not a problem, as `apt` commands like `upgrade` need to be executed with root permissions. + However, when doing a dry run using the `--simulate` flag, the hook will execute, generating errors when trying to access the logs. + + The fix consists in only running the hook when the `apt` command is + executed as root. + + [ Test Plan ] + This is covered by the Pro Client acceptance tests, which will be executed as part of the validation of LP#2083973 + + [ Where problems could occur ] + Implementation mistakes could lead to the problem not being fixed - we could be running as non-root in other situations. We do a strict check on root permissions to try to avoid unknown scenarios. + + A caveat is that the hook will not be executed - which means the package + counts for Pro updates will not show as part of the `apt upgrade` + output. For instance, if an esm-apps update would be installed, the user + would see + + 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. + 1 esm-apps security update + + With this fix, that second line in the output will not be shown when running as non root (like the --simulate scenario). + Although this may be considered a bug, this is not a regression, as the script execution is not currently working anyway. We consider getting rid of the error messages is already an improvement. If this happens to be reported as a problem in the future, the team will be happy to take a better look into it. + + [ Original Description ] + After the most recent upgrade of ubuntu-advantage-tools/ubuntu-pro-client (34~22.04), running apt upgrade --simulate (as non-root) prints the following: ``` NOTE: This is only a simulation! - apt needs root privileges for real execution. - Keep also in mind that locking is deactivated, - so don't depend on the relevance to the real current situation! + apt needs root privileges for real execution. + Keep also in mind that locking is deactivated, + so don't depend on the relevance to the real current situation! Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done /bin/sh: 1: cannot create /var/log/ubuntu-advantage-apt-hook.log: Permission denied /bin/sh: 1: cannot create /var/log/ubuntu-advantage-apt-hook.log: Permission denied 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. /bin/sh: 1: cannot create /var/log/ubuntu-advantage-apt-hook.log: Permission denied /bin/sh: 1: cannot create /var/log/ubuntu-advantage-apt-hook.log: Permission denied ``` It appears to be caused by `/etc/apt/apt.conf.d/20apt-esm-hook.conf`, which indiscriminately tries to write to the log file. This is not critical, but clutters the output of the command. Please get rid of this.
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2084677 Title: apt upgrade --simulate prints permission denied because ubuntu- advantage-apt-hook.log ist not accessible To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/2084677/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
