How to fix dpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/updates/ in APT
This error occurs when using the gdebi-gtk GUI to install .deb packages on Ubuntu. The issue is caused by a bug in how gdebi-gtk handles file descriptors passed to dpkg. Switching to command-line installation methods resolves the problem immediately.
Quick fix
Fixes dpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/updates/
sudo dpkg -i /path/to/package.deb- Use dpkg from the command line instead of gdebi-gtk
- Update your system to get the latest gdebi fixes
- Verify the /var/lib/dpkg/updates directory is clean
sudo dpkg -i /path/to/package.debdpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/updates/
What this error means
The "unable to read filedescriptor flags" error indicates that dpkg cannot access a file descriptor used for managing package status and installation progress. This happens because gdebi-gtk does not properly inherit or configure file descriptors when spawning the dpkg process. The error message typically includes a path to /var/lib/dpkg/updates/, which is where dpkg stores temporary installation state. The underlying cause is that in Python 3.4+, file descriptors are not inherited by child processes by default, and gdebi-gtk did not use os.set_inheritable() to work around this limitation.
Typical symptoms
- Installation fails when using gdebi-gtk to install .deb packages
- Error message appears in the gdebi-gtk window during package installation
- The same .deb package installs successfully using command-line tools (dpkg or gdebi)
- Error includes "Bad file descriptor" message
Common causes
- gdebi-gtk does not properly handle file descriptor inheritance when spawning dpkg processes
- Python 3.4+ changed default file descriptor inheritance behavior, breaking gdebi-gtk compatibility
- The VTE library patch that previously worked around this issue (91_keep_fds.patch) was dropped in some Ubuntu versions
- Older versions of gdebi and gdebi-gtk lack the fix needed for newer Python and system libraries
How to fix "dpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/updates/"
The most reliable immediate fix is to avoid the gdebi-gtk GUI entirely. Open a terminal and install your .deb package directly:
sudo dpkg -i /path/to/package.debIf there are dependency issues, use apt to resolve them after:
sudo apt install -fAlternatively, you can also use gdebi from the command line, which works without this bug:
sudo gdebi /path/to/package.debUbuntu has released fixes for gdebi and gdebi-gtk that address this file descriptor handling issue. Update your system to install the patched version:
sudo apt update
sudo apt upgradeIf gdebi or gdebi-gtk is not installed, you can install it:
sudo apt install gdebiAfter updating, try using gdebi-gtk again to see if the issue is resolved.
The /var/lib/dpkg/updates/ directory should be empty when no dpkg operations are running. If it contains leftover files from a failed installation, clean it up:
sudo rm -f /var/lib/dpkg/updates/*Then attempt your installation again. This ensures dpkg starts fresh without corrupted state from previous attempts.
Advanced notes
This bug has been tracked in Ubuntu as Bug #1756238 (Ubuntu 18.04) and Bug #1946499 (Ubuntu 21.10+). The root cause is in the interaction between gdebi-gtk, Python 3.4+, and the VTE library. The gdebi project has patched this issue upstream, but the fix requires updating to a newer version of gdebi/gdebi-gtk. If you are on a very old Ubuntu release, the patch may not be available, making command-line installation the permanent workaround. For developers maintaining packages, note that gdebi-gtk is optional for package installation; dpkg and apt are the standard tools.
Frequently asked questions
- What does "dpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/upd" mean?
- The "unable to read filedescriptor flags" error indicates that dpkg cannot access a file descriptor used for managing package status and installation progress. This happens because gdebi-gtk does not properly inherit or configure file descriptors when spawning the dpkg process. The error message typically includes a path to /var/lib/dpkg/updates/, which is where dpkg stores temporary installation state.
- How do I fix "dpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/upd"?
- This error occurs when using the gdebi-gtk GUI to install .deb packages on Ubuntu. The issue is caused by a bug in how gdebi-gtk handles file descriptors passed to dpkg. Switching to command-line installation methods resolves the problem immediately.
- What causes "dpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/upd"?
- gdebi-gtk does not properly handle file descriptor inheritance when spawning dpkg processes Python 3.4+ changed default file descriptor inheritance behavior, breaking gdebi-gtk compatibility The VTE library patch that previously worked around this issue (91_keep_fds.patch) was dropped in some Ubuntu versions
- Is the "dpkg: error: unable to read filedescriptor flags for /var/lib/dpkg/upd" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐APT Official Documentation
- ๐
- ๐dpkg manual page(Official Docs)