Linux errno Reference

Search Linux errno values by number, name or message.

A syscall failed and all you got back was a bare number like errno 13 or -EACCES in a log. Type the number, the symbolic name, or even a stray word from the message and this reference gives you the symbol, what it actually means, the two or three things that usually cause it, and how to diagnose it. It walks from the right perror call to the errno lookup in moreutils, with strace and dmesg getting their say too. Click any entry to open the full detail, or use the category filter under the search box to browse only the networking codes. All of it is local JavaScript; nothing you type ever leaves the page.

100% in your browser. Nothing you type ever leaves this page.

Linux errno reference · numbers, names and fixes

A syscall failed and all you got back was a bare number, like errno 13 or -EACCES in a log? Type the number or the symbolic name, even a stray word from the message. You get the symbol, what it actually means, the two or three things that usually cause it, and how I'd go about diagnosing it, from the right perror call to the errno <n> lookup in moreutils. strace and dmesg get their say too. Click any entry to open the full detail. A category filter sits under the search box when you'd rather browse, say, only the networking codes. All of it is local JavaScript; nothing you type goes anywhere.

What errno actually is

On Linux and pretty much every Unix, when a system call or a C library function fails it returns -1 (or a null pointer) and stashes the real reason in a thread-local integer called errno. The number on its own tells you almost nothing. The kernel doesn't print "you can't write here because the filesystem is read-only", it just sets errno to 30 and moves on. Your job is to turn that 30 back into EROFS and then into a fix. That's the whole point of this page.

The values aren't random, by the way. The low ones (1 to 34) come from asm-generic/errno-base.h and are stable across basically every Unix, so ENOENT is 2 on Linux, on macOS, on the BSDs. Above 34 they're defined in asm-generic/errno.h and here the numbers start to drift between operating systems. The networking ones especially: ECONNREFUSED is 111 on Linux but a totally different number on macOS. So every number on this page is the Linux value. Don't copy them onto a Mac and expect a match.

Where you run into errno

  • In C, after any libc or syscall wrapper fails. You include <errno.h>, read the global errno, and turn it into text with perror("open") or strerror(errno).
  • In the shell, the exit status $? isn't the errno, but a failing command often prints the strerror string ("No such file or directory"), which is just ENOENT in plain English.
  • In strace output, this is where you see it raw: a line like openat(...) = -1 ENOENT (No such file or directory) hands you the syscall, the symbol and the message all at once. Honestly this is the fastest way to find which call failed and why.
  • In Python, a failed OS call raises OSError (or a subclass like PermissionError, FileNotFoundError), and the .errno attribute holds the number. import errno; errno.EACCES gives you the symbolic constants.
  • In kernel logs, drivers and the block layer often log the negative form, so you'll see -5 meaning EIO or -110 meaning ETIMEDOUT in dmesg.

How to look one up fast

If you've got moreutils installed, the quickest path is errno 13, which prints EACCES 13 Permission denied, and errno -l dumps the whole list. No moreutils? A one-liner does it: python3 -c 'import os,errno; print(os.strerror(13))', or in Perl perl -e 'print $!=13,"\n"'. In C it's perror() for the current errno or strerror(n) for any value. And the canonical source of truth, if you ever doubt a number, is the header itself: grep -rE "EACCES|13" /usr/include/asm-generic/errno*.h. The man page man 3 errno lists them with descriptions too.

Common gotchas

The one that bites everyone: errno is only meaningful right after a failure. A successful call does not reset it to zero. So if you check errno after a call that actually succeeded, you might be reading a stale value from three calls ago. The rule is: check the return value first, and only then look at errno. Set it to 0 yourself before a call if you genuinely need to distinguish "no error" from "error".

Two more I keep seeing. EAGAIN and EWOULDBLOCK are the same number on Linux (11), so code that checks for both is just being portable, not paranoid. And EINTR (4) is not really an error, it's a syscall interrupted by a signal, and the right move is almost always to retry the call rather than bail out. Plenty of bugs are just somebody treating EINTR as fatal.

How this tool runs

The whole errno dataset sits right inside the page and the search runs locally in plain JavaScript. Your queries stay on your machine, full stop. Loaded once, it keeps working offline too.

Frequently asked questions

What does errno 13 mean?

Errno 13 is EACCES, "Permission denied". The process does not have the rights to do what it asked. A file it cannot write, say, or a low port it cannot bind. Check the file mode and owner with ls -l, check you can traverse every parent directory (you need execute, the x bit, on each one), and remember SELinux or AppArmor can deny access even when the plain Unix permissions look fine. strace shows you the exact syscall and path that got refused.

What is the difference between errno and the shell exit code $?

They are not the same thing. errno is the C-level reason a syscall failed, a thread-local integer like 2 for ENOENT. The shell $? is the exit status of a whole process, 0 to 255, set by whatever value the program passed to exit(). A program might hit ENOENT internally and then choose to exit with status 1, or 2, or anything. There is no fixed mapping between the two. errno explains why a single call failed. $? only tells you how the program as a whole chose to finish.

How do I convert an errno number to its name in Python?

Use the errno module for the name and os.strerror for the message. import errno, os; print(errno.errorcode[13], os.strerror(13)) prints "EACCES Permission denied". When an OS call fails Python raises OSError (or a subclass), and the exception .errno attribute holds the number, so you can branch on if e.errno == errno.ENOENT directly.

Why do I see a negative errno like -110 in dmesg or kernel logs?

Inside the kernel, functions return errors as negative numbers, so -110 is ETIMEDOUT and -5 is EIO. It is a kernel convention: a successful call returns 0 or a positive value, a failure returns the negated errno. When that error bubbles up to userspace through a syscall, the C library flips the sign and stores the positive value in errno. So -5 in dmesg and errno 5 in your program are the same EIO.

Are Linux errno numbers the same as on macOS or BSD?

The first 34 match (ENOENT is 2 everywhere, EACCES is 13 everywhere), because they come from the same historical base. Above 34 they diverge, and the networking ones are the worst offenders. ECONNREFUSED is 111 on Linux but 61 on macOS, ETIMEDOUT is 110 on Linux but 60 on macOS. The symbolic name is portable; the number is not. If your code crosses platforms, compare against the constant rather than a hardcoded integer.

Is EINTR something I should treat as a fatal error?

No, and treating it as fatal is a classic bug. EINTR (errno 4) means a signal arrived while your call was blocked, so the kernel bailed out of the call early. The data is fine and nothing is broken; you just need to call the thing again. Lots of code wraps blocking calls in a retry loop for exactly this. Linux can auto-restart some calls if you set SA_RESTART on the signal handler, but you cannot rely on it for everything, so handle EINTR explicitly.