Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

At work we often need to install Ubuntu Server and several extra packages while offline. To make this faster, I'm creating a custom Ubuntu Server install via preseeding (following this documentation: https://help.ubuntu.com/community/InstallCDCustomization). Installing extra packages was easy and works well.

In addition to adding a few packages, I would like to add another repository to the default set. This is where it seems to get tricky. Remember that, at install time, these computers are offline. However, I need to add an online repository to the list along with adding its key. Adding the repo to the list is easy with

d-i   apt-setup/local0/repository string <repo url>

But the key NEEDS TO BE ADDED OFFLINE. So I downloaded the key and added it to the ISO (I made a new "keys" directory), thinking that I should be able to access it like the isolinux/txt.cfg file (specifically, the "append file=/cdrom/preseed..." bit) but I can't seem to be able to access /cdrom from the preseed file. The simplest test is a late_command:

d-i   preseed/late_command string df > /target/home/df.txt; ls -Rl /cdrom > /target/home/cdrom.txt; ls -Rl /target/media/cdrom > /target/home/target_cdrom.txt[/CODE]

The server install tells me the above command exits with error code -1, and the only file out of those three that contains anything is the df, which looks like this:

Filesystem             1K-blocks     Used   Available   Use%   Mounted on
none                      205182      180      204992     0%   /run
devtmpfs                 1020212        8     1020204     0%   /dev
/dev/sr0                 1408470  1408470           0   100%   /cdrom
/dev/mapper/ubuntu-root 18540428  3541660    14068568    20%   /target
/dev/sda1                 233191    24991      195759    11%   /target/boot
/dev/mapper/ubuntu-root 18540428  3541660    14068568    20%   /dev/.static/dev
devtmpfs                 1020212        8     1020204     0%   /target/dev
/dev/sr0                 1408470  1408470           0   100%   /target/media/cdrom

So obviously both /cdrom and /target/media/cdrom exist. Why can't I read them from the preseed file? Is the ISO actually mounted there as in isolinux/txt.cfg? Is there any other way to add this key without needing to download it like the following?

d-i   apt-setup/local0/key string <remote repo key url>

Thank you for your help.

share|improve this question
add comment

1 Answer 1

It seems that when you install from iso-file (in virtual machine), cdrom contents are not visible in preseed, just as you described above. Only when you actually write the iso to usb stick (make the iso hybrid first) and install from that, it works as it should. Don't know why, but I think the answer is hidden in debian-installer somewhere.

EDIT: I should mention also that you have to install to a real computer from that usb stick, because if you try to install to virtual machine, installation process will break for some unknown reason. The answer to be found in d-i again ...

Kyle, please elaborate what was your method of installation (in virtual machine, from cdrom, from usb, ... ?)

Have a look at this also: http://www.wallix.org/2011/11/02/automatic-installation-of-debian-squeeze-from-a-usb-flash-drive/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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