for the VM part you ned to pass the IP in the boot command line to have the
IP
from there can download the preseed but the IP setting need to happen
before if you use preseed over the network.
to be clear all that is more a debian question than a packer question.
This is what I use for ubuntu, hope it helps as reference, you are missing
some options to force/ensure dhcp is disabled and fixed ip is set.
however if doesn't work, i will suggest check debian documentation or check
on some debian forum:
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic preseed/file=/floppy/preseed.cfg ",
"debian-installer=en_US auto locale=en_US
kbd-chooser/method=us ",
"netcfg/hostname={{user `hostname`}} hostname={{user
`hostname`}} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP
keyboard-configuration/layout=USA keyboard-configuration/variant=USA
console-setup/ask_detect=false ",
"initrd=/install/initrd.gz netcfg/enable=true
netcfg/disable_autoconfig=true interface=eth0 netcfg/get_ipaddress={{user
`fixip_ipaddress`}} netcfg/get_netmask={{user `fixip_netmask`}} ",
"netcfg/get_gateway={{user `fixip_gateway`}}
netcfg/get_nameservers={{user `fixip_nameservers`}}
netcfg/disable_dhcp=true netcfg/confirm_static=true -- <enter>"
],
you add a variables block with those values, or just replace them:
"variables": {
"hostname": "precise64",
"fixip_ipaddress": "{{env `fixip_ipaddress`}}",
"fixip_netmask": "{{env `fixip_netmask`}}",
"fixip_gateway": "{{env `fixip_gateway`}}",
"fixip_nameservers": "{{env `fixip_nameservers`}}"
}
Alvaro
On Sun, Nov 26, 2017 at 6:48 AM, valli nayagam <[email protected]> wrote:
> Thanks for the answer, But the VM doesn't take the ip address
> 192.168.0.130 which is given in the preseed and json file.
>
>
> <https://lh3.googleusercontent.com/-0zE-BxZxerY/WhpVhj58KoI/AAAAAAAABqU/HUMFP988b7ERT0FXQXb9EUUvTib4UofnACLcBGAs/s1600/address.PNG>
>
>
>
>
> On Sunday, 26 November 2017 10:36:20 UTC+5:30, Rickard von Essen wrote:
>>
>> You (at least) have to add "ssh_host": "192.168.0.130".
>>
>> On 26 November 2017 at 05:15, valli nayagam <[email protected]> wrote:
>>
>>> Hi, Its working once I change the network type. Now I'm trying to set
>>> the static ip address for the Debian VM but its not working. Installation
>>> was completed successfuilly and statictally given ip address is not getting
>>> assigned
>>>
>>> Please have a look of json and preseed changes and help me on this topic
>>>
>>> Template:
>>>
>>> "builders": [
>>> {
>>> "type": "virtualbox-iso",
>>> "boot_command": [
>>> "<esc><wait>",
>>> "install <wait>",
>>> "preseed/url=http://192.168.0.105:8080/preseed-deb9.cfg ",
>>> "debian-installer=en_US <wait>",
>>> "auto <wait>",
>>> "locale=en_US <wait>",
>>> "kbd-chooser/method=us <wait>",
>>> "d-i netcfg/disable_autoconfig boolean true <wait>",
>>> "d-i netcfg/disable_dhcp true <wait>",
>>> "d-i netcfg/confirm_static=true <wait>",
>>> "d-i netcfg/dhcp_options select Configure network manually <wait>",
>>> "d-i netcfg/get_ipaddress string 192.168.0.130 <wait>",
>>> "d-i netcfg/get_netmask string 255.255.255.0 <wait>",
>>> "d-i netcfg/get_gateway string 192.168.0.1 <wait>",
>>> "d-i netcfg/get_nameservers string 192.168.0.1 <wait>",
>>> "d-i netcfg/confirm_static boolean true <wait>",
>>> "netcfg/get_hostname={{ .Name }} <wait>",
>>> "netcfg/get_domain=testing.com <wait>",
>>> "fb=false <wait>",
>>> "debconf/frontend=noninteractive <wait>",
>>> "console-setup/ask_detect=false <wait>",
>>> "console-keymaps-at/keymap=us <wait>",
>>> "keyboard-configuration/xkb-keymap=us <wait>",
>>> "<enter><wait>"
>>> ],
>>> "boot_wait": "10s",
>>> "disk_size": 45536,
>>> "guest_os_type": "Debian_64",
>>> "http_directory": "http",
>>> "iso_checksum": "a6e3743a6df3e69851fd5a3e7f6f1466",
>>> "iso_checksum_type": "md5",
>>> "iso_url": "file:///../resources/operatingSystem_ISO/debian-9.2.1-
>>> amd64-DVD-1.iso",
>>> "vm_name": "Testmachine",
>>> "ssh_username": "viewpoint",
>>> "ssh_password": "user",
>>> "ssh_port": 22,
>>> "ssh_wait_timeout": "10000s",
>>> "shutdown_command": "echo 'halt -p' > shutdown.sh; echo
>>> 'vagrant'|sudo -S bash 'shutdown.sh'",
>>> "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
>>> "virtualbox_version_file": ".vbox_version",
>>> "vboxmanage": [
>>> ["modifyvm", "{{.Name}}", "--memory", "512"],
>>> ["modifyvm", "{{.Name}}", "--cpus", "1"],
>>> ["modifyvm", "{{.Name}}", "--nic1", "bridged"],
>>> ["modifyvm", "{{.Name}}", "--bridgeadapter1", "TP-LINK Wireless USB
>>> Adapter"],
>>> ["modifyvm", "{{.Name}}", "--vrde", "on"]
>>> ]
>>> }
>>> ]
>>> }
>>>
>>> Preseed changes:
>>>
>>>
>>> # netcfg will choose an interface that has link if possible. This makes
>>> it
>>> # skip displaying a list if there is more than one interface.
>>> d-i netcfg/choose_interface select auto
>>>
>>> # To pick a particular interface instead:
>>> #d-i netcfg/choose_interface select enp0s3
>>>
>>> # To set a different link detection timeout (default is 3 seconds).
>>> # Values are interpreted as seconds.
>>> #d-i netcfg/link_detection_timeout string 10
>>>
>>> # If you have a slow dhcp server and the installer times out waiting for
>>> # it, this might be useful.
>>> #d-i netcfg/dhcp_timeout string 60
>>> #d-i netcfg/dhcpv6_timeout string 60
>>>
>>> # If you prefer to configure the network manually, uncomment this line
>>> and
>>> # the static network configuration below.
>>> d-i netcfg/disable_autoconfig boolean true
>>> d-i netcfg/disable_dhcp true
>>> d-i netcfg/confirm_static=true
>>>
>>> # If you want the preconfiguration file to work on systems both with and
>>> # without a dhcp server, uncomment these lines and the static network
>>> # configuration below.
>>> d-i netcfg/dhcp_failed note
>>> d-i netcfg/dhcp_options select Configure network manually
>>>
>>> # Static network configuration.
>>> #
>>> # IPv4 example
>>> d-i netcfg/get_ipaddress string 192.168.0.130
>>> d-i netcfg/get_netmask string 255.255.255.0
>>> d-i netcfg/get_gateway string 192.168.0.1
>>> d-i netcfg/get_nameservers string 192.168.0.1
>>> d-i netcfg/confirm_static boolean true
>>>
>>> Thanks in advance
>>>
>>>
>>> Valli
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sunday, 26 November 2017 01:40:14 UTC+5:30, Rickard von Essen wrote:
>>>>
>>>> If you don't change the network type it should work with the example in
>>>> the docs. Get that working first and then change the network type only if
>>>> you really need to.
>>>>
>>>> On Nov 25, 2017 21:00, "valli nayagam" <[email protected]> wrote:
>>>>
>>>>> Because the machine boots with Network as "Nat" and may be because of
>>>>> that the pressed.file is not accessible for the VM
>>>>>
>>>>> Correct me if i'm wrong and what could be the problem to retrieve the
>>>>> preseed file.
>>>>>
>>>>> Regards
>>>>> Valli
>>>>>
>>>>> On Sunday, 26 November 2017 01:03:09 UTC+5:30, Rickard von Essen wrote:
>>>>>>
>>>>>> Just to clearify, why do you need a bridged network?
>>>>>>
>>>>>> On Nov 25, 2017 20:04, "valli nayagam" <[email protected]> wrote:
>>>>>>
>>>>>> Hello everyone,
>>>>>>
>>>>>> I'm newbie to packer, I'm trying to install debian os in virtualbox.
>>>>>> But it looks network is not connected with host machine and failed to
>>>>>> retrieve the preseed file.
>>>>>>
>>>>>> Json file:
>>>>>> {
>>>>>> "variables":{
>>>>>> "hostname": "testmachine",
>>>>>> "packerhost": "192.168.0.5",
>>>>>> "ip": "192.168.0.125",
>>>>>> "netmask": "255.255.255.0",
>>>>>> "gateway": "192.168.0.1",
>>>>>> "domain": "test.net",
>>>>>> "nameservers": "192.168.0.1",
>>>>>> "language_country": "en_US",
>>>>>> "keyboard": "en"
>>>>>> },
>>>>>>
>>>>>> "builders": [
>>>>>> {
>>>>>> "type": "virtualbox-iso",
>>>>>> "guest_os_type": "Ubuntu_64",
>>>>>> "iso_url": "file:///../resources/operatingSystem_ISO/debian-9.2.1-
>>>>>> amd64-DVD-1.iso",
>>>>>> "iso_checksum": "a6e3743a6df3e69851fd5a3e7f6f1466",
>>>>>> "iso_checksum_type": "md5",
>>>>>> "http_directory": "http",
>>>>>> "http_port_min": "9001",
>>>>>> "http_port_max": "9001",
>>>>>> "ssh_username": "packer",
>>>>>> "ssh_password": "packer",
>>>>>> "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
>>>>>> "vboxmanage": [
>>>>>> [ "modifyvm", "{{.Name}}", "--memory", "2048" ],
>>>>>> [ "modifyvm", "{{.Name}}", "--vram", "36" ],
>>>>>> [ "modifyvm", "{{.Name}}", "--cpus", "2" ],
>>>>>> [ "modifyvm", "{{.Name}}", "--hardwareuuid",
>>>>>> "02f110e7-369a-4bbc-bbe6-6f0b6864ccb6" ],
>>>>>> [ "modifyvm", "{{.Name}}", "--nic0","bridged"]
>>>>>> ],
>>>>>> "boot_command": [
>>>>>> "<esc><wait>",
>>>>>> "install ",
>>>>>> "preseed/url=http://192.168.0.105:8080/preseed-deb9.cfg ",
>>>>>> "hostname={{user `hostname`}} ",
>>>>>> "netcfg/disable_autoconfig=true ",
>>>>>> "netcfg/get_domain={{user `domain`}} ",
>>>>>> "netcfg/confirm_static=true ",
>>>>>> "netcfg/get_ipaddress={{user `ip`}} ",
>>>>>> "netcfg/get_netmask={{user `netmask`}} ",
>>>>>> "netcfg/get_gateway={{user `gateway`}} ",
>>>>>> "netcfg/get_nameservers={{user `nameservers`}} ",
>>>>>> "debian-installer={{user `language_country`}} auto locale={{user
>>>>>> `language_country`}} ",
>>>>>> "keyboard-configuration/xkb-keymap={{user `keyboard`}} ",
>>>>>> "fb=false ",
>>>>>> "debconf/frontend=noninteractive ",
>>>>>> "console-setup/ask_detect=false ",
>>>>>> "<enter><wait>"
>>>>>> ]
>>>>>> }]
>>>>>>
>>>>>> So, I tried to add a nic card to vbox but it failed with error
>>>>>>
>>>>>>
>>>>>>
>>>>>> H:\VMWare_Installation\packer>packer build -on-error=abort
>>>>>> packer-test-valli.json
>>>>>> virtualbox-iso output will be in this color.
>>>>>>
>>>>>> ==> virtualbox-iso: Downloading or copying Guest additions
>>>>>> virtualbox-iso: Downloading or copying:
>>>>>> file:///C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso
>>>>>> ==> virtualbox-iso: Downloading or copying ISO
>>>>>> virtualbox-iso: Downloading or copying:
>>>>>> file:///H:/VMWare_Installation/resources/operatingSystem_
>>>>>> ISO/debian-9.2.1-amd64-DVD-1.iso
>>>>>> ==> virtualbox-iso: Starting HTTP server on port 9001
>>>>>> ==> virtualbox-iso: Creating virtual machine...
>>>>>> ==> virtualbox-iso: Creating hard drive...
>>>>>> ==> virtualbox-iso: Creating forwarded port mapping for communicator
>>>>>> (SSH, WinRM, etc) (host port 2376)
>>>>>> ==> virtualbox-iso: Executing custom VBoxManage commands...
>>>>>> virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1511636150
>>>>>> --memory 2048
>>>>>> virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1511636150
>>>>>> --vram 36
>>>>>> virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1511636150
>>>>>> --cpus 2
>>>>>> virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1511636150
>>>>>> --hardwareuuid 02f110e7-369a-4bbc-bbe6-6f0b6864ccb6
>>>>>> virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1511636150
>>>>>> --nic0 bridged
>>>>>> ==> virtualbox-iso: Error executing command: VBoxManage error:
>>>>>> VBoxManage.exe: error: Invalid NIC number 0
>>>>>> ==> virtualbox-iso: Step "StepVBoxManage" failed, aborting...
>>>>>> Build 'virtualbox-iso' errored: unexpected EOF
>>>>>>
>>>>>> ==> Some builds didn't complete successfully and had errors:
>>>>>> --> virtualbox-iso: unexpected EOF
>>>>>>
>>>>>> ==> Builds finished but no artifacts were created.
>>>>>>
>>>>>>
>>>>>> What's the problem and how to retrive the preseed file?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> This mailing list is governed under the HashiCorp Community
>>>>>> Guidelines - https://www.hashicorp.com/community-guidelines.html.
>>>>>> Behavior in violation of those guidelines may result in your removal from
>>>>>> this mailing list.
>>>>>>
>>>>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>>>>> IRC: #packer-tool on Freenode
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Packer" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/packer-tool/f372f4af-7c34-
>>>>>> 40e1-976d-5105834d575f%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/packer-tool/f372f4af-7c34-40e1-976d-5105834d575f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>>
>>>>>> --
>>>>> This mailing list is governed under the HashiCorp Community Guidelines
>>>>> - https://www.hashicorp.com/community-guidelines.html. Behavior in
>>>>> violation of those guidelines may result in your removal from this mailing
>>>>> list.
>>>>>
>>>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>>>> IRC: #packer-tool on Freenode
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Packer" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/packer-tool/d6d4f9cf-621e-
>>>>> 491d-98c9-b319619694f7%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/packer-tool/d6d4f9cf-621e-491d-98c9-b319619694f7%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>> This mailing list is governed under the HashiCorp Community Guidelines -
>>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>>> violation of those guidelines may result in your removal from this mailing
>>> list.
>>>
>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>> IRC: #packer-tool on Freenode
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Packer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/packer-tool/a1e227ab-b0ea-47e6-b408-feea87e8c025%40googlegroups.com
>>> <https://groups.google.com/d/msgid/packer-tool/a1e227ab-b0ea-47e6-b408-feea87e8c025%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/70161e55-d904-4ee5-8f9f-6a42c4f6e51f%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/70161e55-d904-4ee5-8f9f-6a42c4f6e51f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
Alvaro
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/CAHqq0ewPpmmPiw9M_P82ZEQyT9%3DYGdNdyNZ_Vk43s-Gk3V_YVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.