Ubuntu apt: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
m (Text replacement - "<source " to "<syntaxhighlight ")
m (Text replacement - "</source" to "</syntaxhighlight")
Line 16: Line 16:
   support="none";
   support="none";
}'
}'
</source>
</syntaxhighlight>


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


== Configuring a proxy for apt ==
== Configuring a proxy for apt ==
Line 73: Line 73:
   };
   };
};
};
</source>
</syntaxhighlight>
==Use this proxy config for in the shell==
==Use this proxy config for in the shell==
<syntaxhighlight 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>
</syntaxhighlight>


== Getting some packages from a newer release ==
== Getting some packages from a newer release ==
Line 85: Line 85:
<syntaxhighlight 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>
</syntaxhighlight>


=== Add new release to /etc/apt/sources.list ===
=== Add new release to /etc/apt/sources.list ===
Line 122: Line 122:
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
...
...
</source>
</syntaxhighlight>


=== Check with "apt-cache policy" which version is preferred now ===
=== Check with "apt-cache policy" which version is preferred now ===
Line 144: Line 144:
     4.0.0~alpha2-3build1 990
     4.0.0~alpha2-3build1 990
         990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
         990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
</source>
</syntaxhighlight>


=== Upgrade to the packages from the new release ===
=== Upgrade to the packages from the new release ===
Line 161: Line 161:
  pdns-tools : Depends: libstdc++6 (>= 6) but 5.4.0-6ubuntu1~16.04.5 is to be installed
  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.
E: Unable to correct problems, you have held broken packages.
</source>
</syntaxhighlight>


This shows the pinning to xenial works ;-).
This shows the pinning to xenial works ;-).
Line 169: Line 169:
# apt -t zesty install libstdc++6
# apt -t zesty install libstdc++6
...
...
</source>
</syntaxhighlight>

Revision as of 22:05, 25 November 2021


Get all non LTS packages

# 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";
}'

Ubuntu support status

$ ubuntu-support-status --show-unsupported

Configuring a proxy for apt

Put this into your /etc/apt/apt.conf.d/00proxy :

// 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";
    }
  };
};

Use this proxy config for in the shell

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

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

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

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

# apt update
...
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
...

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

# 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

Upgrade to the packages from the new release

# 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.

This shows the pinning to xenial works ;-).

Override pinning for one package

# apt -t zesty install libstdc++6
...