53

Purpose

I want to install Ubuntu Desktop 16.04.1 LTS completely unattended. Put ISO CD in and walk away.

Issues

  • Boot parameters incorrect
  • Questions still being asked and needing mouse clicks
  • Convoluted answers using kickstart/preseed
  • Documentation examples no working as stated, specifically from partman and ubunutu

I came across this post here and it was close to what I needed but didn't quite accomplish what I needed since it was for Ubuntu Server. The post suggests using a "non-graphical" Ubuntu install, but I couldn't find a non-graphical install for Ubuntu Desktop, which makes sense. I tried to adapt the steps and get it working for Ubuntu Desktop 16.04.1 LTS.

Documentation Used

I have used all the following resources...

Apparently I can't include all of my resources because askubuntu doesn't allow more than 2 links. Well that's not very helpful - so here is just a list:

  • AskUbuntu
  • Ubuntu install.en.pdf
  • Preseed Examples
  • Ubiquity Installer Documentation
  • Partman Documentation and Examples
  • Partition Recipe Explaination of the 3 numbers and their weighting
  • A More Complex Preseed Example

Current Solution

I have currently created an unattended install, but am not sure if it is correct - meaning that I should have edited the isolinux/isolinux.cfg

There were many differences between the post I linked and the Ubuntu Desktop image. Here is my solution:

Step 1

Mounted Ubuntu ISO so that I can copy the contents to another directory and then edit the pertinent files.

mkdir -p /mnt/iso
mount -o loop ubuntu.iso /mnt/iso

Step 2

I then copied the ISO files to another directory for editing.

mkdir -p /opt/ubuntuiso
cp -rT /mnt/iso /opt/ubuntuiso

Step 3

I edited the isolinux/isolinux.cfg file and replaced everything inside with the following:

default live-install
label live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz.efi
  append  file=/cdrom/ks.preseed auto=true priority=critical debian-installer/locale=en_US keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=English countrychooser/shortlist=US localechooser/supported-locales=en_US.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet splash noprompt noshell ---

The append line is very long so for easy reading, here are all the options I used:

file=/cdrom/ks.preseed 
auto=true 
priority=critical 
debian-installer/locale=en_US 
keyboard-configuration/layoutcode=us 
ubiquity/reboot=true 
languagechooser/language-name=English 
countrychooser/shortlist=US 
localechooser/supported-locales=en_US.UTF-8 
boot=casper 
automatic-ubiquity 
initrd=/casper/initrd.lz 
quiet 
splash 
noprompt 
noshell

I found that all these boot parameters were needed to get a completely unattended install. For Ubuntu Server, it may be different.

Step 4

I tried using and creating many preseed files, but I found the more complex, the more chance for errors. This is currently my simple preseed file that works with the above isolinux.cfg file.

### Partitioning
d-i partman-auto/disk string /dev/sda
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-auto/choose_recipe select atomic

# This makes partman automatically partition without confirmation
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

# Locale
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us

# Network
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/choose_interface select auto

# Clock
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
d-i time/zone string US/Pacific
d-i clock-setup/ntp boolean true

# Packages, Mirrors, Image
d-i base-installer/kernel/override-image string linux-server
d-i base-installer/kernel/override-image string linux-image-amd64
d-i mirror/country string US
d-i mirror/http/proxy string
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i pkgsel/install-language-support boolean false
tasksel tasksel/first multiselect ubuntu-desktop

# Users
d-i passwd/user-fullname string Liason
d-i passwd/username string liason
d-i passwd/user-password-crypted password [crpyt 3]
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password [crypt 3]
d-i user-setup/allow-password-weak boolean true

# Grub
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian boolean true
d-i finish-install/reboot_in_progress note

# Custom Commands

I didn't include my encrypted passwords so if you try this preseed file, please change them to an encrypted password. Here is 3 ways to make the password.

Step 5

I created the new ISO from the the /opt/ubuntuiso/ directory.

mkisofs -D -r -V ATTENDLESS_UBUNTU -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /opt/autoinstall.iso /opt/ubuntuiso

