"sources.list file empty" or "E: Package package_name has no installation candidate" in Ubuntu 20.04
Hello Ubuntu users, I am writing this article because i faced this problem as follow by other old solutions on internet when i was upgrading my Ubuntu v18.04 to v20.04, accidentally i remove or clear "sources.list" file from location /etc/apt/sources.list
I don't have screenshots of errors because i didn't taught to write article on this error. but it works for me.
first check your Ubuntu version
lsb_release -a
I don't even know this will work for other Ubuntu versions or not.
If your sources.list file is empty then it will not allow you to install any packages.
I was getting error "E: Package 'lsb-core' has no installation candidate"
after investing couples of hrs. to solve E: Package 'lsb-core' has no installation candidate i got about sources.list but it was empty for, and start searching to regenerate sources.list file contents back, and finally i collect information from different sources and combine them and got solution.
Let's start!
Solution:: It Works For Me( You Can Try )
Copy of your sources.list file backed-up to your "/etc/apt/" directory by named "sources.list.save" In my case it was there if you didn't get this file name you can skip this article.
sudo apt update
cd /etc/apt/
ls
Check file name "sources.list.save" If file exists open and check contents available or not.
Copy file using
cp sources.list.save sources.list
open sources.list
vi sources.list
Note: You can use any editor to edit
change all text "bionic" to focal
Note: line starts with # is comment so you can leave this unchanged.
once all bionic changed to focal save file and exit
sudo apt update
sudo apt upgrade
some files will not upgrade directly using upgrade command.
you can manually install them if you know up-gradable package name.
sudo apt install package_name
I hope this will work for you i am also a beginner in Ubuntu, and if you have query related to this feel free to write in comment section.
If you have another solution related this can share your solution in comment section it help others.
Thanks
Home
Hello Ubuntu users, I am writing this article because i faced this problem as follow by other old solutions on internet when i was upgrading my Ubuntu v18.04 to v20.04, accidentally i remove or clear "sources.list" file from location /etc/apt/sources.list
I don't have screenshots of errors because i didn't taught to write article on this error. but it works for me.
first check your Ubuntu version
lsb_release -a
I don't even know this will work for other Ubuntu versions or not.
If your sources.list file is empty then it will not allow you to install any packages.
I was getting error "E: Package 'lsb-core' has no installation candidate"
after investing couples of hrs. to solve E: Package 'lsb-core' has no installation candidate i got about sources.list but it was empty for, and start searching to regenerate sources.list file contents back, and finally i collect information from different sources and combine them and got solution.
Let's start!
Solution:: It Works For Me( You Can Try )
Copy of your sources.list file backed-up to your "/etc/apt/" directory by named "sources.list.save" In my case it was there if you didn't get this file name you can skip this article.
sudo apt update
cd /etc/apt/
ls
Check file name "sources.list.save" If file exists open and check contents available or not.
Copy file using
cp sources.list.save sources.list
open sources.list
vi sources.list
Note: You can use any editor to edit
change all text "bionic" to focal
Note: line starts with # is comment so you can leave this unchanged.
once all bionic changed to focal save file and exit
sudo apt update
sudo apt upgrade
some files will not upgrade directly using upgrade command.
you can manually install them if you know up-gradable package name.
sudo apt install package_name
I hope this will work for you i am also a beginner in Ubuntu, and if you have query related to this feel free to write in comment section.
If you have another solution related this can share your solution in comment section it help others.
Thanks
Home
0 comments: