I am currently trying to make a vagrant box, using packer. The challenge is that the iso image ( Raspbian Jessie Pixels ) I am depending on has ssh disabled, so that it is preventing the script doing some necessary configuration as part of the packer script.
Does anyone know of an approach where I could over-ride settings in an ISO image, so that I could enable ssh?
The json configuration I have at the moment is as follows:
{
"builders": [{
"disk_size": 10140,
"guest_os_type": "Debian",
"headless": true,
"http_directory": "http",
"iso_checksum": "29c24b21e5a46c6290d980681a7bd1fbc4974111e8ff2730ba8c1f2f53a22a59",
"iso_checksum_type": "sha256",
"iso_url": "http://downloads.raspberrypi.org/pixel_x86/images/pixel_x86-2016-12-13/2016-12-13-pixel-x86-jessie.iso",
"shutdown_command": "echo 'halt -p' > shutdown.sh; echo 'vagrant'|sudo -S sh 'shutdown.sh'",
"ssh_password": "raspberry",
"ssh_port": 22,
"ssh_username": "pi",
"ssh_wait_timeout": "10000s",
"type": "virtualbox-iso",
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--memory", "512"],
[ "modifyvm", "{{.Name}}", "--cpus", "2"]
],
"boot_command": [ ]
}],
"post-processors": [
"vagrant"
],
"provisioners": [{
"type": "shell",
"execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
"scripts": [
"scripts/base.sh",
"scripts/vagrant.sh",
"scripts/virtualbox.sh"
]
}]
}
There are 3 different ways to enable ssh on the raspbian images. Specifically for headless images:
For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for the 'ssh' file. If it is found, SSH is enabled, and the file is deleted. The content of the file does not matter: it could contain text, or nothing at all.
Here's the docs on how Raspbian handles ssh now: https://www.raspberrypi.org/documentation/remote-access/ssh/
You might be able to use floppy_files
in your Packer settings to place the ssh
file in the root directory along with the image. See https://www.packer.io/docs/builders/virtualbox-iso.html#floppy_files
Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.