Step 6

I finally tested it with Virtualbox and it created a completely unattended install.

Questions

Should I have to be editing the isolinux/isolinux.cfg file?

In the other post, it seems they are able to edit the isolinux/txt.cfg file and are able to make that work. I tried for about an hour to use the isolinux/txt.cfg, but it did not work.

Does anyone have a working more complex partman recipe which directly specifies partitions? Or a working LVM setup? I tried to use a simple LVM setup, but it after reboot it wouldn't boot and would just sit a black screen. Also, not a single one of the preseed examples I listed in the documentation worked either.

Thank you for any help.

7 Answers 7

24

Answering

I gave it some time from originally asking my question to see if there were any other solutions, but it looks like the solution I came up with while waiting is the only viable solution I've seen so far.

Misconception

Since this was the source of a lot of confusion, I will try to clear it up. It seems that some of the answers tried to use the Ubuntu 16 Server image when I was specifically trying to create an unattended Ubuntu 16 Desktop image install. The issue arises because of the implementation differences of d-i (debian installer) and ubiquity. Since the Server image will pay attention and use all of the d-i commands in the preseed file, most of the questions I asked are irrelevant to the Server image. However, due to the implementation of ubiquity as the installer of the Desktop image a lot of d-i commands are ignored and you are very limited and a lot of documentation is missing.

Documentation Links Found

  • Here is the link for Ubiquity ignoring the preseed/late_command (I believe it ignores the preseed/early_command too)
  • Here is the Ubiquity Documentation it talks about which installer components will not be used in Ubiquity, but as you will notice even in this documentation it says the preseed/early_command but I would test that thoroughly to verify since it didn't seem to work for me (I admit I didn't test the early_command rigorously so I may be wrong).

Successful Process

Here is my process for successfully creating an unattended Ubuntu Desktop 16.04 LTS iso.

Mount Ubuntu ISO

You will need to mount the ISO files so that you can edit the pertinent files.

mkdir -p /mnt/iso
mount -o loop ~/Downloads/ubuntu-16.04.1-desktop-amd64.iso /mnt/iso

Copy ISO Files

We will need to copy the files in mounted ISO to a different directory so that we can edit them. Feel free to use any directory you like, I chose the /opt directory due to another how-to, but /tmp could just as easily be used.

mkdir -p /opt/ubuntuiso
cp -rT /mnt/iso /opt/ubuntuiso

Edit the txt.cfg File

Here we will edit the /opt/ubuntuiso/isolinux/txt.cfg file and customize our boot parameters to get a completely unattended install which will include a preseed file. Use any editor of your choice:

#default live
#label live
#  menu label ^Try Ubuntu without installing
#  kernel /casper/vmlinuz.efi
#  append  file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash ---
#label live-install
#  menu label ^Install Ubuntu
#  kernel /casper/vmlinuz.efi
#  append  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash ---
#label check
#  menu label ^Check disc for defects
#  kernel /casper/vmlinuz.efi
#  append  boot=casper integrity-check initrd=/casper/initrd.lz quiet splash ---
#label memtest
#  menu label Test ^memory
#  kernel /install/mt86plus
#label hd 
#  menu label ^Boot from first hard disk
#  localboot 0x80

default live-install
label live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz.efi
  append  file=/cdrom/ks.preseed auto=true priority=critical debian-installer/locale=en_US keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=English countrychooser/shortlist=US localechooser/supported-locales=en_US.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet splash noprompt noshell ---

Please take note of a few things:

  • I commented out all original text in the file.
  • I added all text after and including "default live-install" at the bottom
  • I named the preseed file "ks.preseed" and it will be in the top level directory of the ISO (/opt/ubuntuiso)

Use or Create a Preseed File

Use an already existing preseed file with caution! I have not found any that just work. This isn’t to say they don’t exist, I just didn’t find any with quite a bit of searching. There are many ways to configure a preseed file, but I found many options to be ignored, outlined in the Ubiquity Documentation I linked above and in the link for preseed/late_command vs ubiquity/success_command. I am including my simple working preseed file that works with the above txt.cfg file.

