Friday, August 26, 2016

apt - How is the sources.list file generated on installation?


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?



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)


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...