LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to restore my backup copy of sources.list ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-restore-my-backup-copy-of-sources-list-4175629014/)

ingenue 05-04-2018 07:03 AM

How to restore my backup copy of sources.list ?
 
Hi all,

I followed this instruction on some guide-
"Make a backup copy of your current sources.list file

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak "

and afterwards I made a mistake in creating a new line in the sources.list
Now when I enter sudo apt-get update, I get "E: Type 'new' is not known on line 52 in source list /etc/apt/sources.list
E: The list of sources could not be read."

How can I restore that backup easily? thanks!!

hydrurga 05-04-2018 07:28 AM

The reverse operation is:

Code:

sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list
Do so when you have no applications open that may be accessing this file (update manager, synaptic etc.)

However, perhaps it is best to try and resolve the problem first.

Which distro/version are you using?

Can you please paste the output from:

Code:

inxi -r

ingenue 05-04-2018 07:37 AM

hmm, the inxi command doesn't work for me:
The program 'inxi' is currently not installed. You can install it by typing:
sudo apt install inxi

I have ubuntu 16.04 LTS, thanks

hydrurga 05-04-2018 07:48 AM

No problem. In that case,

Code:

cat /etc/apt/sources.list

ingenue 05-04-2018 07:55 AM

Quote:

Originally Posted by hydrurga (Post 5850596)
No problem. In that case,

Code:

cat /etc/apt/sources.list

I still get the message that "E: Type 'new' is not known on line 52 in source list /etc/apt/sources.list
E: The list of sources could not be read." when I try to update software

hydrurga 05-04-2018 07:57 AM

Do not try to update software for the moment.

Please paste the output from the command I gave you in my last post.

ingenue 05-04-2018 08:00 AM

Oh ok, there you go:

# deb cdrom:[Ubuntu 16.04.4 LTS _Xenial Xerus_ - Release amd64 (20180228)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ xenial multiverse restricted universe main

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse restricted universe main

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial universe
deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://de.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse restricted universe main
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
new line of text

hydrurga 05-04-2018 08:08 AM

Thanks. Using your favourite text editor, edit that file (you will need to do so as root, i.e. with sudo) and remove the line at the bottom that says "new line of text".

Out of interest, what were you trying to do?

For reference purposes, here is the default sources.list for Ubuntu 16.04:

https://gist.github.com/rohitrawat/6...3eac3a11d4afc1

ingenue 05-04-2018 08:18 AM

Quote:

Originally Posted by hydrurga (Post 5850609)
Thanks. Using your favourite text editor, edit that file (you will need to do so as root, i.e. with sudo) and remove the line at the bottom that says "new line of text".

Out of interest, what were you trying to do?

For reference purposes, here is the default sources.list for Ubuntu 16.04:

https://gist.github.com/rohitrawat/6...3eac3a11d4afc1

Sorry, what does that mean to do that with Sudo?

I already tried to locate the line "new line of text" in the sources.list document but there isn't one!

I was trying to install the Windscribe VPN service.

hydrurga 05-04-2018 08:31 AM

Edit the file with the following command (it is a system file so you need to use sudo to edit it as root):

Code:

sudo gedit /etc/apt/sources.list
Remove the offending line and save the file.

ingenue 05-04-2018 08:33 AM

nevermind I accessed the right document now and found the line. With sudo probably means with the terminal with echo command right? How do I edit specifically the 52nd line? or should I echo the list that you linked to?
I just don't know syntaxes by myself...

thank you

ingenue 05-04-2018 08:33 AM

Quote:

Originally Posted by hydrurga (Post 5850620)
Edit the file with the following command (it is a system file so you need to use sudo to edit it as root):

Code:

sudo gedit /etc/apt/sources.list
Remove the offending line and save the file.

Can't save the file, it's greyed out

hydrurga 05-04-2018 08:33 AM

Quote:

Originally Posted by ingenue (Post 5850621)
nevermind I accessed the right document now and found the line. With sudo probably means with the terminal with echo command right? How do I edit specifically the 52nd line? or should I echo the list that you linked to?
I just don't know syntaxes by myself...

thank you

Please see my previous post.

hydrurga 05-04-2018 08:35 AM

Quote:

Originally Posted by ingenue (Post 5850622)
Can't save the file, it's greyed out

Did you open the file by entering the following in the terminal?:

Code:

sudo gedit /etc/apt/sources.list

ingenue 05-04-2018 08:36 AM

Quote:

Originally Posted by hydrurga (Post 5850620)
Edit the file with the following command (it is a system file so you need to use sudo to edit it as root):

Code:

sudo gedit /etc/apt/sources.list
Remove the offending line and save the file.

I managed it, thank you!!! :)


All times are GMT -5. The time now is 11:52 PM.