2

i stock in update my ubuntu 24.04 , before i try to add pgp key everything workds and after alot of changed i try to reset all settings to default but now i have problem with apt update , i paste the erros and my config below ! help me :|

➜  sources.list.d pwd
/etc/apt/sources.list.d
➜  sources.list.d ll
total 4.0K
-rw-r--r-- 1 root root 343 Dec 17 00:38 ubuntu.sources
➜  sources.list.d cat ubuntu.sources
deb http://archive.ubuntu.com/ubuntu noble main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu noble-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu noble-backports main universe restricted multiverse
➜  sources.list.d sudo apt update
E: Malformed stanza 1 in source list /etc/apt/sources.list.d/ubuntu.sources (type)
E: The list of sources could not be read.
➜  sources.list.d 
mook765
  • 18,644
Buddha
  • 23
  • 3

2 Answers2

3

apt expects a file with DEB822-STYLE FORMAT if the file has the .sources extension.

Your file uses ONE-LINE-STYLE FORMAT which should have the extension .list

Either rename your file with

sudo mv /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.list

or use the DEB822-STYLE FORMAT, here an example for noble:

Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: noble noble-updates
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb URIs: http://security.ubuntu.com/ubuntu/ Suites: noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

See also man sources.list.

mook765
  • 18,644
0

if you have same problem just do this 3 steps and its will be fixed

  • first : you must know the type of your ubuntu with this command

    lsb_release -cs

  • second : update your ubuntu.sources base on lsb_release -cs in my case is noble

sudo nano /etc/apt/sources.list.d/ubuntu.sources

Types: deb
URIs: http://archive.ubuntu.com/ubuntu
Suites: noble
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb URIs: http://archive.ubuntu.com/ubuntu Suites: noble-updates Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb URIs: http://archive.ubuntu.com/ubuntu Suites: noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb URIs: http://archive.ubuntu.com/ubuntu Suites: noble-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

  • third : you can update your /usr/share/keyrings/ubuntu-archive-keyring.gpg by this command:
curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C | gpg --dearmor | sudo tee /usr/share/keyrings/ubuntu-archive-keyring.gpg > /dev/null
Buddha
  • 23
  • 3