Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

when I upgrade from 11.10 to 12.04 whats the best way to re-enable my ppa's and added repos?

share|improve this question
up vote 10 down vote accepted

You need to add them all back/re-enabled them individually by uncommenting out the lines in the files in the /etc/apt/sources.list.d/ directory.

Though upgrade time is a good time to reevaluate if you need the PPA in the first place if you were just using one to get a newer version of a package.

share|improve this answer

I wrote a bash script that removes the leading hash character from all files in sources.list.d that were disabled during the upgrade.

The following code is for upgrading raring sources to saucy.

If you want to keep the suffix # disabled on upgrade to ..., use

for f in /etc/apt/sources.list.d/*.list; do sudo sed -i 's/raring/saucy/g' $f; sudo sed -i 's/^# \(.*disabled on upgrade to.*\)/\1/g' $f;done

if you want to delete the suffix # disabled on upgrade to ..., use

for f in /etc/apt/sources.list.d/*.list; do sudo sed -i 's/raring/saucy/g' $f; sudo sed -i 's/^# \(.*\) # disabled on upgrade to.*/\1/g' $f;done
share|improve this answer

I have created a couple of scripts to both enable (re-enable) and disable PPAs, specially after an upgrade. Here they are:

PPA re-enable script

#! /bin/bash
# PPA re-enable script
# Use: ppa-reenable source.list
# to reenable a PPA without its source line
# Use: ppa-reenable src source.list
# to reenable a PPA with its source line

if [ $1 == "src" ]; then mod=""; file="$2"; fi;
sudo sed -i "${mod}s/^# \(.*\) \(disabled on upgrade.*\)\?/\1/" "$file"

PPA disable script

#! /bin/bash
# PPA disable script
# Use: ppa-disable source.list
# to disable the PPA completely
# Use: ppa-disable src source.list
# to disable the source of the PPA only

# If its only needed to disable the source
if [ $1 = "src" ]; then mod="2"; file="${2}"; fi;

# If source line is disabled, don't comment it out
second="`sed -n 2p \"$file\"`"
if ( [ $second == "#" ] && [ $mod != "2" ] ); then

sudo sed -i "${mod}s/^/# /" "$file"

The sudo is included so you can store this script in your home bin directory

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.