Apt: Difference between revisions

From DWIKI
Tony (talk | contribs)
Tag: wikieditor
Tony (talk | contribs)
 
(7 intermediate revisions by the same user not shown)
Line 16: Line 16:


==Enabling/disabling unattended upgrades==
==Enabling/disabling unattended upgrades==
Maybe install it first
apt install unattended-upgrades
that will most likely also enable unattended upgrades
then
  dpkg-reconfigure unattended-upgrades
  dpkg-reconfigure unattended-upgrades
The dialog will show which option is selected now.
The dialog will show which option is selected now.
Line 29: Line 33:


==FAQ==
==FAQ==
===Unattended-upgrade is not upgrading all packages===
That's normal, it defaults to upgrading only security updates.
===Unattended-Upgrade::DevRelease "auto";===
===Unattended-Upgrade::DevRelease "auto";===
Only works on "dev releases", which is any not .04
Only works on "dev releases", which is any not .04
Line 48: Line 55:
=HOWTO=
=HOWTO=
==Extract files from .deb==
==Extract files from .deb==
  dpkg-deb
  dpkg -x foo.deb ~/foo
or just
also
  dpkg -e foo.deb
mkdir tmp
note: this extracts to .
  dpkg-deb -R original.deb tmp


==Pin a version==
==Pin a version==
Line 69: Line 76:
and to undo
and to undo
  apt-mark unhold somepackage
  apt-mark unhold somepackage
==Disable source in deb822 source file==
add
Enabled: no


= FAQ =
= FAQ =
==What is new style sources files called?==
==What is new style sources files called?==
deb822
deb822
== the following packages have been kept back: ==
Time to apt-get dist-upgrade ( but check [https://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade/226213#226213 ]first But it could be different things.
See https://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it
Perhaps:
apt-get upgrade package-that-is-kept-back
or try
apt install package-that-is-kept-back


==What version of a package is going to be installed?==
==What version of a package is going to be installed?==
Line 80: Line 102:


==Error messages==
==Error messages==
===InRelease doesn't support architecture 'i386'===
set ''arch=amd64''' in sources old style or '''Architectures: amd64'' new style
===E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1538337 (apt-get)===
===E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1538337 (apt-get)===


Line 88: Line 114:
again
again


===Repository changed its 'Version' value===
Try
apt-get --allow-releaseinfo-change update


===The repository 'http://security.debian.org buster/updates Release' no longer has a Release file===
===The repository 'http://security.debian.org buster/updates Release' no longer has a Release file===

Latest revision as of 14:30, 9 June 2026

Debian/Ubuntu package manager

Documentation

Phased Packages


Unattended upgrades

Enabling/disabling unattended upgrades

Maybe install it first

apt install unattended-upgrades

that will most likely also enable unattended upgrades then

dpkg-reconfigure unattended-upgrades

The dialog will show which option is selected now.

The relevant systemd service

apt-daily-upgrade.service

Disable unattended upgrades

In /etc/apt/apt.conf.d/20auto-upgrades

APT::Periodic::Unattended-Upgrade "0";

The logs

/var/log/unattended-upgrades/*.log

FAQ

Unattended-upgrade is not upgrading all packages

That's normal, it defaults to upgrading only security updates.

Unattended-Upgrade::DevRelease "auto";

Only works on "dev releases", which is any not .04

What is this Allowed-Origins about?

Check output of

apt -s upgrade

you might see something like

Conf cloud-init (25.1.2-0ubuntu0~22.04.2 Ubuntu:22.04/jammy-updates

which will match

${distro_id}:${distro_codename}-updates

No packages found that can be upgraded unattended

By default "${distro_id}:${distro_codename}-updates"; is commented out in /etc/apt/apt.conf.d/50unattended-upgrades, so to get those updated as well, uncomment that line.

HOWTO

Extract files from .deb

dpkg -x foo.deb ~/foo

also

mkdir tmp
dpkg-deb -R original.deb tmp

Pin a version


List installed packages

apt list --installed


Upgrade just one package

apt-get install --only-upgrade <packagename>


exclude package from upgrade

apt-mark hold somepackage

and to undo

apt-mark unhold somepackage


Disable source in deb822 source file

add

Enabled: no

FAQ

What is new style sources files called?

deb822


the following packages have been kept back:

Time to apt-get dist-upgrade ( but check [1]first But it could be different things. See https://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it Perhaps:

apt-get upgrade package-that-is-kept-back

or try

apt install package-that-is-kept-back

What version of a package is going to be installed?

apt-cache policy <package>

What package does a file belong to?

dpkg -S /path/to/file

Error messages

InRelease doesn't support architecture 'i386'

set arch=amd64 in sources old style or Architectures: amd64 new style

E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1538337 (apt-get)

Try

systemctl restart packagekit

and check

fuser /var/lib/apt/lists/lock 

again

Repository changed its 'Version' value

Try

apt-get --allow-releaseinfo-change update

The repository 'http://security.debian.org buster/updates Release' no longer has a Release file

time to upgrade entire system

Unable to correct problems, you have held broken packages.

Try

dpkg --get-selections | grep hold

What packages depend on package

apt-cache rdepends --installed libc6-dev

Clear cache

apt-get clean

Could not handshake: The TLS connection was non-properly terminated.

try http instead of https

Depends: but it is not going to be installed

First try

apt-get update && apt-get upgrade

E: Unable to correct problems, you have held broken packages.

Which services should be restarted?

That's from needrestart


Prevent restarting all services when installing a package

NEEDRESTART_MODE=i apt install somepackage

What repository provides package

apt policy <packagename>

Error messages

Key is stored in legacy trusted.gpg keyring

Check apt-key is deprecated


Certificate verification failed: The certificate is NOT trusted.

try

deb [trusted=yes] ...

in sources.list, but things might be worse than that, in case of launchpad change to

https://ppa.launchpadcontent.net/


apt-key is deprecated. Manage keyring files in trusted.gpg.d instead

See apt-key is deprecated

The following upgrades have been deferred due to phasing

apt install <whatever package it lists>


needrestart

Show which services need restarting

needrestart -rl

Service restarts being deferred

Probably services like networkd-dispatcher.service. Check /etc/needrestart/needrestart.conf for $nrconf{override_rc}