APT: Difference between revisions

From Leo's Notes
This page was last edited on 22 September 2020, at 01:30.
Created page with "To list installed packages: dpkg -l To look for a specific package by name: dpkg -l <package name> To determine the origin of a file: dpkg -S <path to file> eg: # dpkg ..."
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
To list installed packages:
APT is the package manager on Debian based Linux distributions and includes {{code|apt-get}} and {{code|dpkg}} and related utilities.
dpkg -l


To look for a specific package by name:
==Usage==
dpkg -l <package name>
{| class="wikitable"
!Task
!Command
|-
|Install a package by name
|{{highlight|lang=terminal|code=
# apt-get install <package>
}}
|-
|Remove a package by name
|{{highlight|lang=terminal|code=
# apt-get remove --purge
# apt-get autoremove <package>
}}
|-
|Upgrade a package
|{{highlight|lang=terminal|code=
# apt-get update
# apt-get upgrade <package>
}}
|-
|Search for a package
|{{highlight|lang=terminal|code=
# apt-cache search <package>
}}Apt gathers all the commands together, so you can now do:
{{Highlight
| code = # apt search package
| lang = terminal
}}
|-
|List installed packages
|{{highlight|lang=terminal|code=
# dpkg -l
}}
|-
|Look for a specific package by name
|{{highlight|lang=terminal|code=
# dpkg -l <package name>
}}
|-
|Determine which package provided a file
|{{highlight|lang=terminal|code=
# dpkg -S <path to file>
}}


To determine the origin of a file:
|}
dpkg -S <path to file>


eg:
== Troubleshooting ==
# dpkg -S /etc/rc3.d/
sysv-rc


=== Couldn't create temporary file /tmp/apt.conf.* for passing config to apt-key ===
On a clean install of Raspbian Buster, I got:
{{Highlight
| code = # apt-get update
Get:1 https://repos.influxdata.com/debian buster InRelease [4,731 B]
Err:1 https://repos.influxdata.com/debian buster InRelease
  Couldn't create temporary file /tmp/apt.conf.EiuAqc for passing config to apt-key
Get:2 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Err:3 http://raspbian.raspberrypi.org/raspbian buster InRelease
  Couldn't create temporary file /tmp/apt.conf.pRhbYl for passing config to apt-key
Err:2 http://archive.raspberrypi.org/debian buster InRelease
  Couldn't create temporary file /tmp/apt.conf.wZl0Lq for passing config to apt-key
Reading package lists... Done
W: GPG error: https://repos.influxdata.com/debian buster InRelease: Couldn't create temporary file /tmp/apt.conf.EiuAqc for passing config to apt-key
E: The repository 'https://repos.influxdata.com/debian buster InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://raspbian.raspberrypi.org/raspbian buster InRelease: Couldn't create temporary file /tmp/apt.conf.pRhbYl for passing config to apt-key
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.raspberrypi.org/debian buster InRelease: Couldn't create temporary file /tmp/apt.conf.wZl0Lq for passing config to apt-key
| lang = terminal
}}
It turns out /tmp wasn't configured with the right permissions and only root could write to it. To fix this, run:
{{Highlight
| code = # chmod 1777 /tmp
| lang = terminal
}}<br />{{Navbox Linux}}
[[Category:Linux]]
[[Category:Linux]]
 
[[Category:PackageManagement]]
[[Category:TipsnTricks]]

Latest revision as of 01:30, 22 September 2020

APT is the package manager on Debian based Linux distributions and includes apt-get and dpkg and related utilities.

Usage

Task Command
Install a package by name
# apt-get install <package>
Remove a package by name
# apt-get remove --purge
# apt-get autoremove <package>
Upgrade a package
# apt-get update
# apt-get upgrade <package>
Search for a package
# apt-cache search <package>
Apt gathers all the commands together, so you can now do:
# apt search package
List installed packages
# dpkg -l
Look for a specific package by name
# dpkg -l <package name>
Determine which package provided a file
# dpkg -S <path to file>

Troubleshooting

Couldn't create temporary file /tmp/apt.conf.* for passing config to apt-key

On a clean install of Raspbian Buster, I got:

# apt-get update
Get:1 https://repos.influxdata.com/debian buster InRelease [4,731 B]
Err:1 https://repos.influxdata.com/debian buster InRelease
  Couldn't create temporary file /tmp/apt.conf.EiuAqc for passing config to apt-key
Get:2 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Err:3 http://raspbian.raspberrypi.org/raspbian buster InRelease
  Couldn't create temporary file /tmp/apt.conf.pRhbYl for passing config to apt-key
Err:2 http://archive.raspberrypi.org/debian buster InRelease
  Couldn't create temporary file /tmp/apt.conf.wZl0Lq for passing config to apt-key
Reading package lists... Done
W: GPG error: https://repos.influxdata.com/debian buster InRelease: Couldn't create temporary file /tmp/apt.conf.EiuAqc for passing config to apt-key
E: The repository 'https://repos.influxdata.com/debian buster InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://raspbian.raspberrypi.org/raspbian buster InRelease: Couldn't create temporary file /tmp/apt.conf.pRhbYl for passing config to apt-key
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.raspberrypi.org/debian buster InRelease: Couldn't create temporary file /tmp/apt.conf.wZl0Lq for passing config to apt-key

It turns out /tmp wasn't configured with the right permissions and only root could write to it. To fix this, run:

# chmod 1777 /tmp