For netcfg/get_hostname string and netcfg/get_domain string you can put whatever you want it to be. I used unassigned-hostname and unassigned-domain since I will just change it later through a scripting process.

For any custom command you want to run after installation you need to use the:

ubiquity ubiquity/success_command string

Followed by any command you want to run. Pay attention to continuing the strings with ";\" and using the "/target" to change anything pertaining to the new system installed.

# Partitioning
# Old style using d-i command
#d-i partman-auto/disk string /dev/sda
#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-auto/choose_recipe select atomic

# Newer ubiquity command
ubiquity partman-auto/disk string /dev/sda
ubiquity partman-auto/method string regular
ubiquity partman-lvm/device_remove_lvm boolean true
ubiquity partman-md/device_remove_md boolean true
ubiquity partman-auto/choose_recipe select atomic

# This makes partman automatically partition without confirmation
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

# Locale
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us

# Network
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/choose_interface select auto

# Clock
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
d-i time/zone string US/Pacific
d-i clock-setup/ntp boolean true

# Packages, Mirrors, Image
d-i mirror/country string US
d-i apt-setup/multiverse boolean true
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true

# Users
d-i passwd/user-fullname string User
d-i passwd/username string user
d-i passwd/user-password-crypted password yourEncryptedPasswd
d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password rootEncryptedPasswd
d-i user-setup/allow-password-weak boolean true

# Grub
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian boolean true
d-i finish-install/reboot_in_progress note

# Custom Commands
ubiquity ubiquity/success_command string \
  sed -i -e 's/dns=dnsmasq/#dns=dnsmasq/' /target/etc/NetworkManager/NetworkManager.conf ;\
  cp -a /cdrom/scripts/ /target/root/ ;\
  cp -a /cdrom/salt/ /target/root/

Please note these things as I left them in for illustrative purposes and they will likely be different in your preseed command.

  • The user/root password need to be added by you. Here is the link that shows you 3 different ways to make a crypt 3 password.
  • You may want to change the groups your user is assigned to.
  • You will definitely want to change the success_command. I left it to show how it can be formatted and how to use the /target environment.

Create New ISO

Create the ISO so you can test out your preseed file. If you use one or make your own, you will need to test it as this will LIKELY be the place your process will fail. I wrote a script for quick testing, but you could just point the preseed file at an http:// hosted preseed file and test very quickly that way.

mkisofs -D -r -V "UNATTENDED_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /tmp/ubuntu16-desktop-unattended-install.iso /opt/ubuntuiso

Feel free to change the output name and the the directory in which you will save it.

Burn ISO

I would suggest testing on virtualbox or the like and once you have it working, then burn it to a DVD. You should now have a working unattended Ubuntu Desktop 16.04 LTS install DVD.

Feedback, Corrections, Errors

I wrote this all in one go and there may be errors, typos, or things that got messed up along the way. If anyone tries this, please let me know if you encounter an error in the process. And please remember that if you create your own preseed file, I will probably not be able to answer why your unattended install is broken and not working since ubiquity likes to ignore and not do certain things in the preseed file. I hope this helpful to someone.

