The HTTPS method in APT crashes during package operations with a segmentation fault, preventing apt-get update and upgrades. This usually stems from missing transport packages, corrupted cache files, or libc issues.
This error occurs when APT's HTTPS method handler crashes unexpectedly. The /usr/lib/apt/methods/https process is responsible for handling secure connections to package repositories. When it receives a segmentation fault (SIGSEGV), it means the process encountered a memory access violation and terminated. This prevents APT from downloading and installing packages over HTTPS.
The most common fix is installing the HTTPS transport handler:
sudo apt-get install apt-transport-httpsThis package provides the actual HTTPS method implementation. If apt-get itself is broken, you may need to bootstrap it with HTTP first by temporarily switching HTTPS repositories to HTTP.
Remove the binary cache files that may be corrupted:
sudo rm /var/cache/apt/*.bin
sudo apt-get updateThis forces APT to rebuild its cache from scratch. The *.bin files are memory-mapped caches that can become corrupted if the system crashes or runs out of memory.
Review your sources lists for HTTPS repositories that may be causing issues:
cat /etc/apt/sources.list
ls /etc/apt/sources.list.d/Temporarily comment out any HTTPS repositories you added, keeping only the official Ubuntu/Debian ones. You can re-add them after apt-transport-https is installed:
sudo nano /etc/apt/sources.list
# Change: deb https://... to # deb https://...
sudo apt-get updateIf you're on a system with limited memory (Raspberry Pi, embedded systems), increase the cache size:
echo 'APT::Cache-start 200000000;' | sudo tee -a /etc/apt/apt.confThis tells APT to allocate 200MB instead of the default, preventing segfaults on memory-constrained systems.
As a last resort, manually download and reinstall APT:
# On another working system or using wget:
wget http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_*.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/a/apt/libapt-*.deb
# Then on the broken system:
sudo dpkg -i apt_*.deb libapt_*.deb
sudo apt-get install -f # Fix any broken dependenciesMatch the version numbers to your Ubuntu/Debian release.
If you're in a Docker container or WSL2, try installing apt-transport-https before adding HTTPS repositories:
RUN apt-get update && apt-get install -y apt-transport-httpsFor Docker, ensure your Dockerfile doesn't mix HTTPS repositories with the initial apt-get update. In WSL2, verify your system clock is synchronized (time skew can cause HTTPS issues):
sudo ntpdate -s time.nist.govThe underlying bug was fixed in Debian APT in 2009 for HTTP but the HTTPS method handler received the fix much later, affecting Ubuntu Trusty and older Raspberry Pi distributions. On resource-constrained systems, APT may fail to allocate enough memory for the package index, causing segfaults before it even connects to HTTPS. WSL2 has environment-specific issues with HTTPS transport that sometimes require using the Microsoft-provided package manager (apt-utils) or upgrading WSL2 kernel. If you see 'Problem with MergeList' errors, your /var/lib/dpkg/status file may be corrupted—in that case, you'll need to recover from a backup or reinstall the system.
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Sub-process /usr/bin/dpkg returned an error code (2)
How to fix "Sub-process /usr/bin/dpkg returned an error code (2)" in APT
dpkg-divert: error: rename involves overwriting 'path' with different file
How to fix dpkg-divert rename conflicts in APT
E: Sub-process /usr/bin/dpkg returned an error code (1) during kernel installation
How to fix "dpkg returned an error code (1)" in APT kernel installation
dpkg: dependency problems prevent configuration of triggers
dpkg: dependency problems prevent configuration of triggers in apt