Score:2

How to remove balena etcher to fix "failed to fetch" error during "sudo apt update" on ubuntu?

nl flag

I received the following error while updating Ubuntu 20.04 with sudo apt update.

E: Failed to fetch https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu/dists/focal/InRelease  402  Payment Required [IP: 18.160.249.56 443]
E: The repository 'https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu focal InRelease' is no longer signed.

I have looked into what is necessary and it seems that the ppa (https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu) used by balena etcher is no longer signed. However, I was not sure of what exactly will fix this.

This question is to help anyone who comes across a similar situation. Basically, what I am looking forward to is the exact set of steps that will resolve this issue.

Generic problem statement: You have some ppa's on your system and for some reason they could be stale and that is effectively blocking the sudo apt update process. What do you need to fix this?

Note: This question was originally opened on Stackoverflow and then moved here.

Score:0
nl flag

Solution

The problem here is with a stale ppa. There are a few ways to approach this problem, as shown here.

Step(s) Necessary to remediate the original error

Run the following command. Please note that since the ppa in question here is not of the form https://ppa.launchpad.net/x/y/ppa/ubuntu, we cannot straight away use the syntax ppa:x/y as suggested by these solutions: [1], [2], [3].

Important: See this suggestion, which ultimately worked for me.

sudo apt-add-repository --remove https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu

Once you run this, run the following two commands and you should not find anything as shown in A and B below.

# this should return empty result (as this file must no-longer exist)
ls /etc/apt/sources.list.d/balena-etcher.list

# this should show the default repository for balena (not the ppa)
apt policy | grep "balena"

Once you have verified this, run:

sudo apt update

If you need to remove any GPG security keys alongside, refer to this. This will help in determining the key. And follow this to remove it, if necessary.

# list the trusted keys
sudo apt-key list
# remove the key
sudo apt-key del KEY_ID

And sudo apt update should be working now!


NOTE:

You need to pay attention to two things here to fix this: A and B below.

A: ppa-source-list

When a ppa is added, a ppa-specific file is created under /etc/apt/sources.list.d.

For balen-etcher, there was the following file (/etc/apt/sources.list.d/balena-etcher.list).

# Source: balena
# Site: https://github.com/balena-io/etcher
# Repository: balena / etcher
# Description: Flash OS images to SD cards & USB drives, safely and easily.


deb [signed-by=/usr/share/keyrings/balena-etcher-archive-keyring.gpg] https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu focal main

deb-src [signed-by=/usr/share/keyrings/balena-etcher-archive-keyring.gpg] https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu focal main

According to this stack-exchange solution you could also delete this ppa specific file to revert to factory settings (as it was before adding the ppa).

If the ppa is successfully removed the above mentioned ppa-source-list file will cease to exist.

B: apt-policy

Next inspect the apt-policy and search for balena there.

apt policy | grep "balena"

This returned, in my case:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

 500 https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu focal/main i386 Packages
     release o=cloudsmith/balena/etcher,a=focal,n=focal,c=main,b=i386
 500 https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu focal/main amd64 Packages
     release o=cloudsmith/balena/etcher,a=focal,n=focal,c=main,b=amd64

What is a PPA?

Quoting this source.

PPA stands for Personal Package Archive. It provides a way to easily install application which can not be found in the Ubuntu official repository on Ubuntu (since the Ubuntu official repo takes a conservative approach to updates and number of applications it includes in its official repository with focus on stability over latest and greatest packages). PPA is one of the coolest things about Ubuntu. It creates an avenue for developers, packagers and even users to create their own personal repositories and include their packages which can easily be added and installed on Ubuntu.

References

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.