10
  • Hi @BrandonAuthier, thank you for the information you shared here. I followed very carefully all your steps and finally tried to make a bootable USB key from the /tmp/ubuntu16-desktop-unattended-install.iso image finally made. To do that I used this command as root (my USB device being at /dev/sdc): dd if=/tmp/ubuntu16-desktop-unattended-install.iso of=/dev/sdc bs=4M && sync. Unfortunately the USB key (only when it contains this custom iso: it works for the original one) is not in the boot options proposed so it seems that it is not "bootable". Maybe you have an idea of what is happening? Jul 4, 2017 at 8:26
  • 1
    In fact the USB key is seen as a "Diskette Drive" instead of a "USB Storage Device" (from which I can boot). Jul 4, 2017 at 10:52
  • 2
    I think to create a bootable USB key is slightly different and requires renaming isolinux/ and isolinux.cfg to syslinux/ and syslinux.cfg. I wrote this for a CD/DVD and was using it in a VM for testing and then installing via a DVD. I didn't try making it into a bootable USB, but there could be a number of things that went wrong with the dd command. If you didn't change those names, that probably was part of it. If you didn't format the USB correctly and give it a bootable flag with fdisk, that could be another. When I have a little more time, I could figure out how to do it and post it. Jul 12, 2017 at 21:55
  • 3
    I'd highly suggest using mkusb to put your ISO on a USB if you aren't familiar with the low level guts of Linux booting and grub/syslinux loading.
    – dragon788
    Jul 13, 2017 at 16:24
  • 1
    @HadrienTOMA dragon788 is probably right about using mkusb if you have an Ubuntu machine since it looks to be installed by a PPA. Honestly, looking up how to format the usb with fdisk, creating the proper filesystem, and then dd-ing is worth doing to learn. The only thing I was concerned about was my ISO image may not work by just dd-ing it. I will let you know once I have a chance to test it out. Jul 22, 2017 at 5:45
3

Have a look at: https://github.com/core-process/linux-unattended-installation

This project provides all you need to create an unattended installation of a minimal setup of Linux, whereas minimal translates to the most lightweight setup - including an OpenSSH service and Python - which you can derive from the standard installer of a Linux distribution. The idea is, you will do all further deployment of your configurations and services with the help of Ansible or similar tools once you completed the minimal setup.

4
  • Hmm, looks somewhat interesting. I definitely would wait for 18.04 LTS, but I may mess with this just to see how it works out. I already ended up solving it by figuring everything out as posted above. However, seeing how other people solve it is always good for different ideas. Aug 31, 2017 at 23:06
  • 1
    Just added support to build disk images as well as ISO images. Enjoy!
    – Niklas
    Sep 12, 2017 at 21:26
  • what is the username? I was able to install using this method but no idea about the login details. Dec 12, 2019 at 16:57
  • @KrishnadasPC see my response here: github.com/core-process/linux-unattended-installation/issues/…
    – Niklas
    Dec 13, 2019 at 18:02
2

Great job Brandon Authier for your post and instructions, you helped me a lot.

I had one issue with your method though: I found out that after install finishes and PC reboots the GRUB hangs.

So I added to the ks.preseed the following:

# Due notably to potential USB sticks, the location of the MBR can not be
# determined safely in general, so this needs to be specified:

d-i grub-installer/bootdev  string /dev/sda

# To install to the first device (assuming it is not a USB stick):
#d-i grub-installer/bootdev  string default

This prevents crashing the grub install if you do not remove the USB stick. I got this from https://www.debian.org/releases/stable/example-preseed.txt

1
  • 1
    So it hung because the USB was still inserted and tried to boot from the USB again? I can definitely add this to the preseed file above, but wanted to make sure I know what happened and what this prevents. Oct 28, 2018 at 18:46
1

First off big thanks to Brandon for working through all this!! There are many, many preseed files on the web, showing the demand for skipping through the install screens.

