Thanks for your advice I solved my problem, I didn't know about --on-error≈ask thank for this :)
Le mercredi 24 janvier 2018 21:20:00 UTC+1, Rickard von Essen a écrit : > > 1) You really want >> to add to the /etc/sshd_config, your single > > truncates the file. > 2) Don't sudo if you run as root. > > Instead of reinventing the wheel start with a well-known template such as > https://github.com/chef/bento and adapt in small iterations. > > My general advice is when you run into problems, run with headless false, > and --on-error≈ask, and known credentials and jump in to the > instance/console etc and troubleshoot. Bringing up the console and doing > normal sysadmin trouble shooting is usually the solution to these things. > > // Rickard > > On 24 January 2018 at 10:45, Alexandre MARRE <[email protected] > <javascript:>> wrote: > >> Hi, in my late_command in my preseed not work. >> Currently i trying to connect to ssh with root account, packer can't and >> timeout. >> >> preseed >> # Install config >> d-i debian-installer/locale string en_US.UTF-8 >> d-i keyboard-configuration/xkb-keymap select fr >> >> # Netcfg >> d-i netcfg/choose_interface select auto >> d-i netcfg/get_hostname string unassigned-hostname >> d-i netcfg/get_domain string unassigned-domain >> >> # Clock & time/zone >> d-i clock-setup/utc boolean true >> d-i clock-setup/utc-auto boolean true >> d-i time/zone string UTC >> >> # Mirror >> d-i mirror/country string manual >> d-i mirror/http/directory string /debian >> d-i mirror/http/hostname string http.debian.net >> d-i mirror/http/proxy string >> >> # Partition >> 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 >> >> # Partman auto >> d-i partman-md/confirm boolean true >> 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 >> d-i partman/confirm_write_new_label boolean true >> >> # User init >> d-i passwd/root-login boolean true >> d-i passwd/root-password password baremetal >> d-i passwd/root-password-again password baremetal >> d-i passwd/make-user boolean false >> >> tasksel tasksel/first multiselect standard, ubuntu-server >> >> # Pkg >> d-i pkgsel/include string openssh-server sudo bzip2 wget curl make >> d-i pkgsel/install-language-support boolean false >> d-i pkgsel/update-policy select unattended-upgrades >> d-i pkgsel/upgrade select full-upgrade >> >> popularity-contest popularity-contest/participate boolean false >> >> # Grub >> d-i grub-installer/only_debian boolean true >> d-i grub-installer/with_other_os boolean true >> d-i grub-installer/bootdev string /dev/sda >> >> # Prevent packaged version of VirtualBox Guest Additions being installed: >> # d-i preseed/early_command string sed -is \ >> # '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \ >> # /usr/lib/pre-pkgsel.d/20install-hwpackages >> >> # Authorize root to login via ssh >> d-i preseed/late_command string \ >> echo "PermitRootLogin yes" > /etc/ssh/sshd_config >> >> d-i finish-install/reboot_in_progress note >> >> >> Packer file: >> { >> "variables": { >> "debian_version": "9.3.0" >> }, >> "builders": [ >> { >> "type": "virtualbox-iso", >> "boot_command": [ >> "<esc><wait>", >> "auto <wait>", >> "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort >> }}/preseed.cfg <wait>", >> "preseed/url/checksum=63e4b0d96d58b9085fb993cdb3c22495 >> <wait>", >> "<enter>" >> ], >> "boot_wait": "10s", >> "disk_size": 4096, >> "guest_os_type": "Debian_64", >> "headless": true, >> "http_directory": "http", >> "ssh_username": "root", >> "ssh_password": "baremetal", >> "ssh_port": 22, >> "ssh_wait_timeout": "10000s", >> "shutdown_command": "echo 'baremetal' |sudo -S /sbin/shutdown >> -hP now", >> "iso_checksum_type": "sha512", >> "iso_checksum_url": " >> http://cdimage.debian.org/cdimage/release/{{user >> `debian_version`}}/amd64/iso-cd/SHA512SUMS", >> "iso_url": "http://cdimage.debian.org/cdimage/release/{{user >> `debian_version`}}/amd64/iso-cd/debian-{{user >> `debian_version`}}-amd64-netinst.iso", >> "virtualbox_version_file": ".vbox_version", >> "vm_name": "baremetal-debian-{{user `debian_version`}}-amd64", >> "export_opts": [ >> "--manifest", >> "--vsys", >> "0", >> "--description", >> "{{user `vm_description`}}", >> "--version", >> "{{user `vm_version`}}" >> ], >> "format": "ova" >> } >> ], >> "provisioners": [ >> { >> "type": "shell", >> "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S >> bash '{{.Path}}'", >> "scripts": [ >> "scripts/sshd.sh" >> ] >> } >> ] >> } >> >> Thanks. >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/packer-tool/25df6696-5b96-4121-ae43-c0a50c206530%40googlegroups.com >> >> <https://groups.google.com/d/msgid/packer-tool/25df6696-5b96-4121-ae43-c0a50c206530%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/d3804da1-c8ad-49ab-81c1-6c15a8548845%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
