How do I revert my source.list from the source.list.backup?

6,523

Solution 1

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.

Solution 2

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

Share:
6,523

Related videos on Youtube

alvas
Author by

alvas

食飽未?

Updated on September 18, 2022

Comments

  • alvas
    alvas over 1 year

    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.