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 (
.listfiles, typically/etc/apt/sources.listand files in/etc/apt/sources.list.d/).Ubuntu (and Debian) are transitioning to a newer, more structured format called “deb822” using
.sourcesfiles (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-sourcescommand is a helper tool provided to automatically convert your existing.listfiles into the new.sourcesformat.There isn’t a specific configuration option within
aptdesigned solely to turn off only this modernization notice while keeping the old.listfiles active. The notice is there specifically because the condition (presence of.listfiles) 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-sourceswill analyze your existing.listfiles and attempt to convert them into the new.sourcesformat.- It typically backs up your old configuration files before making changes (e.g., adding a
.bakextension or similar).- Once your sources are successfully converted and the old
.listfiles are no longer the primary configuration (they might be commented out or removed by the tool),aptwill 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.listfile 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.backupThen run the modernization:
sudo apt modernize-sourcesAfter running it, test with
sudo apt updateto 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-sourcesto convert your repository configuration files to the newer format. While you can technically ignore the notice and continue using the.listfiles (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.