I’ve been using Ubuntu 16.04 on Oracle VM VirtualBox these days, this morning when I run $ sudo apt-get update to update software, it breaks and I got this error instead:

Seems there is an invalid repository that gives 403 error and causes the problem.

Err:20 http://ppa.launchpad.net/moka/stable/ubuntu xenial/main amd64 Packages
  403  Forbidden

We can also run $ sudo apt-get update | grep "Failed" to list failing repositories.

This error might lead other installation processes to fail, for example, installation of RVM(Ruby Version Manager), since $ sudo apt-get update doesn’t work well.


I decide to temporarily disable the PPA by comment out the source list for the quick fix.

Check installed packages

Use grep to get all enabled binary software sources showing together:

$ grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/

The output might look like this:

The output of grep command

In my case, moka-ubuntu-stable-xenial.list is the trouble maker.

Comment out the PPA source

Comment out the content or delete moka-ubuntu-stable-xenial.list and moka-ubuntu-stable-xenial.list.save.

In /etc/apt/sources.list.d/moka-ubuntu-stable-xenial.list:

  # deb http://ppa.launchpad.net/moka/stable/ubuntu xenial main
  # deb-src http://ppa.launchpad.net/moka/stable/ubuntu xenial main

Now run $ sudo apt-get update, it should work properly, and life goes on.

My environment:
Description: Ubuntu 16.04.6 LTS; Release: 16.04; Codename: xenial


⤧  Previous post Angular Form 表單資料流筆記 ⤧  Next post ActiveRecord - 資料庫操作抽象化和資料表的基礎