Tag: apt

  • apt The method driver /usr/lib/apt/methods/https could not be found

    When running apt update on a Debian server, i get error

    root@shop:~# apt-get update
    E: The method driver /usr/lib/apt/methods/https could not be found.
    N: Is the package apt-transport-https installed?
    root@shop:~# 
    

    apt https error

    To fix the error, run

    apt-get install apt-transport-https ca-certificates
    

    See apt

  • Debian 8 jessie repo error

    On a Debian 8 server, when running apt update, got following error

    W: Failed to fetch http://mirror.com/debian/dists/jessie/main/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/non-free/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/contrib/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/main/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/non-free/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/contrib/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/main/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/non-free/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/contrib/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/main/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/contrib/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/non-free/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/contrib/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/non-free/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/main/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/contrib/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/non-free/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    

    To fix it, run

    cp /etc/apt/sources.list /etc/apt/sources.list.backup
    vi /etc/apt/sources.list
    

    Add following content to the file

    deb http://cdn-fastly.deb.debian.org/debian/ jessie main
    deb-src http://cdn-fastly.deb.debian.org/debian/ jessie main
    deb http://security.debian.org/ jessie/updates main
    deb-src http://security.debian.org/ jessie/updates main
    deb http://archive.debian.org/debian jessie-backports main
    deb-src http://archive.debian.org/debian jessie-backports main
    

    Create

    vi /etc/apt/apt.conf
    

    Add

    Acquire::Check-Valid-Until "false";
    
  • Reinstall a package using apt

    To reinstall a package, run

    apt install --reinstall PKG_NAME
    

    Example

    apt reinstall

    dpkg apt

  • apt show

    apt show command shows information about a package.

    root@ok-vm:~# apt show apache2
    Package: apache2
    Version: 2.4.18-2ubuntu3.5
    Priority: optional
    Section: web
    Origin: Ubuntu
    Maintainer: Ubuntu Developers 
    Original-Maintainer: Debian Apache Maintainers 
    Bugs: https://bugs.launchpad.net/ubuntu/+filebug
    Installed-Size: 501 kB
    Provides: httpd, httpd-cgi
    Pre-Depends: dpkg (>= 1.17.14)
    Depends: lsb-base, procps, perl, mime-support, apache2-bin (= 2.4.18-2ubuntu3.5), apache2-utils (>= 2.4), apache2-data (= 2.4.18-2ubuntu3.5)
    Recommends: ssl-cert
    Suggests: www-browser, apache2-doc, apache2-suexec-pristine | apache2-suexec-custom, ufw
    Conflicts: apache2.2-bin, apache2.2-common
    Replaces: apache2.2-bin, apache2.2-common
    Homepage: http://httpd.apache.org/
    Task: lamp-server, mythbuntu-frontend, mythbuntu-desktop, mythbuntu-backend-slave, mythbuntu-backend-master, mythbuntu-backend-master
    Supported: 5y
    Download-Size: 86.7 kB
    APT-Manual-Installed: yes
    APT-Sources: http://azure.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
    Description: Apache HTTP Server
     The Apache HTTP Server Project's goal is to build a secure, efficient and
     extensible HTTP server as standards-compliant open source software. The
     result has long been the number one web server on the Internet.
     .
     Installing this package results in a full installation, including the
     configuration files, init scripts and support scripts.
    
    N: There is 1 additional record. Please use the '-a' switch to see it
    root@ok-vm:~# 
    

    See apt policy apt

  • subprocess installed post-installation script returned error

    When installing software on Ubuntu, i get following error.

    It is likely that 4.5.2-armada375 belongs to a chroot's host
    Building only for 4.9.58-armada375
    Building initial module for 4.9.58-armada375
    Error! Bad return status for module build on kernel: 4.9.58-armada375 (armv7l)
    Consult /var/lib/dkms/spl/0.6.5.6/build/make.log for more information.
    dpkg: error processing package spl-dkms (--configure):
     subprocess installed post-installation script returned error exit status 10
    Setting up dh-python (2.20151103ubuntu1) ...
    Processing triggers for libc-bin (2.23-0ubuntu3) ...
    Errors were encountered while processing:
     spl-dkms
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    To fix this, run

    rm /var/lib/dpkg/info/PACKAGE_NAME_HERE.*
    dpkg --configure -a
    apt update
    

    Replace PACKAGE_NAME_HERE with actual package that fail. In this cause spl-dkms.

    root@ns539260:/var/lib/dpkg/info# ls -l | grep spl
    -rw-r--r-- 1 root root   11811 Nov 22 07:41 spl-dkms.list
    -rw-r--r-- 1 root root   19548 Apr  7  2016 spl-dkms.md5sums
    -rwxr-xr-x 1 root root     891 Apr  7  2016 spl-dkms.postinst
    -rwxr-xr-x 1 root root     312 Apr  7  2016 spl-dkms.prerm
    root@ns539260:/var/lib/dpkg/info# rm spl-dkms.*
    

    See apt

  • add-apt-repository

    add-apt-repository command can be used to add repository in ubuntu.

    To install, run

    apt-get install software-properties-common python-software-properties
    

    Example

    apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
    add-apt-repository https://dl.hhvm.com/ubuntu
    
  • apt

    List all Dependencies for a package.

    apt depends PKG_NAME

    If you don’t want to upgrade a package, you can use apt-mark command to hold it, the package won’t be upgraded

    apt-mark hold 5.15.0-107-generic

    If you want to remove the hold and allow the package to be upgraded, use

    apt-mark unhold 5.15.0-107-generic

    Errors

    This website allow you to generate /etc/apt/sources.list file for Ubuntu/Debian.

    https://repogen.simplylinux.ch

    This is helpful when you need to recreate your repo file.

    Errors

    apt fail after MariaDB to MySQL change