I've recently tried to create a custom Ubuntu installer iso from the Ubuntu 16.04 64 bit server installer, with the aim of editing the /etc/apt/sources.list file. I unpacked the iso, expanded the squashfs filesystem, chrooted into it and edited the /etc/apt/sources.list file. Then I repacked the filesystem, regenerated the md5sum and generated a new iso image. This all seemed to work and the iso image can boot and be used to install Ubuntu.

While doing this I noticed that the sources.list file I was editing was much smaller than a normal sources file. It only contained the 'main' component for the archive.ubuntu.com mirror, and similar entries for the security and updates mirrors. When I installed from the new iso, the /etc/apt/sources.list file was the full file I'm used to seeing, complete with all repository components such as universe etc. The sources file also appears to be based on my location, as all entries used the gb.archive.ubuntu url.

I assume that I'd only edited the file used within the installation process, which didn't affect the actual sources file in the final installation.

How is the final version of the /etc/apt/sources.list file generated when the operating system is installed, and can I affect this without recompiling apt?

1 Answer 1


For generating sources.list:

If what you want to do is select a country mirror, look in to preseeding. The Ubiquity installer supports limited preseeding, but options include:

  • setting the country (key: countrychooser/shortlist)
  • running a post-install script and manually replacing sources.list (key: ubiquity/success_command)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.