Sample Header Ad - 728x90

How do I set mirrors in /etc/apt/sources.list with a Debian preseed file?

4 votes
3 answers
8961 views
I'm building a custom ISO image of Debian 10 stable ("buster") using [preseeding](https://wiki.debian.org/DebianInstaller/Preseed) , and my custom preseed.cfg file works perfectly except for one thing: I'd like it to configure /etc/apt/sources.list with my chosen repositories so that I don't have to do it manually every time I install a new system. The goal is an /etc/apt/sources.list that looks like this (https is a necessity here): deb https://deb.debian.org/debian buster main contrib non-free deb-src https://deb.debian.org/debian buster main contrib non-free deb https://deb.debian.org/debian-security/ buster/updates main contrib non-free deb-src https://deb.debian.org/debian-security/ buster/updates main contrib non-free deb https://deb.debian.org/debian buster-updates main contrib non-free deb-src https://deb.debian.org/debian buster-updates main contrib non-free My preseed.cfg file looks like this: #### Contents of the preconfiguration file (for buster) ### Localization # Preseeding only locale sets language, country and locale. d-i debian-installer/locale string en_US # Keyboard selection. d-i keyboard-configuration/xkb-keymap select us # d-i keyboard-configuration/toggle select No toggling ### Network configuration d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/hostname string vienna1-preseed d-i netcfg/wireless_wep string ### Mirror settings d-i mirror/country string manual d-i mirror/http/hostname string http.us.debian.org d-i mirror/http/directory string /debian d-i mirror/http/proxy string ### Account setup d-i passwd/root-login boolean false # To create a normal user account. d-i passwd/user-fullname string theusername d-i passwd/username string theusername d-i passwd/user-password-crypted password $6$qVk198UWGPxpW$tzMYxQyiOrI4ClDJdDGALsyYq1j1IbXWbpem3JevFT9Krqdmt4wKdvtiY8ry3PRh277V6GHzSKP3zSI7jt04Y/ ### Clock and time zone setup d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i clock-setup/ntp boolean true ### Partitioning d-i partman-auto/method string regular d-i partman-lvm/device_remove_lvm boolean true d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true d-i partman-auto/choose_recipe select atomic d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i partman-md/confirm boolean true d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true # https://serverfault.com/a/622818 d-i apt-setup/use_mirror boolean false d-i apt-setup/cdrom/set-first boolean false d-i apt-setup/cdrom/set-next boolean false d-i apt-setup/cdrom/set-failed boolean false ### Base system installation # Configure APT to not install recommended packages by default. Use of this # option can result in an incomplete system and should only be used by very # experienced users. #d-i base-installer/install-recommends boolean false ### Apt setup # You can choose to install non-free and contrib software. d-i apt-setup/non-free boolean true d-i apt-setup/contrib boolean true ### Package selection tasksel tasksel/first multiselect standard d-i pkgsel/upgrade select full-upgrade popularity-contest popularity-contest/participate boolean false ### Boot loader installation d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i grub-installer/bootdev string default d-i finish-install/reboot_in_progress note d-i debian-installer/exit/poweroff boolean true
Asked by Michael A (1713 rep)
Dec 9, 2019, 08:05 PM
Last activity: Jun 7, 2024, 09:00 PM