0

There are a lot of answers related somewhat to this question, but doesn't seem to help as I didn't had this error before. This error came after upgrading to Ubuntu Impish from 21.04

$ sudo apt-get update
[sudo] password for kirti: 
E: Malformed entry 2 in list file /etc/apt/sources.list.d/pgdg.list (Suite)
E: The list of sources could not be read.
$ cat /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main
deb http://apt.postgresql.org/pub/repos/apt/
impish-pgdg main
$ 

I had postgresql installed before update. Though, postgresql works fine I'm not able to perform certain tasks on terminal, let it be a simple update

Can somebody please help me?

pgdg.list: enter image description here



Also I don't know why by default it is selected as postgresql in ubuntu update.
enter image description here

guiverc
  • 28,623
  • 5
  • 46
  • 74
kirti purohit
  • 147
  • 1
  • 7
  • Can you post the contents of `pgdg.list`? This will make it easier to spot the error – matigo Dec 22 '21 at 03:38
  • I've added @matigo – kirti purohit Dec 22 '21 at 03:44
  • 2
    Seems like sometime you tried to add the same source a second time...but made a typo. Line 1 is correct. Lines 2+3 say the same thing, but spread across two lines is the error. Simply delete lines 2 and 3. – user535733 Dec 22 '21 at 03:49
  • No its' the same content, I wanted to show – kirti purohit Dec 22 '21 at 03:50
  • Confused what you are trying to say. We cannot see nonverbal cues, so please try to be clear and unambiguous in your writing. Regardless, simply delete lines 2 and 3, then save the file. – user535733 Dec 22 '21 at 03:51
  • You sure I should delete the 2 lines? – kirti purohit Dec 22 '21 at 03:52
  • Alternately, you could simply comment those two lines out. Prepend a `#` on lines 2 and 3, then save. – user535733 Dec 22 '21 at 03:53
  • Why that source is selected in your Software & Updates control panel is a different question. It's best to keep questions simple. The short answer is that the source is selected *because you use it*. Unselected sources are disabled (unused). – user535733 Dec 22 '21 at 04:22
  • Does this answer your question? [How do I remove a malformed line from my sources.list?](https://askubuntu.com/questions/78951/how-do-i-remove-a-malformed-line-from-my-sources-list) – Organic Marble Dec 22 '21 at 11:26

1 Answers1

1

You have to rewrite this sources.list file using single long command below:

cat << EOF | sudo tee /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt impish-pgdg main
deb http://apt.postgresql.org/pub/repos/apt/ impish-pgdg main
EOF

Note that lines 2 and 3 are now one line with deb package type, its url, version and component. So it conforms with normal correct sources.list style format.

Then run sudo apt-get update again.

N0rbert
  • 97,162
  • 34
  • 239
  • 423