With 20.04 out, I wanted to add a couple of notes from my tests. I'm using Kubuntu, but it looks identical for other Buntus:

  • CURRENTLY EDITING: if you use virt-manager, you can install to a raw (ext4) partition and install to entire disk, skipping partitioning partman 'recipes' if your able to. (I use a single swap partition for all Linux OSes, or a large swap file on another partition, so I can backup whole copies of OS partitions quicker). It would be faster to copy this partition over a network than install on many machines with USB (unless you had a big USB cloning system).
  • I use AIOBOOT as a boot menu (includes Refind, Clover, etc), so I never change the system GRUB. And installing into a VM renders that null, but use efibootmgr --help, if you mess up your boot order.
  • I couldnt get the default isolinux.cfg menu selection to work (below). Didnt need boot=casper. Change default vesamenu.c32 to default install or what you name your menu entry, from here..still didnt work. BTW, there wasnt an entry for direct install in 20.04 originally.
  • I happened to try Kickstarter first, so it gave me a ks.cfg (which didnt work) and a ks.preseed (with a single line). Since there was a kubuntu.preseed exisiting in the ISO, I copied those lines to ks.preseed (contents below) and then added Brandon's preseed magic, changing the custom commands. It also encrypted my generic starter password to $1$D2dImaFN$AEBMU.qOh2qer0v/alzeH0 which is 123. You can plug that in as I did below. Dont forget to change it, though ;)!
  • More official info from Ubuntu on Automatic Install here. May be old, as it claims Kickstarter works, though "This method is not as flexible as the preconfiguration file method above, but it requires less knowledge of how the installer works." An official example of just a preseed from Ubuntu is here.
  • Changed timeout 30 in isolinux/isolinux.cfg to 1
  • An important change in isolinux/txt.cfg to the maybe-ubiquity to automatic-ubiquity. This is the installer. Possibly only-ubiquity, more info here.
  • I used the lines for partitioning in ks.preseed from here, because they all use the new ubiquity command. Only one extra line appears different partman-lvm/confirm string boolean true. I didnt test Brandon's.
default install
...all the original entries...
label install
  menu label ^Install kUbuntu auto
  kernel /casper/vmlinuz
  append  file=/cdrom/ks.preseed auto=true priority=critical debian-installer/locale=en_US keyboard-configuration/layoutcode=us ubiquity/reboot=true languagechooser/language-name=English countrychooser/shortlist=US localechooser/supported-locales=en_US.UTF-8 automatic-ubiquity initrd=/casper/initrd --
# Enable extras.ubuntu.com.
d-i apt-setup/extras    boolean true
# Install the Kubuntu desktop.
tasksel tasksel/first   multiselect kubuntu-desktop
#tasksel tasksel/first   multiselect ubuntu-desktop
# Install KDE translation packages.
d-i pkgsel/language-pack-patterns   string language-pack-kde-$LL kde-i18n-$LL
# Install the KDE oem-config frontend (if in OEM mode).
d-i oem-config-udeb/frontend    string kde
# On live DVDs, don't spend huge amounts of time removing substantial
# application packages pulled in by language packs. Given that we clearly
# have the space to include them on the DVD, they're useful and we might as
# well keep them installed.
ubiquity    ubiquity/keep-installed string icedtea6-plugin openoffice.org

# Partitioning
# Not needed if only one disk
#ubiquity   partman-auto/disk string /dev/sda

ubiquity    partman-auto/method string regular
ubiquity    partman-lvm/device_remove_lvm string boolean true
ubiquity    partman-md/device_remove_md string boolean true
ubiquity    partman-lvm/confirm string boolean true
ubiquity    partman-auto/choose_recipe select atomic

ubiquity    partman/confirm_write_new_label string boolean true
ubiquity    partman/choose_partition select finish
ubiquity    partman/confirm string boolean true
ubiquity    partman/confirm_nooverwrite string boolean true

# Locale
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us

# Network
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/choose_interface select auto

# Clock
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
d-i time/zone string US/Pacific
d-i clock-setup/ntp boolean true

# Packages, Mirrors, Image
d-i mirror/country string US
d-i apt-setup/multiverse boolean true
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true

# Users
d-i passwd/user-fullname string User
d-i passwd/username string user
d-i passwd/user-password-crypted password $1$D2dImaFN$AEBMU.qOh2qer0v/alzeH0
d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $1$D2dImaFN$AEBMU.qOh2qer0v/alzeH0
d-i user-setup/allow-password-weak boolean true

# Grub
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian boolean true
d-i finish-install/reboot_in_progress note

# Custom Commands
ubiquity ubiquity/success_command string \
  echo 'command1' ;\
  read -p "Press enter to continue" ;

