Prefer `apt install ./package.deb` so Ubuntu can resolve repository dependencies in one transaction. If `dpkg -i` already left packages unpacked or unconfigured, diagnose the exact state, repair it without blind removals, and verify the package database.
When apt pauses at “0% Connecting,” the last displayed address is evidence, not a diagnosis. Determine whether DNS, IPv6 routing, IPv4 routing, a proxy, TLS, a captive portal, the selected mirror, or an unsupported Ubuntu release is failing before changing system-wide address selection.
An apt or dpkg lock usually means another package operation is already protecting the package database. Do not delete the lock file. Identify the owner, let healthy updates finish, terminate only a genuinely frozen frontend, then complete pending configuration and dependency repair.
Use the package database for installed ownership, repository content indexes for packages not installed, and archive queries for downloaded DEB/RPM files. These inventories describe packaged paths—not every file created later by services, scripts, or users.