4

If I run apt-cache show nonexistent, I get this error:

N: Unable to locate package nonexistent
E: No packages found

I know the E stands for "Error", and a W would stand for "Warning", but what does the N stand for? "Information"?

Are there other letters that may show up?

I couldn't find anything in man apt-cache, man apt, or man apt-get.

P.s. This came up because of this question: Bash file redirection bug?

wjandrea
  • 14,236
  • 4
  • 48
  • 98

1 Answers1

4

Letters designate error message type. By looking at the apt-cache C++ source code and the related error.cc file, there's apparently different types of errors:

  • GEMessage(FatalE, FATAL)
  • GEMessage(Errno, ERROR)
  • GEMessage(WarningE, WARNING)
  • GEMessage(NoticeE, NOTICE)
  • GEMessage(DebugE, DEBUG)

The errors are pushed onto message stack via _error->Insert method which in the apt-cache source is apparently an "alias" for GlobalError::Insert method.

Interestingly enough there's also CacheSetHelper which sets whether to show errors or not. That defaults to showing errors in the constructor for this class, and message type to ERROR.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • So the letters are Fatal, Error, Warning, Notice, and Debug, right? That's what I ultimately want to know. – wjandrea Oct 06 '18 at 21:33
  • 1
    Essentially, yes. Different story is to figure out how apt decides what makes a message error rather than warning. In the yesterday's question OP has N: No packages found, but your command has E: No packages found. But there's way too much C++ source code to read :) – Sergiy Kolodyazhnyy Oct 06 '18 at 21:37
  • To my experience the classification of messages as error, warning, etc. often also depends on the author who wrote that particular piece of code. ;-) – PerlDuck Oct 07 '18 at 08:50