Package: command-not-found
Version: 23.04.0-1
Severity: important
Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate ***
* What led up to the situation?
Installing "command-not-found" using aptitude, enabling it in /etc/bashrc, and
misspelling a command. A warning was displayed:
"WARNING:root:could not open file
'/etc/apt/sources.list.d/DebianRepositories.sources': Unable to parse section
data".
Nothing else.
* What exactly did you do (or not do) that was effective (or
ineffective)?
Searching the DBTS provided information about similar behaviors (#965020,
#1021953), but specially #966307 because to be able to make it work the same
non-sense steps described there must be taken. A similar solution can be found
at StackExchange [1].
1) According to the documentation of "command-not-found"[2], issuing "update-
command-not-found(8)" must create a list of programs from whatever is at
/var/cache/apt/apt-file/. It did nothing, not even an error, because there was
nothing there.
2) Therefore, apt-file(1) must be executed manually as "root" user! Even when
it is a normal user command (again, according to its documentation man page):
~$ LANG=C apt-file update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission
denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13:
Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches
(13: Permission denied)
3) After the previous step, and issuing another "update-command-not-found"
(also as root), the database of programs appears at /var/lib/command-not-found/
as described in [1] and [2]. However, the directory /var/cache/apt/apt-file
still does not exist. So, what will happen the next time "update-command-not-
found" is issued?
4) Currently, when misspelling a command in a CLI, the warning about not being
able to open the sources.list file is still displayed.
~$ LANG=C datE
WARNING:root:could not open file
'/etc/apt/sources.list.d/DebianRepositories.sources': Unable to parse section
data
Command 'datE' not found, did you mean:
command 'dat' from deb liballegro4-dev
command 'date' from deb coreutils
Try: apt install
I do not really know whether the permission of the user play any role in the
crazy behavior of the "command-not-found" tool. However, the fact of getting a
warning about not being able to access a file usually available (mode 644)
every time I misspelled a command was the cause of investigating it.
As a user, I think this is too much trouble.
Anyway, I take advantage of the message to thank you in advance for your work
and help.
Regards, robert
[1] https://unix.stackexchange.com/questions/585107/debian-command-not-found-
error-local-variable-cnf-referenced-before-assignme
[2] /usr/share/doc/command-not-found/README.Debian
*** End of the template - remove these template lines ***
-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.3.0-2-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages command-not-found depends on:
ii apt-file 3.3
ii lsb-release 12.0-2
ii python3 3.11.4-5
ii python3-apt 2.6.0
command-not-found recommends no packages.
Versions of packages command-not-found suggests:
pn snapd
-- no debconf information