Uninstall Ubuntu and Debian packages with apt-get and dpkg

28/12/2020
Chưa phân loại

We already saw how to create Debian packages, now we’ll see how to remove them. Removing packages in Debian or Ubuntu Linux from the console is very easy, your user must be in the sudoers or you’ll need root access.

Identify the package to delete: dpkg –list

dpkg –-list will show you a list of packages, in this case the distribution used for the image is Kali Linux.

Let’s remove Skype using apt-get and dpkg commands:

Removing skypeforlinux using apt-get

For Ubuntu the correct method to remove packages through the console is:

apt-get –-purge remove skypeforlinux

The parameter –-remove will remove installation files while keeping configuration data, by adding –-purge” we instruct to remove configuration files too.

Removing skypeforlinux using dpkg

We can remove Skype replacing apt-get with dpkg like in the following example:

dpkg –-remove skypeforlinux

We can use also

dpkg –r packagename.deb

(Where “packagename” is replaced by the package’s name.)


Removing Broken Packages

In order to remove broken packages, or packages which weren’t fully installed we will run

apt-get clean && apt-get autoremove
sudo apt-get -f install
dpkg –configure -a

Details:
clean:
Removes cache of programs older than the installed.
autoremove: Removes unnecessary files, like dependencies which are not longer needed.
-f / –fix-broken install: Fix broken dependencies, correct possible package corruption problems. We’ll see this option deeply later.

Troubleshooting

For different reasons a package’s removal, or a package’s installation may return errors. The most popular causes for such errors are old programs, partially installed packages, corrupted packages, outdated repositories at etc/apt/sources.list, etc. The following commands and their order are basic to solve initial problems in the packages manager. If you are experiencing problems installing or uninstalling software on Ubuntu 12.04 or higher or Debian, run the following commands:

#apt-get update
#dpkg –-configure -a
#apt-get -f install
#apt-get clean

apt-get update: Updates the packages’ list in the repositories.
dpkg –configure -a: This command checks for dependency problems to fix.
apt-get -f install: Another command to fix dependency problems.
apt-get autoclean: clean unnecessary dependencies.

Check if packages are being held by the packages manager

To check if the installer holds packages pending of installation run:

apt-get -u dist-upgrade

This will show you held packages. If listed, to remove packages run:

apt-get remove –dry-run packagename
ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Kubernetes ReplicaSet Tutorial

Kubernetes is often seen as this huge body of interrelated concepts like nodes and pods , services, deployments, etc which...
29/12/2020

How to install KDE Plasma 5.8 LTS on Ubuntu 16.10, Ubuntu 16.04

KDE Plasma 5.8 LTS was released late last year – October, but got updated in the Kubuntu backports PPA end of December...
28/12/2020

Bash builtin examples

builtin candidate_builtin arg … in bash allows you to only call bash builtins. That is, even if an external command or...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Hướng dẫn fake ip bằng phần mềm SStap
10/06/2025

VPS treo game là gì? Thuê VPS treo game giá rẻ, không lo giật lag
02/06/2025

 BitBrowser – Best Anti-Detect Browser!
26/05/2025

Dịch Vụ Xây Dựng Hệ Thống Peering Với Internet Exchange (IXP)
04/04/2025

Dịch Vụ Triển Khai VPN Site-to-Site & Remote Access
04/04/2025