How to re-create the repositories in /etc/apt folder in Ubuntu 18.04
8,097
You can create sources.list
in /etc/apt
directory.
sudo touch /etc/apt/sources.list
Open file with nano.
sudo nano /etc/apt/sources.list
Copy following content in file.
#------------------------------------------------------------------------------#
# OFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### Ubuntu Main Repos
deb http://in.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
###### Ubuntu Update Repos
deb http://in.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://in.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
Save it and You will be able to run
sudo apt update
and install any packages.
Related videos on Youtube
Author by
shiv
i am a student of open source technology , specially intrested in linux.
Updated on September 18, 2022Comments
-
shiv over 1 year
I accidentally deleted all the files in the folder
/etc/apt
which containssources.list
.Now I am not able to install any software via terminal; I get this error every time:
Package has no installation candidate
How can I fix this? Thank you in advance :-)
-
Zanna almost 6 yearsThis is the seed of an answer that, if I am on the right track, I hope someone will test and expand in the answer section: see How can I restore configuration files. Since you can't use APT, you'll have to download the packages listed by
dpkg -S /etc/apt
and install them usingdpkg -i
. You may need some help from How can I restore the default repositories and I'm not sure this will work.
-
-
shiv almost 6 yearswhile copying the content it says "Read only" ..... it's not saving the changes.
-
Darryl Williams almost 6 yearsUse sudo with command
-
shiv almost 6 yearsyes sir i used. it's get copied successfully. but after running " sudo apt update" it shows this W: GPG error: in.archive.ubuntu.com/ubuntu bionic-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32 E: The repository 'in.archive.ubuntu.com/ubuntu bionic-updates InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
-
Darryl Williams almost 6 yearssudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32. Run and try again. It should work.
-
shiv almost 6 yearsits shows :- Executing: /tmp/apt-key-gpghome.icm5OLsLPH/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 gpg: key 3B4FE6ACC0B21F32: 18 signatures not checked due to missing keys gpg: key 3B4FE6ACC0B21F32: public key "Ubuntu Archive Automatic Signing Key (2012) <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory) W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
-
Darryl Williams almost 6 yearssudo mkdir /etc/apt/apt.conf.d/
-
Zanna almost 6 yearsthe problem is that
sources.list
is not the only file in/etc/apt/
. There are various other important files and directories there and APT probably will not work without them :(