A little more about installing to a raw partition via a VM.. Currently, the partition isnt recognized by gparted, but I can create a new VM in virt-manager and it boots. To install in virt-manager, just select ISO install, enter the partition /dev/sda# (or more safely: /dev/disk/by-id/...) into custom storage field. Click customize before install and you can add more hardware (button at bottom) for storage as IDE or SATA devices. I had to change the Direct Kernel Boot in Boot Options to add the paths and arg pointing to the correct UUID BOOT_IMAGE=/boot/vmlinuz-4.18.0-14-generic root=UUID=..., but that was after I had converted a VirtualBOX VDI, and this time it just boots without those fields. I need to test if it boots from harddisk via my boot manager, though. Also, I've heard Vagrant is a newer VM manager. Also, change Network in virt-manager to NAT.

0

I am sorry to hear that my former method did not work. Fortunately, I found a script designed by Rinck Sonnenberg (netson) that would create unattended AMD64 ISOs of Ubuntu Server on GitHub, and I forked it. I then improved the script by adding the capability to create I386 ISOs. I also changed the OS from Ubuntu Server to Ubuntu Desktop. You need not visit the GitHub repository, you can just follow the below instructions.

Run these commands:

$ wget https://raw.githubusercontent.com/iPlus-TechNet/ubuntu-unattended/master/create-unattended-iso.sh
$ chmod +x create-unattended-iso.sh
$ sudo ./create-unattended-iso.sh

Sometimes wget is not available. If this is the case, use curl:

$ curl -O https://raw.githubusercontent.com/iPlus-TechNet/ubuntu-unattended/master/create-unattended-iso.sh

If none of these work, download it and move it to your home folder.

You will then be asked which version of Ubuntu to install, and then the questions Ubuntu would ask if you were doing a manual install. The script will then download the Ubuntu ISO, and then apply the changes requested to it. You now have an ISO that is all ready for an unattended installation!

This should answer your question, because it worked just fine for me. It is also good that this method is far easier than my former answer. I hope it works for you as it did for us.

8
  • 1
    I appreciate the answer and after reading through your script I see you are using Ubuntu Server which I explicitly have said multiple times now I do not want to use. I already know that Ubuntu Server uses d-i and actually utilizes the traditional preseed parameters. However, I want Ubuntu Desktop as my question clearly states. I don't want to install the server and have to build the desktop version after installing. Sep 6, 2016 at 18:24
  • OK. I will change it to Ubuntu Desktop. Sep 6, 2016 at 23:51
  • I fixed it. I hope it works for you now. Sep 7, 2016 at 0:07
  • 1
    Well it should be very simple - your script only downloads SERVER images - which is not what I asked for and that is why your scripting solution fails. It has everything to do with my system and is nothing odd since it is the DESKTOP version which I explicitly stated in the question of this thread. Thank you for trying, but the server image will not solve this question. Oct 13, 2016 at 20:14
  • 2
    github.com/iPlus-TechNet doesn't exist anymore? I have a 404 error. Jul 1, 2017 at 16:42
0

Thanks so much! This is the best answer I've found to this question so far. The automatic installation part all work like a charm. Just want to add to the part of creating new iso file. The iso image created with the command in your answer works perfectly for VM installation in my tests, but not for USB boot drives. The one I tried below works fine for creating USB installation media and boot in UEFI mode.

OLD_IMAGE=/path/to/iso
MBR_FILE=/tmp/ubuntu_isohybrid_mbr.img
dd if="$OLD_IMAGE" bs=1 count=446 of="$MBR_FILE"

IMAGE=custom.iso
BUILD=/mnt/iso

xorriso -as mkisofs -r -V "Custom Ubuntu Install CD" \
            -cache-inodes -J -l \
            -isohybrid-mbr "$MBR_FILE" \
            -c isolinux/boot.cat \
            -b isolinux/isolinux.bin \
               -no-emul-boot -boot-load-size 4 -boot-info-table \
            -eltorito-alt-boot \
            -e boot/grub/efi.img \
               -no-emul-boot -isohybrid-gpt-basdat \
            -o "$IMAGE" \
            "$BUILD"

rm "$MBR_FILE"

