3

I have recently started using Terminal, and I have been having lots of problems installing programs from the Ubuntu Software Center (Minecraft, TOR, Tails installer, etc.)

When I run sudo apt-get update I always get

N: Ignoring file '50unattended-upgrades.ucf-old' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension

I get a system error message when I boot up in relation to deb-src http://deb.torproject.org/torproject.org xenial main

When I try to open /etc/apt/sources.list with various commands it seems like it's not there, unless I open it with sudo gedit /etc/apt/sources.list, then I get a blank document

So my guess is I have accidentally removed it or something...

What do I do ?

Just an edit in response to Duplicate flags

The invalid file name is sorted now (it just needed removing). My problem now is adding lines to my sources list. I tried making a new file from one of the flagged duplicate threads I moved the file and made a new one with Gedit. It seemed to restore defaults and came up with 2x canonical brothers lines. And when I try to add a line nothing happens.

-Just found out when I use sudo su I can now add lines to my sources list

sudo su -c "echo 'deb http://www.duinsoft.nl/pkg debs all' >> /etc/apt/sources.list

2 Answers2

3

Have you tried changing the repository to the 'Main server'? Whenever you change it and close, it will prompt you to reload. That should restore the defaults.

repositories in Software & Updates

If that does not work, here is a copy of mine:

deb http://archive.ubuntu.com/ubuntu xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial restricted universe main multiverse
deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial-updates restricted universe main multiverse
deb http://archive.ubuntu.com/ubuntu xenial universe
deb http://archive.ubuntu.com/ubuntu xenial-updates universe
deb http://archive.ubuntu.com/ubuntu xenial multiverse
deb http://archive.ubuntu.com/ubuntu xenial-updates multiverse
deb http://archive.ubuntu.com/ubuntu xenial-security main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial-security restricted universe main multiverse
deb http://archive.ubuntu.com/ubuntu xenial-security universe
deb http://archive.ubuntu.com/ubuntu xenial-security multiverse
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
wjandrea
  • 14,236
  • 4
  • 48
  • 98
Aedazan
  • 302
  • So I just opened up the Software and updates ,it looked like that hyperlink ,it was on main server ,I turned it off put my password in ,turn it back on and I tried to add them lines you got there ,but when I hit add it doesn't add the line. – Brad Martin Nov 03 '16 at 02:30
  • Thats strange, have you tried checking the permissions on the file? Try sudo touch /etc/apt/sources.list; sudo echo deb http://archive.ubuntu.com/ubuntu xenial main restricted > /etc/apt/sources.list and then check again. My guess is that for whatever reason the file is not being written. – Aedazan Nov 03 '16 at 02:34
  • That command brought up"bash: /etc/apt/sources.list: Permission denied" – Brad Martin Nov 03 '16 at 11:28
  • That's the problem, it would appear that your user (and apparently root?) does not have write access. You can try using sudo chmod 744 /etc/apt/sources.list however its not a good sign that your root (sudo) user cannot write to that file. – Aedazan Nov 03 '16 at 22:20
1

#1 Fix for ignoring file

Removing the file should solve the problem, and may get rid of all the notices if the directory one is simply occurring because there are invalid files within it. Thus 50unattended-upgrades file should be removed.

 sudo rm /etc/apt/apt.conf.d/50unattended-upgrades.ucf-old

#2 Fix for missing /etc/apt/sources.list

Simply open Software & Updates via your Dash and you will see this

enter image description here Select desirable mirror, then activate checkbox to enable repositories (main, universe, restricted, multiverse) in order to create new sources.list file

Liso
  • 15,377
  • 3
  • 51
  • 80
  • So that command seems to have worked at removing the file and "N: Ignoring file '50unattended-upgrades.ucf-old' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension" is gone! Thanks for that ,it was very annoying.However My software & update dash does look like yours,but the other software tab is completely blank and I cannot add anything to it. – Brad Martin Nov 03 '16 at 11:45
  • @BradMartin You can use Ubuntu Sources List generator to generate new sources list, with third-party repositories feature. Which is pretty simple to use, tho – Liso Nov 04 '16 at 01:48