Fixing Updating from such a repository can’t be done securely error in Ubuntu
Troubleshooting

How to Fix the “Updating from such a repository can’t be done securely”

Sagar Sharma
Sagar Sharma

Table of Contents

The other day, after adding a repository to my system, and when I updated my repositories, it gave me an error:

Updating from such a repository can’t be done securely error in ubuntu

It says "Updating from such a repository can't be done securely, and is therefore disabled by default".

And in this tutorial, I will explain the reason behind this error and how it can be solved.

The reason behind this error

The main reason why the error is troubling you is you've added outdated sources in your system. You probably added a PPA that is not available for your current Ubuntu version.

Also, another main reason can be (like in my case), the IP that the repository is trying to connect to is not valid anymore. So my system ignored the repository.

How to solve this error?

There are two ways to do it:

  • Adding the [trusted=yes] flag for that repository
  • Removing the faulted repository

I would advise you to use the first solution and if you still encounter the error, you can proceed to the 2nd method.

Method 1: Add a trusted flag to the repository

Most of the users will find the faulted repository in the sources.list file which can be accessed using the following command:

sudo nano /etc/apt/sources.list

But due to some reason if you can't find it, here's another way.

First, change the directory to /etc/apt/sources.list.d using the following:

cd /etc/apt/sources.list.d && ls

Here, you will find the name of that repository.

Once you do so, you can use any of your preferred text editors with superuser privileges to modify the file:

sudo nano <repo-name>

From here, the steps will remain the same if you're editing sources.list file or editing the repository file manually as shown above.

Once you find the repository, all you have to do is add [trusted=yes] after the deb followed by space as shown:

deb [trusted=yes] http://ppa.launchpad.net/repository
How to fix the “Updating from such a repository can’t be done securely”

Save changes and exit from the nano text editor.

Now, you can update and the error won't be there.

And if the error still persists, you can remove the PPA by following the 2nd method I'm about to show you.

Method 2: Remove the faulty PPA

To remove the PPA from Ubuntu, first, change the directory to /etc/apt/sources.list.d and list its contents using the following:

cd /etc/apt/sources.list.d && ls
change directory and list its contents

Find the repository and remove it using the rm command as shown:

sudo rm -i PPA-name

Type Y and press enter as shown:

remove PPA from ubuntu

And now, if you'd try to update the system repo, the error should no longer be there:

update ubuntu system

That's it!

Want to automate things in Ubuntu? I got you

If you want to automate the command or script execution after a certain time frame, you can use the cron table.

Want to learn how to do so, here's a detailed guide:

Run Cron Jobs Every 5, 10, or 15 Minutes in Ubuntu
Here’s a quick example that shows how to run cron jobs every 5, 10 or 15 minutes in Linux.

I hope you will find this interesting.



Sagar Sharma

Sagar Sharma

A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.