Thanks to Alan Pope that explained so clearly the Run ‘apt modernize-sources’ to do so issue at discourse.ubuntu.com:
The notice “Some sources can be modernized. Run ‘apt modernize-sources’ to do so” appears because your Ubuntu system has detected software repository configurations using the older, traditional format (
.list
files, typically/etc/apt/sources.list
and files in/etc/apt/sources.list.d/
).Ubuntu (and Debian) are transitioning to a newer, more structured format called “deb822” using
.sources
files (usually placed in/etc/apt/sources.list.d/
). This format is generally considered more readable, less prone to certain types of errors, and easier for tools to parse.The
apt modernize-sources
command is a helper tool provided to automatically convert your existing.list
files into the new.sources
format.There isn’t a specific configuration option within
apt
designed solely to turn off only this modernization notice while keeping the old.list
files active. The notice is there specifically because the condition (presence of.list
files) exists.Therefore, the primary ways to stop seeing the notice are:
- Run the Modernization Command (Recommended):
- This is the intended solution. Running
sudo apt modernize-sources
will analyze your existing.list
files and attempt to convert them into the new.sources
format.- It typically backs up your old configuration files before making changes (e.g., adding a
.bak
extension or similar).- Once your sources are successfully converted and the old
.list
files are no longer the primary configuration (they might be commented out or removed by the tool),apt
will no longer detect sources needing modernization, and the notice will disappear.- Before running: It’s always wise to manually back up your
/etc/apt/sources.list
file and the contents of the/etc/apt/sources.list.d/
directory, just in case something unexpected happens during the conversion.sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup sudo cp -R /etc/apt/sources.list.d/ /etc/apt/sources.list.d.backup
Then run the modernization:
sudo apt modernize-sourcesAfter running it, test with
sudo apt update
to ensure everything still works correctly.
- Use Quiet Flags (Not Ideal for Suppressing Just This):
The best and intended way to “suppress” the notice is to address the underlying reason it’s appearing: run
sudo apt modernize-sources
to convert your repository configuration files to the newer format. While you can technically ignore the notice and continue using the.list
files (they still work), the notice will likely persist until you modernize or use general quiet flags that hide other output too. Modernizing is generally safe and aligns with the direction the distribution is heading.