4

After following these commands from https://askubuntu.com/a/159371/63298, it removed my sources.list and when I do sudo apt-get upgrade, it's asking me to auto-remove the packages lost.

How do I revert my source.list from the source.list.backup? Now my source.list.d is a directory and not a list.

alvas
  • 2,927

3 Answers3

6

With four commands:

sudo apt-add-repository main
sudo apt-add-repository universe
sudo apt-add-repository multiverse
sudo apt-add-repository restricted

Or move or copy your backup

sudo cp /etc/apt/source.list.backup /etc/apt/source.list

The folder /etc/apt/source.list.d has always been a folder, a sub-folder of /etc/apt. After the removal of /etc/apt/source.list, the folder /etc/apt usually contains only this folder.

A.B.
  • 90,397
3

The sources.list can be generated in multiple ways. The GUI provided in ubuntu basically generates that file (it is in Settings -> Software). There is /usr/share/doc/apt/examples/sources.list which is in all the proper format. You can copy the example file to original file, cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list And there is also online generator https://repogen.simplylinux.ch/

But your file should remain in /etc/apt directory. You can revert changes with sudo mv /etc/apt/sources.list.backup /etc/apt/sources.list

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
0

I managed to restore if after https://askubuntu.com/a/159371/63298 by:

sudo cp /etc/apt/source.list.backup /etc/apt/source.list
sudo apt-get update
sudo apt-get upgrade
alvas
  • 2,927