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
##
For sake of completeness below currently happens (as of 20250825) on a recently updated ubuntu server 24.04 ... so issue continues ... note this is a serve not laptop so using the ubuntu UI is not an option hence the terminal commands
root@koselig ~ #
root@koselig ~ # apt-get build-dep -y vlc
Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list
root@koselig ~ #
root@koselig ~ # cat /etc/apt/sources.list
# Ubuntu sources have moved to the /etc/apt/sources.list.d/ubuntu.sources
# file, which uses the deb822 format. Use deb822-formatted .sources files
# to manage package sources in the /etc/apt/sources.list.d/ directory.
# See the sources.list(5) manual page for details.
root@koselig ~ #
root@koselig ~ # 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
##
See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
newer versions of the distribution.
Ubuntu distribution repository
The following settings can be adjusted to configure which packages to use from Ubuntu.
Mirror your choices (except for URIs and Suites) in the security section below to
ensure timely security updates.
Types: Append deb-src to enable the fetching of source package.
URIs: A URL to the repository (you may add multiple URLs)
Suites: The following additional suites can be configured
<name>-updates - Major bug fix updates produced after the final release of the
distribution.
<name>-backports - 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.
Components: Aside from main, the following components can be added to the list
restricted - Software that may not be under a free license, or protected by patents.
universe - Community maintained packages. Software in this repository receives maintenance
from volunteers in the Ubuntu community, or a 10 year security maintenance
commitment from Canonical when an Ubuntu Pro subscription is attached.
multiverse - Community maintained of restricted. 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.
See the sources.list(5) manual page for further settings.
Types: deb
URIs: https://mirror.hetzner.com/ubuntu/packages
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Ubuntu security updates. Aside from URIs and Suites,
this should mirror your choices in the previous section.
Types: deb
URIs: https://mirror.hetzner.com/ubuntu/security
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
apt updateafterwards so that the source indexes are downloaded. – user2909614 Apr 28 '24 at 15:06sed -i 's/^Types: deb/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources– Utkonos Apr 28 '24 at 21:30# sed -i 's/^Types: deb/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources# grep Types /etc/apt/sources.list.d/ubuntu.sources## Types: Append deb-src to enable the fetching of source package. Types: deb deb-src Types: deb deb-src– Utkonos Apr 30 '24 at 00:29$like so;sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sourcesto prevent the sed command doing substitutions if run more than once. – Douglas Kosovic May 15 '24 at 01:37