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

Tweaking GNOME Desktop Environment on CentOS 8

In this article, I am going to show you how to tweak CentOS 8 GNOME 3 Desktop Environment. So, let’s get started. Installing...
29/12/2020

How to install KeePass 2.36 on Ubuntu 17.04 and below

KeePass 2.36 recently released, is a safe password management application for people looking to secure their personal data....
28/12/2020

5 Best Screen Recorders for Ubuntu

Often times, we find ourselves in a position where we have to record our desktop screen such as broadcasting your live...
29/12/2020
Bài Viết

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

 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

Dịch Vụ Thiết Lập Hệ Thống Tường Lửa (Firewall)
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ảo Hóa & Cloud
04/04/2025