How to install software using preseed.cfg Ubuntu 18.04.4?

I am creating an unattended installation using preseed for Ubuntu Desktop 18.04.4, and I want to install openssh-server (openssh-sftp-server for desktop) making it actually possible to ssh after installation is completed.

I have tried using commands such as: pkgsel/include,ubiquity/success_command and preseed/late_command without any luck.

The preseed does not install software nor does it update the packages.

Ref How To Include Additional Software In preseed.cfg For Ubuntu Server 13.10

If any help:

# Installer config
d-i base-installer/kernel/override-image string linux-image-amd64
# GRUB
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
# Setting the locales, country
# Supported locales available in /usr/share/i18n/SUPPORTED
d-i debian-installer/language string en
d-i debian-installer/country string IN
d-i debian-installer/locale string en_US.UTF-8
# Keyboard setting
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/xkb-keymap us
d-i keyboard-configuration/modelcode string pc105
# Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/enable boolean true
d-i netcfg/get_hostname string ubuntu-bionic-desktop
d-i netcfg/get_domain string localdomain
d-i netcfg/wireless_wep string
# d-i hw-detect/load_firmware boolean true
# Mirror settings
choose-mirror-bin mirror/http/proxy string
# Clock and time zone setup
d-i time/zone string UTC
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
# Disk and Partitioning setup
d-i partman-auto/disk string /dev/sda
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/method string lvm
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm 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/confirm_write_new_label boolean true
# Vagrant user creation
d-i passwd/user-fullname string vagrant
d-i passwd/username string vagrant
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
d-i passwd/user-default-groups vagrant sudo
# Package installations
d-i pkgsel/include string openssh-sftp-server vim cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common
# Upgrading the system
d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select full-upgrade
tasksel tasksel/first multiselect standard, ubuntu-desktop
ubiquity ubiquity/use_nonfree boolean true
d-i preseed/late_command string apt-install openssh-sftp-server;
# Success Installation - Tasks
ubiquity ubiquity/success_command string \ in-target apt install openssh-sftp-server;
# Installation - final
d-i finish-install/reboot_in_progress note
ubiquity ubiquity/summary note
ubiquity ubiquity/reboot boolean true`

1 Answer

Remove unnecessary lines

Ubiquity ignores preseed/late_command so there is no point in using it. Hence you included the openssh-sftp-server package in this line:

d-i pkgsel/include string openssh-sftp-server vim cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common

So these lines can be removed:

d-i preseed/late_command string apt-install openssh-sftp-server;
# Success Installation - Tasks
ubiquity ubiquity/success_command string \ in-target apt install openssh-sftp-server;

How to use ubiquity

I tested your preseed file by using Ubuntu minimal iso which can be found here. On selection screen I moved the cursor to command-line install and pressed tab key. Notice the attributes which appeared in the bottom of the screen:

Ubuntu Installer

Then append these attributes, feel free to change the values:

locale=en_US hostname=ubuntu keyboard-configuration/modelcode=SKIP ubiquity url=

The preseed file can be hosted on localhost of your host machine, for example by using python3 -m http.server. Your IP address will differ obviously. Press enter and the installation will proceed and the instalator will only prompt you for repo server as it is not defined in your preseed file.

After installation is complete you can login and confirm that openssh-sftp-server and other packages are installed.

7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like