meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:general:apt [2015/06/25 10:47]
niziak
linux:general:apt [2021/09/26 07:47] (current)
niziak
Line 1: Line 1:
-Install specified version+====== APT ====== 
 + 
 +===== Configuration ===== 
 + 
 +==== Force IPv4 ==== 
 + 
 +<code bash> 
 +echo '​Acquire::​ForceIPv4 "​true";'​ | sudo tee /​etc/​apt/​apt.conf.d/​99force-ipv4 
 +</​code>​ 
 + 
 +==== Limit download speed === 
 +To limit download speed to 250kBytes/​s:​ 
 + 
 +<file python /​etc/​apt/​apt.conf.d/​75lowerspeed>​ 
 +Acquire 
 +
 +   ​Queue-mode "​access";​ 
 +   ​http 
 +   { 
 +      Dl-Limit "​250";​ 
 +   }; 
 +}; 
 +</​file>​ 
 + 
 +==== Use apt-cacher ==== 
 +<file | /​etc/​apt/​apt.conf.d/​02proxy>​ 
 +Acquire::​http { Proxy "​http://​192.168.0.231:​3142";​ }; 
 +Acquire::​https::​proxy "​DIRECT";​ 
 +</​file>​ 
 +or 
 +Replace all mirror hostnames with cachinghost/​hostname in sources.list,​ so 
 +<​code>​deb http://​ftp.uni-kl.de/​debian etch main</​code>​ 
 + 
 +should now become: 
 +<​code>​deb http://​192.168.0.17:​3142/​ftp.uni-kl.de/​debian etch main</​code>​ 
 + 
 +====== Commandline ====== 
 + 
 +===== Disable fsync ===== 
 + 
 +This trick helps on BTRFS FS 
 +<code bash> 
 +apt-get install eatmydata 
 +eatmydata apt-get update 
 +</​code>​ 
 + 
 +Or wrap some commands permanently with eatmydata 
 +<code bash> 
 +ln -s /​usr/​bin/​eatmydata /​usr/​local/​bin/​aptitude 
 +ln -s /​usr/​bin/​eatmydata /​usr/​local/​bin/​apt-get 
 +ln -s /​usr/​bin/​eatmydata /​usr/​local/​bin/​apt-cache 
 +</​code>​ 
 + 
 +===== Playing with apt keys ===== 
 + 
 +<code bash> 
 +sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 8B48AD6246925553 
 +</​code>​ 
 + 
 +<code bash> 
 +sudo apt-get install debian-archive-keyring 
 +wget http://​ftp.pl.debian.org/​debian/​pool/​main/​p/​pkg-mozilla-archive-keyring/​pkg-mozilla-archive-keyring_1.1_all.deb 
 +sudo dpkg -i pkg-mozilla-archive-keyring_1.1_all.deb 
 +sudo apt-get update 
 +</​code>​ 
 + 
 +<code bash> 
 +gpg --keyserver pgpkeys.mit.edu --recv-key ​ 8B48AD6246925553 ​      
 +gpg -a --export 8B48AD6246925553 | sudo apt-key add - 
 +</​code>​ 
 + 
 +<code bash> 
 +apt-get update 2> /​tmp/​keymissing;​ for key in $(grep "​NO_PUBKEY"​ /​tmp/​keymissing |sed "​s/​.*NO_PUBKEY //"); do echo -e "​\nProcessing key: $key"; gpg --keyserver keyserver.ubuntu.com --recv $key && sudo gpg --export --armor $key | apt-key add -; done 
 +</​code>​ 
 +===== List all package versions ===== 
 + 
 +<code bash>​apt-cache policy lxc</​code>​ 
 +<​code>​ 
 +lxc: 
 +  Installed: 1:​1.0.6-6+deb8u2 
 +  Candidate: 1:1.1.5-1 
 +  Version table: 
 +     ​1:​1.1.5-1 0 
 +        500 http://​ftp.pl.debian.org/​debian/​ stretch/​main amd64 Packages 
 + *** 1:​1.0.6-6+deb8u2 0 
 +        100 /​var/​lib/​dpkg/​status 
 + 
 +</​code>​ 
 + 
 +===== Install specified version ​=====
 <​code>​ <​code>​
 apt-get install backupninja=0.9.8.1-1 apt-get install backupninja=0.9.8.1-1
 apt-mark hold backupninja apt-mark hold backupninja
 </​code>​ </​code>​
 +
 +===== Install with low prio questions =====
 +To change dpkg-configure question priorities:
 +<code bash>​DEBIAN_PRIORITY=low apt-get install ...</​code>​
 +
 +===== Install from backports =====
 +List version and priorities:
 +<​code>​apt-cache policy pulseaudio</​code>​
 +<​code>​apt-get install -t jessie-backports pulseaudio</​code>​
 +<​code>​aptitude -t jessie-backports</​code>​
 +
 +<file | /​etc/​apt/​preferences.d/​backports>​
 +Package: *
 +Pin: release a=jessie-backports
 +Pin-Priority:​ 500
 +
 +Package: *
 +Pin: release a=stretch-backports
 +Pin-Priority:​ 500
 +</​file>​
 +
 +===== Hold package =====
 +<code bash>​echo package_name hold | sudo dpkg --set-selections</​code>​
 +
 +
 +====== Errors ======
 +
 +===== trying to overwrite ​ =====
 +<​code>​
 +dpkg: error processing archive /​var/​cache/​apt/​archives/​gstreamer1.0-plugins-base_1.18.4-2_amd64.deb (--unpack):
 + ​trying to overwrite '/​usr/​lib/​x86_64-linux-gnu/​gstreamer-1.0/​libgstcompositor.so',​ which is also in package gstreamer1.0-plugins-bad:​amd64 1:​1.14.4-dmo7+deb10u1
 +dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
 +Errors were encountered while processing:
 + /​var/​cache/​apt/​archives/​gstreamer1.0-plugins-base_1.18.4-2_amd64.deb
 +Config is in use.
 +</​code>​
 +
 +<code bash>
 +apt-get -f -o Dpkg::​Options::​="​--force-overwrite"​ install
 +</​code>​
 +
 +
 +===== BADSIG ===== 
  
 Error: Error:
 +<​code>​
 http://​httpredir.debian.org squeeze-lts Release: The following signatures were invalid: BADSIG 8B48AD6246925553 Debian Archive Automatic Signing Key (7.0/​wheezy) <​ftpmaster@debian.org>​ http://​httpredir.debian.org squeeze-lts Release: The following signatures were invalid: BADSIG 8B48AD6246925553 Debian Archive Automatic Signing Key (7.0/​wheezy) <​ftpmaster@debian.org>​
 +</​code>​
  
 <code bash> <code bash>
Line 16: Line 150:
  
 This will rebuild the cache. This will rebuild the cache.
 +
 +Error:
 +<​code>​
 +W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://​repository.spotify.com stable InRelease: The following signatures couldn'​t be verified because the public key is not available: NO_PUBKEY 13B00F1FD2C19886
 +</​code>​
 +
 +<code bash>​sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 13B00F1FD2C19886</​code>​
 +
 +
 +===== Download is performed unsandboxed =====
 +Warning:
 +<​code>​
 +W: Download is performed unsandboxed as root as file '/​var/​cache/​apt/​archives/​partial/​libnet-cidr-lite-perl_0.21-1_all.deb'​ couldn'​t be accessed by user '​_apt'​. - pkgAcquire::​Run (13: Permission denied)
 +</​code>​
 +<code bash>
 +
 +sudo chown -Rv _apt:root /​var/​cache/​apt/​archives/​
 +sudo chmod -Rv 774 /​var/​cache/​apt/​archives/​
 +
 +</​code>​