Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)

Bug #2064624 reported by Nobuto Murata
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned
Oracular
New
Undecided
Unassigned
ubuntu-advantage-tools (Ubuntu)
Fix Committed
High
Unassigned
Oracular
New
Undecided
Unassigned
update-notifier (Ubuntu)
Fix Released
Undecided
Alessandro Astone
Oracular
New
Undecided
Unassigned

Bug Description

The following warnings are visible out of the box.

/usr/lib/python3/dist-packages/uaclient/apt.py:288: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init()
/usr/lib/python3/dist-packages/uaclient/apt.py:270: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/preferences.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init_system()

$ apt policy ubuntu-pro-client
ubuntu-pro-client:
  Installed: 31.2.3
  Candidate: 31.2.3
  Version table:
 *** 31.2.3 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status

$ pro security-status
/usr/lib/python3/dist-packages/uaclient/apt.py:288: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init()
/usr/lib/python3/dist-packages/uaclient/apt.py:270: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/preferences.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init_system()
598 packages installed:
    597 packages from Ubuntu Main/Restricted repository
    1 package from Ubuntu Universe/Multiverse repository

To get more information about the packages, run
    pro security-status --help
for a list of available options.

This machine is receiving security patching for Ubuntu Main/Restricted
repository until 2029.
This machine is NOT attached to an Ubuntu Pro subscription.

Ubuntu Pro with 'esm-infra' enabled provides security updates for
Main/Restricted packages until 2034.

Ubuntu Pro with 'esm-apps' enabled provides security updates for
Universe/Multiverse packages until 2034.

Try Ubuntu Pro with a free personal subscription on up to 5 machines.
Learn more at https://ubuntu.com/pro

$ tree /var/lib/ubuntu-advantage/apt-esm/etc/
/var/lib/ubuntu-advantage/apt-esm/etc/
└── apt
    ├── sources.list
    └── sources.list.d
        └── ubuntu-esm-apps.sources

3 directories, 2 files

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: ubuntu-pro-client 31.2.3
ProcVersionSignature: User Name 6.8.0-31.31-generic 6.8.1
Uname: Linux 6.8.0-31-generic x86_64
ApportVersion: 2.28.1-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: unknown
CloudArchitecture: x86_64
CloudBuildName: server
CloudID: lxd
CloudName: lxd
CloudPlatform: lxd
CloudSerial: 20240423
CloudSubPlatform: LXD socket API v. 1.0 (/dev/lxd/sock)
Date: Thu May 2 13:28:48 2024
ProcEnviron:
 LANG=C.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
SourcePackage: ubuntu-advantage-tools
UpgradeStatus: No upgrade log present (probably fresh install)
apparmor_logs.txt:

cloud-id.txt: lxd
livepatch-status.txt-error: Invalid command specified '/snap/bin/canonical-livepatch status'.
uaclient.conf:
 contract_url: https://contracts.canonical.com
 log_level: debug

Revision history for this message
Nobuto Murata (nobuto) wrote :
information type: Private → Public
tags: removed: need-amd64-retrace
Revision history for this message
Grant Orndorff (orndorffgrant) wrote :

Thanks Nobuto!

First reported here: https://github.com/canonical/ubuntu-pro-client/issues/3060

Fixed upstream and to be released in v32 of ubuntu-pro-client in mid May (See LP: 2060732 for overall SRU bug)

Changed in ubuntu-advantage-tools (Ubuntu):
status: New → Fix Committed
importance: Undecided → High
Revision history for this message
Davide (sblantipodi) wrote :

may I ask when this bugfix will be released please? thanks

Revision history for this message
Grant Orndorff (orndorffgrant) wrote :

Hello Davide,

It is currently in -proposed, and scheduled to be released to -updates early next week.

Revision history for this message
Alessandro Astone (aleasto) wrote :

This is also present in Oracular, where /var/lib/ubuntu-advantage/apt-esm/ does not exist

Revision history for this message
max (max-illis) wrote :

I concur - I also have this on Oracular
```
/usr/lib/update-notifier/apt-check --human-readable
/usr/lib/update-notifier/apt-check:351: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init()
/usr/lib/update-notifier/apt-check:359: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/sources.list.d/ - DirectoryExists (2: No such file or directory), W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/sources.list - RealFileExists (2: No such file or directory), W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/preferences.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init()
0 updates can be applied immediately.
```

Revision history for this message
Cody Bryant (codyalanbryant) wrote :

This bug still exists in Oracular mid-January 2025.

Changed in update-notifier (Ubuntu):
status: New → Fix Released
Revision history for this message
Alessandro Astone (aleasto) wrote (last edit ):

/usr/lib/update-notifier/apt-check specifically is fixed in plucky with update-notifier version 3.194

But IMHO the Apt library should avoid printing these warnings when trying to load configs from a Directory that does not exist. A library that is used to build CLI tools should not interfere with stderr too much.

Changed in update-notifier (Ubuntu):
assignee: nobody → Alessandro Astone (aleasto)
Revision history for this message
Alessandro Astone (aleasto) wrote :

Added an "Affects: apt (Ubuntu)" item so that the right people may look into this

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

We do not print warnings on stderr in apt; the library logs them to the error handler, the python-apt code then translates them into Python warnings used in the warnings module using apt_pkg.Warning instances. Unless there is an error, in which case warnings are merged into the exception as context.

Consumers of apt_pkg can filter out apt_pkg.Warning warnings the usual way using the warnings module, including but not limited to:

with warnings.catch_warnings(category=apt_pkg.Warning):
    do something

The warnings addition is a new feature to ensure warnings don't get lost, previously warnings were only part of exceptions.

A future version of APT may add error ids to the error logging framework, which then could be translated into apt_pkg.Error and apt_pkg.Warning subclasses.

Changed in apt (Ubuntu):
status: New → Invalid
Revision history for this message
Sascha Lucas (sascha-lucas) wrote :

> /usr/lib/update-notifier/apt-check specifically is fixed in plucky with update-notifier version 3.194

Will the plucky fix backported to noble?

Affects me on noble. Don't know how to add affects update-notifier -> noble.

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.