How to Fix Unable to Install Apps in Ubuntu?

Are you trying to install a new tool or an application on your Ubuntu system but constantly encountering errors?

Installing applications in an Ubuntu System is not a very complicated process. However, there are various errors that one can encounter while trying to install applications or tools on Ubuntu. Understanding these error statements and resolving these errors can be quite complicated, especially if you are a new Linux/Ubuntu Operating System.

This guide will explain all the major errors you can encounter while installing apps in Ubuntu and provide solutions to resolve them.

How to Fix Unable to Install Apps in Ubuntu?

Ensure that the DPKG is not locked, meaning that any other installation or update does not consume it. If it is, find the process ID and kill it using the “kill” command to free up the dpkg installer. If a package is not found in the repo, then fix it by updating your “Apt” packages list.

Another method of fixing the package that was not found in the repo is to ensure there are no spelling mistakes. Otherwise, you can manually add the link to the applications repo in your “Apt” packages list.

Fix: Could not get lock /var/lib/apt/lists/lock

If you try installing an application using the “apt” package manager, you can encounter the error with the statement “could not get lock /var/lib/apt/lists/lock.” This error is caused by the dpkg being consumed by another process.

How to Fix Unable to Install Apps in Ubuntu?

If you have just turned on your Ubuntu system and the apt command is giving this error, then the most simple solution for this error is to wait it out simply. As mentioned earlier, this error is caused when the “dpkg” is busy with another process, which is quite common right after the bootup.

However, if that doesn’t fix the error for you, then you can choose the second method to kill the process holding the “dpkg.” To do this, you need to find the process ID of the process that is consuming the dpkg, which can be done by observing the error message.

In the image above, you can see the statement, “It is held by process 144,” which shows the process with PID 1454 is the culprit. To kill this process, use the following kill command template.

sudo kill -9 <process_ID>

Once you run the kill command, you will be prompted to provide the password for the sudo user. Type the password and press the “Enter” Key to continue.

How to Fix Unable to Install Apps in Ubuntu?

Once the process has been killed, you can rerun your installation or any other “apt” command, which will work flawlessly.

How to Fix Unable to Install Apps in Ubuntu?

However, if you are having difficulty figuring out the process ID or if you are getting the “dpkg lock”  while trying to install or update an app using the Ubuntu Software Center, the error message might not contain the process ID of the culprit.

In this case, you can remove the “dpkg lock” by running the following commands in the terminal.

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

However, this method will leave your system vulnerable. Therefore, it is not the method that should be applied as a go-to solution.

Fix: SubProcess Return an Error Code (1)

Another error that is related to the “dpkg” is the interruption in the installation caused by the “dpkg subprocess returned an error code(1)”. Like the previous error, this can occur while installing the application using the terminal or the software center.

This error is caused by misconfiguration of the dpkg or broken dependencies. To solve the issue of dpkg misconfiguration. Open up a terminal session and type in the following command inside it.

sudo dpkg --configure -a

This command has no output prompt to display successful execution. However, if no error messages are shown as an output, the command was successful.

How to Fix Unable to Install Apps in Ubuntu?

After that, try installing your desired application, which should work perfectly. However, if broken dependencies cause the error, you can use two different commands. The first is a flag “-f” that can be placed inside the “Apt” install commands to force the installation even if there is a dependency issue.

Assume that you want to install chromium, and then you will use the following command.

sudo apt-get -f install chromium-bsu

The “-f” flag will force the installation to continue despite dependency. When prompted about the confirmation, type “Y” and press the “Enter” key to continue.

How to Fix Unable to Install Apps in Ubuntu?

If you want to fix the issue of the broken dependencies and then proceed to the installation process, you can run the command with the “–fix-broken” flag inside the terminal.

sudo apt install --fix-broken chromium-bsu

This command will figure out the dependencies, resolve them, and then move on to the installation process of the required application.

Affordable VPS Hosting With Dracula Servers

Looking for reliable and budget-friendly Virtual Private Server (VPS) hosting? Look no further than Dracula Servers. Dracula Servers offers a range of VPS hosting plans tailored to meet diverse needs. With competitive pricing, robust performance, and a user-friendly interface, it’s an excellent choice for individuals and businesses alike.

Explore the Dracula Servers website to discover hosting solutions that align with your requirements and take your online presence to new heights with their affordable and efficient VPS hosting services.

Visit Dracula Servers and experience reliable VPS hosting without breaking the bank.

Fix: Unable to Locate Package

You might be confused if you are new to Linux or Debian Operating System (Ubuntu), as most applications have different names and package names in the apt repository. Therefore, you can encounter the error “unable to locate package” while installing a new package.

Let’s take an example to demonstrate this: Node, the Javascript runtime engine, is compatible with Linux/Ubuntu and is available in the default apt packages list. However, the package name is different from “Node,” so you will get the following error prompt:

How to Fix Unable to Install Apps in Ubuntu?

To resolve this error, you often need to visit the official website of the application you want to install to get the correct package name. For Node, the package name is “nodejs,” and you will not encounter any errors by using “nodejs.”

How to Fix Unable to Install Apps in Ubuntu?

If you are encountering the same error when you know the correct name of the package inside the apt list, you have to look for a spelling mistake in the package name. As we all know, making a type is quite common and very humane.

How to Fix Unable to Install Apps in Ubuntu?

There is another scenario where typing the correct package name can return this error. You can get the same error if you have added a PPA repository to your apt list and tried installing the application immediately.

Well, this is because you have to update the apt packages list after adding a PPA repository. Otherwise, the apt will not be able to detect the changes. Therefore, before running the install command, run the following command inside the terminal.

sudo apt update

How to Fix Unable to Install Apps in Ubuntu?

Once you have updated the apt packages list, you can try installing the application from the newly added PPA repo by using the “apt install” command.

Fix: Software Center Stuck in Downloading/Installing

Suppose you use the software center to install the application on your Ubuntu system, and the downloading or installation process is in the middle without any error prompts. In that case, there are several reasons for this.

How to Fix Unable to Install Apps in Ubuntu?

The first reason is your network connection. Ensure the network connection works perfectly, and rerun the installation process.

How to Fix Unable to Install Apps in Ubuntu?

However, if there is no network connectivity issue on your end, you can change the application installation source from within the Ubuntu software. To do this, locate the source drop-down list from the top-right side of the application’s detail page.

How to Fix Unable to Install Apps in Ubuntu?

Click on it to view all available sources, and choose a separate one.

How to Fix Unable to Install Apps in Ubuntu?

Click on the “install” button to rerun the installation process, and it will work perfectly without getting stuck in the middle.

How to Fix Unable to Install Apps in Ubuntu?

Conclusion

First, to fix the error of not installing the application or tools in the Ubuntu Operating System using the terminal or the Software Center, ensure that the dpkg is not busy with another process.

If the dpkg is held by another process, you must find the process ID and kill it using the kill command. If you can’t find the process ID, you can remove the dpkg locks. If broken packages cause the error or dependencies, you can use the “-f” flag to force installation or the “–fix-broken” to fix the dependencies.

However, the “apt install” can return the “unable to locate package.” error if you are using the incorrect package name of the application or making a typo in the name. The same error can occur if you added a new PPA repository but didn’t update the apt packages list.

Lastly, if your Software center is stuck midway through the installation process, ensure that the network connectivity of your system is working perfectly. Otherwise, change the source of the application from the drop-down list.

Check out More Linux Tutorials Here!

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
× Dracula Servers

Subscribe to DraculaHosting and get exclusive content and discounts on VPS services.