Ubuntu apt: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
m (Text replacement - "[[Kategorie:" to "[[Category:")
m (Text replacement - "<source " to "<syntaxhighlight ")
Line 3: Line 3:
== Get all non LTS packages ==
== Get all non LTS packages ==


<source lang=awk>
<syntaxhighlight lang=awk>
# dpkg --list | awk '/^ii/ {print $2}' | xargs apt-cache show | awk '
# dpkg --list | awk '/^ii/ {print $2}' | xargs apt-cache show | awk '
BEGIN{
BEGIN{
Line 19: Line 19:


== Ubuntu support status ==
== Ubuntu support status ==
<source lang=bash>
<syntaxhighlight lang=bash>
$ ubuntu-support-status --show-unsupported
$ ubuntu-support-status --show-unsupported
</source>
</source>
Line 25: Line 25:
== Configuring a proxy for apt ==
== Configuring a proxy for apt ==
Put this into your /etc/apt/apt.conf.d/00proxy :
Put this into your /etc/apt/apt.conf.d/00proxy :
<source lang=bash>
<syntaxhighlight lang=bash>
// Options for the downloading routines
// Options for the downloading routines
Acquire
Acquire
Line 75: Line 75:
</source>
</source>
==Use this proxy config for in the shell==
==Use this proxy config for in the shell==
<source lang=bash>
<syntaxhighlight lang=bash>
eval $(apt-config dump Acquire | awk -F '(::| )' '$3 ~ /Proxy/{printf "%s_proxy=%s\nexport %s_proxy\n",$2,$4,$2;}')
eval $(apt-config dump Acquire | awk -F '(::| )' '$3 ~ /Proxy/{printf "%s_proxy=%s\nexport %s_proxy\n",$2,$4,$2;}')
</source>
</source>
Line 83: Line 83:


=== Pin the normal release ===
=== Pin the normal release ===
<source lang=bash>
<syntaxhighlight lang=bash>
# echo 'APT::Default-Release "xenial";' > /etc/apt/apt.conf.d/01pinning
# echo 'APT::Default-Release "xenial";' > /etc/apt/apt.conf.d/01pinning
</source>
</source>
Line 117: Line 117:


=== Upgrade to the packages from the new release ===
=== Upgrade to the packages from the new release ===
<source lang=bash>
<syntaxhighlight lang=bash>
# apt update
# apt update
...
...
Line 125: Line 125:


=== Check with "apt-cache policy" which version is preferred now ===
=== Check with "apt-cache policy" which version is preferred now ===
<source lang=bash>
<syntaxhighlight lang=bash>
# apt-cache policy pdns-server pdns-tools
# apt-cache policy pdns-server pdns-tools
pdns-server:
pdns-server:
Line 147: Line 147:


=== Upgrade to the packages from the new release ===
=== Upgrade to the packages from the new release ===
<source lang=bash>
<syntaxhighlight lang=bash>
# apt install pdns-tools
# apt install pdns-tools
Reading package lists... Done
Reading package lists... Done
Line 166: Line 166:


=== Override pinning for one package ===
=== Override pinning for one package ===
<source lang=bash>
<syntaxhighlight lang=bash>
# apt -t zesty install libstdc++6
# apt -t zesty install libstdc++6
...
...
</source>
</source>

Revision as of 21:22, 25 November 2021


Get all non LTS packages

<syntaxhighlight lang=awk>

  1. dpkg --list | awk '/^ii/ {print $2}' | xargs apt-cache show | awk '

BEGIN{

 support="none";

} /^Package:/,/^$/{

 if(/^Package:/){ pkg=$2; }
 if(/^Supported:/){ support=$2; }
 if(/^$/ && support != "5y"){ printf "%s:\t%s\n", pkg, support; }

} /^$/ {

 support="none";

}' </source>

Ubuntu support status

<syntaxhighlight lang=bash> $ ubuntu-support-status --show-unsupported </source>

Configuring a proxy for apt

Put this into your /etc/apt/apt.conf.d/00proxy : <syntaxhighlight lang=bash> // Options for the downloading routines Acquire {

 Queue-Mode "host";       // host|access
 Retries "0";
 Source-Symlinks "true";
 // HTTP method configuration
 http
 {
   //Proxy::http.us.debian.org "DIRECT";  // Specific per-host setting
   Proxy "http://<user>:<password>@<proxy-host>:<proxy-port>";
   Timeout "120";
   Pipeline-Depth "5";
   // Cache Control. Note these do not work with Squid 2.0.2
   No-Cache "false";
   Max-Age "86400";     // 1 Day age on index files
   No-Store "false";    // Prevent the cache from storing archives
 };
 ftp
 {
   Proxy "http://<user>:<password>@<proxy-host>:<proxy-port>";
   //Proxy::http.us.debian.org "DIRECT"; // Specific per-host setting
   Timeout "120";
   /* Passive mode control, proxy, non-proxy and per-host. Pasv mode
      is prefered if possible */
   Passive "true";
   Proxy::Passive "true";
   Passive::http.us.debian.org "true"; // Specific per-host setting
 };
 cdrom
 {
   mount "/cdrom";
   // You need the trailing slash!
   "/cdrom"
   {
      Mount "sleep 1000";
      UMount "sleep 500";
   }
 };

}; </source>

Use this proxy config for in the shell

<syntaxhighlight lang=bash> eval $(apt-config dump Acquire | awk -F '(::| )' '$3 ~ /Proxy/{printf "%s_proxy=%s\nexport %s_proxy\n",$2,$4,$2;}') </source>

Getting some packages from a newer release

In this example we are living in xenial and want PowerDNS from zesty because we need CAA records in the nameservice.

Pin the normal release

<syntaxhighlight lang=bash>

  1. echo 'APT::Default-Release "xenial";' > /etc/apt/apt.conf.d/01pinning

</source>

Add new release to /etc/apt/sources.list

This is the /etc/apt/sources.list on my x86 64bit Ubuntu:

# Xenial
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ xenial main restricted universe
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu xenial-security main restricted universe
# Zesty
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ zesty main restricted universe
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ zesty-updates main restricted universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu zesty-security main restricted universe

Tell apt via /etc/apt/preferences.d/... to prefer some packages from the new release

This is the /etc/apt/preferences.d/pdns:

Package: pdns-*
Pin: release a=zesty, l=Ubuntu
Pin-Priority: 1000

Package: pdns-*
Pin: release a=zesty-updates, l=Ubuntu
Pin-Priority: 1000

Package: pdns-*
Pin: release a=zesty-security, l=Ubuntu
Pin-Priority: 1000

Upgrade to the packages from the new release

<syntaxhighlight lang=bash>

  1. apt update

... 2 packages can be upgraded. Run 'apt list --upgradable' to see them. ... </source>

Check with "apt-cache policy" which version is preferred now

<syntaxhighlight lang=bash>

  1. apt-cache policy pdns-server pdns-tools

pdns-server:

 Installed: 4.0.3-1
 Candidate: 4.0.3-1
 Version table:
*** 4.0.3-1 1000
       500 http://de.archive.ubuntu.com/ubuntu zesty/universe amd64 Packages
       100 /var/lib/dpkg/status
    4.0.0~alpha2-3build1 990
       990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

pdns-tools:

 Installed: (none)
 Candidate: 4.0.3-1
 Version table:
    4.0.3-1 1000
       500 http://de.archive.ubuntu.com/ubuntu zesty/universe amd64 Packages
    4.0.0~alpha2-3build1 990
       990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

</source>

Upgrade to the packages from the new release

<syntaxhighlight lang=bash>

  1. apt install pdns-tools

Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies:

pdns-tools : Depends: libstdc++6 (>= 6) but 5.4.0-6ubuntu1~16.04.5 is to be installed

E: Unable to correct problems, you have held broken packages. </source>

This shows the pinning to xenial works ;-).

Override pinning for one package

<syntaxhighlight lang=bash>

  1. apt -t zesty install libstdc++6

... </source>