24

On freshly installed from scratch (not an upgrade) Ubuntu 24.04 I get this error when I run

$ sudo apt-get build-dep -y vlc  
Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list

Prior to 24.04 fix was to make edits to /etc/apt/sources.list, but now on 24.04:

$ cat /etc/apt/sources.list
# Ubuntu sources have moved to /etc/apt/sources.list.d/ubuntu.sources

here is new file on 24.04

$ cat /etc/apt/sources.list.d/ubuntu.sources 
Types: deb
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports noble-proposed
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

How do I add deb-src to the new file /etc/apt/sources.list.d/ubuntu.sources?

1 Answers1

29

There is a new config file location with a new file format layout for 24.04 unlike previous Ubuntu releases

Add the below snippet to the new config file /etc/apt/sources.list.d/ubuntu.sources

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

If you want to do this using a one line command:


sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources

final updated file will become

cat /etc/apt/sources.list.d/ubuntu.sources

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

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

then run

sudo apt update

__________ below is server only not your laptop _______________

NOTE if the machine is under control of cloud-init (ignore this for those viewers at home this pertains to some remote cloud Ubuntu VM not your home laptop) instead make a similar addition of deb-src to the template file as per

$ cat /etc/apt/sources.list.d/ubuntu.sources 
## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
##
## If you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
##     or do the same in user-data
## b.) add supplemental sources in /etc/apt/sources.list.d
## c.) make changes to template file
##      /etc/cloud/templates/sources.list.ubuntu.deb822.tmpl
##