R&D/OS

ubuntu preseed.cfg auto installation

sunshout 2012. 3. 21. 13:43
Bug description:
  if you pxeboot an image and hand it a preseed file, and in that
  preseed file you have:

    d-i netcfg/choose_interface select eth0

  it doesn't work and it pops up a menu and asks you what interface you
  want as your default interface.

  If, however, you pass netcfg/choose_interface=eth0 to the kernel as a
  boot option - it works as expected and does not display a menu option
  for this value.

# grub 관련
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/timeout string 5


# kernel boot parameter를 전달하는 방법

d-i debian-installer/add-kernel-opts string nomodeset


# Hostname을 dhcp에서 받은 정보로 채울 때

d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string



Setup your Repository and what directory in the repo to look for your install files

1
2
3
4
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

Partition Your disks and set them up as lvm

1
2
3
4
5
6
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-auto/purge_lvm_from_device  boolean true
d-i partman-auto-lvm/new_vg_name string system

Setup your logical Volumes in LVM and also non-lvm partitions
This will make
* BEWARE OF YOUR FORMATTING OF THIS PART – IT IS SUPER SENSITIVE

/boot : is a bootable filesystem with 300mb and ext3
/ : Is between 10GB and grows to the end of the disk and ext3
swap : uses 200% of the size of system ram for a disk or 8GB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#d-i partman-auto/init_automatically_partition \
#  select Guided - use entire disk and set up LVM
d-i partman-auto/expert_recipe string                         \
      boot-root ::                                            \
              40 300 300 ext3                                 \
                      $primary{ }                             \
                      $bootable{ }                            \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext3 }    \
                      mountpoint{ /boot }                     \
              .                                               \
              2000 10000 1000000000 ext3                      \
                      $lvmok{ }                               \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext3 }    \
                      mountpoint{ / }                         \
              .                                               \
              8000 8000 200% linux-swap                       \
                      $lvmok{ }                               \
                      method{ swap } format{ }                \
              .


Answer yes to all the partition and LVM prompts

1
2
3
4
d-i partman-lvm/confirm boolean true
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


Preseed 에서 Post install 예제

d-i preseed/late_command string \
in-target wget -O /tmp/files.tar.gz http://ubuntu/12.04/postinst/files.tar.gz ; \
in-target tar zxf /tmp/files.tar.gz -C /tmp/ ; \
in-target /bin/sh /tmp/files/post.sh ; \
in-target touch /root/test

참조

https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt

https://help.ubuntu.com/12.04/installation-guide/powerpc/preseed-using.html#preseed-loading

http://cookingclouds.com/2012/07/17/ubuntudebian-preseeding-with-lvm/