And to have the automation working in UEFI mode, you would also need to edit boot/grub/grub.cfg in the image pretty much the same way as the isolinux.cfg mentioned in the answer above. Mine looks like

if loadfont /boot/grub/font.pf2 ; then
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

menuentry "Customized Automatic Install" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/custom.seed boot=casper automatic-ubiquity initrd=/casper/initrd quiet splash noprompt noshell ---
    initrd  /casper/initrd
}

where custom.seed is the preseed file I am using, and I put some of the locale settings into the preseed file instead of leaving them in this line.

-1

PLEASE DO NOT TRY THIS METHOD. DOES NOT WORK (UNLESS YOU ARE TRYING TO KILL TIME):

I have seen the answer to this all around. I will tell you the most common solution. I have never tried it before myself, so it may be outdated. I really do not understand the point of it, as just doing a manual install itself would be easier, but anyways...

Login as root or run $ sudo su -

Download and mount the ISO. Do NOT do this manually from the Ubuntu website.

# mkdir -p /mnt/iso
# mount -o loop ubuntu.iso /mnt/iso

back up and move relevant files.

# mkdir -p /opt/ubuntuiso
# cp -rT /mnt/iso /opt/ubuntuiso

Block the language part of the GUI from appearing

# cd /opt/ubuntuiso
# echo en >isolinux/lang

Add a "Kickstart" file.

# apt install system-config-kickstart
# system-config-kickstart

[OPTIONAL] Add packages for your installation

# vim /path/to/ks.cfg #[OPTIONAL]

Or just search for it in your files and edit it directly. Add the %packages section, and put your packages under it.

%packages
# Add your packages below. Example:
@ ubuntu-server
apache2
mysql-server
php7.0
php-pear
libapache2-mod-php7.0 
php7.0-mysql
php7.0-curl
php7.0-json
php7.0-cgi

As I said, I have never done this myself, so if you had a configuration like the above, it may not actually install the LAMP stack and you would have to do it manually later.

Suppress questions with a "preseed" file.

# echo 'd-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition \
select Finish partitioning and write changes to disk
d-i partman/confirm boolean true' > ks.preseed

Activate the files:

# vi isolinux/txt.cfg

Then searching for:

label install
  menu label ^Install Ubuntu Server
  kernel /install/vmlinuz
  append  file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz quiet --

You will then need to add ks=cdrom:/ks.cfg and preseed/file=/cdrom/ks.preseed. Remove words quiet and vga=788, so it looks like this:

append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --

Now you can create the new answer:

# mkisofs -D -r -V "ATTENDLESS_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /opt/autoinstall.iso /opt/ubuntuiso

And there you go!

5
  • Now that I have looked around, I saw the same exact formula here from Elazar Leibovich. I guess I was right about it being the most common. Aug 20, 2016 at 14:27
  • 1
    Hmmm, I'm not sure what happened to my comment prior about this post... This above method DOES NOT WORK. If you are reading this looking for the answer please do not try this it is a waste of your time. I specifically link this exact process in my original question clearly outlining the flaws of this method: ks are far too limited ps files as of Ubuntu 16.01, due to ubiquity, ignore a lot of features txt.cfg does not work for Ubuntu Desktop 16.04 as indicated by this or other posts You have to pass in quite a few boot parameters to bypass and ever even reach the ps-ding for ubiquity Sep 2, 2016 at 1:14
  • 3
    The poster clearly did not read my post. He wrote, "I have never tried it before myself, so it may be outdated. I really do not understand the point of it, as just doing a manual install itself would be easier, but anyways...". Didn't even try it and purports it as a solution??? Secondly, I explain I want an unattended install where I can walk away. Not manual. Imagine installing 100 boxes, would you want to do that manually? No. Sep 2, 2016 at 1:34
  • Oh. Sorry about that. I might look into other ways to do this. Sep 6, 2016 at 1:17
  • I guess iplustech.net was not right in the first comment about this formula working because it is the most common.
    – alchemy
    Apr 28, 2020 at 17:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .