5

On a relatively freshly installed Linux Mint 18.3, I've discovered that there is no /etc/apt/sources.list file. This seems to cause no problems, but occasionally a warning pops up:

WARNING:root:could not open file '/etc/apt/sources.list'

(for example if I try to execute a command that does not exist in the command line).

AFAIU, on Linux Mint the standard sources are in /etc/apt/sources.list.d/official-package-repositories.list.

Will everything work as exepcted without sources.list? Is it normal to not have it? If not, any ideas how it could get removed? (The warning was accidentally noticed about a week or two after the system was installed.)

Is it better to ignore the warning or to create an empty /etc/apt/sources.list, or are there better solutions?

I understand that I can just create an empty file and the warning will probably go away, but I want to understand how this happened on a newly installed Linux Mint 18.3, and if it could be a symptom of some problem (maybe there are more important files missing somewhere).

3
  • What program is giving the warning? apt shouldn't complain about that, it's standard for apt & Debian – Xen2050 Mar 14 '19 at 23:32
  • @Xen2050, the warning was appearing when i was trying to execute a command that did not exist. – Alexey Mar 15 '19 at 4:52
  • That's a little mysterious, something like when you try less file_does_not_exist and less complains "No such file"? Maybe you should post an answer with the details. – Xen2050 Mar 15 '19 at 21:12
3

As mentioned by user Rui F Ribeiro, this is the first result on Google using the search operand sources.list mint:

https://sites.google.com/site/easylinuxtipsproject/reserve-8

This site has all of the information about what your Linux Mint 18.3 Sylvia install sources list should contain and how to reset it multiple ways. One way is to open a terminal and run:

gksudo xed /etc/apt/sources.list.d/official-package-repositories.list

Then verify that your file matches this identically

deb http://packages.linuxmint.com sylvia main upstream import backport

deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse  
deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ xenial partner

After that save and close the file, then run:

sudo apt-get update
sudo mintupdate-tool upgrade -r -l123 -s -nk

After this reboot. If you continue to have problems or are experiencing some other kind of issue then you will need to provide additional information concerning that.

6
  • This is not about my question, please read it again. – Alexey Feb 25 '18 at 21:27
  • @Alexey, Is your question is it okay if your Linux Mint install does not have a /etc/apt/sources.list and instead has the file /etc/apt/sources.list.d/official-package-repositories.list? As far as I can tell Linux Mint uses the later for its update process. If you read the link provided it explains the file that Linux Mint uses in its update process. If you are having issues updating follow the instructions to correct your Linux Mint repository sources file. If your issue is not concerning the repository source file and involves some other issue you will need to provide additional context. – kemotep Feb 25 '18 at 21:39
  • I do not have issues with updating. I did not find a clear statement that Linux Mint is not expected to have sources.list. I am not sure if is ok for a Debian based distribution to not have sources.list. If it is ok, i am wondering why i was getting the warning. – Alexey Feb 25 '18 at 21:44
  • 1
    It appears Linux Mint is supposed to be updated via the GUI application called ` Update Manager ` . The issue you are reporting is due to of Linux Mint wanting to have you use that tool to update instead of traditional command line tools. Just looking now there does not even appear to be an official wiki page let alone comprehensive documentation for Linux Mint. The link I provided is the only non-forum post I could find that mentioned the sources.list file. I suggest you use Ubuntu or Debian if you want a saner command-line management experience with actual documentation. – kemotep Feb 25 '18 at 21:59
  • 2
0

I did a quick look around and found that (as mentioned by OP) this warning is only shown when you enter a command that is not found on the system.

I got the package name responsible for it through here:

https://askubuntu.com/questions/356652/how-does-command-not-found-determines-if-user-is-administrator

The Warning you get is due to the package CommandNotFound. The script's location is /usr/lib/python(2.7|3|3.5)/dist-packages/CommandNotFound/CommandNotFound.py

That program uses apt's python library to load sources.list, and when it can't find it the Warning is shown.

This is normal when sources.list doesn't exist in its default location. It doesn't impact anything in the system.

If you want to get rid of it, you can uninstall CommandNotFound. But you will lose the feature of suggesting which packages to install.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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