bsdinstall script fails when run from Packer

Hi everyone,

I'm trying to use Packer to build an AWS AMI of FreeBSD 13.2 with the root filesystem on an ZFS mirror.

I've tried using both a bsdinstall script and a shell script which invokes the individual bsdinstall commands in sequence. In both cases, the Packer shell provisioner detects an error during bsdinstall distextract and aborts the build.

However, if I log into the running source instance over ssh and run the bsdinstall script or the shell script manually, everything works as expected.

I suspect there might an odd interaction between dialog and the Packer shell provisioner, or perhaps something odd in the ssh session that Packer uses, but I don't know where to start looking for further clues...

Any ideas?

Is there an option to turn off the use of dialog somehow?

With thanks,

Jarvis
 
Can you share your bsinstall script ? I deploy VM on my esxi with packer and have no problem.
Code:
export BSDINSTALL_DISTSITE='https://download.freebsd.org/ftp/releases/arm64/13.2-RELEASE/'                                                                              
export ZFSBOOT_VDEV_TYPE=mirror                                                  
export ZFSBOOT_DISKS="nda1 nda2"                                                  
export ZFSBOOT_SWAP_SIZE="1G"                                                    
export nonInteractive="YES"                                                      
                                                                                 
DISTRIBUTIONS='kernel.txz base.txz'                                              
                                                                                 
#!/bin/sh                                                                        
freebsd-update --not-running-from-cron fetch                                      
freebsd-update --not-running-from-cron install                                    
                                                                                 
pkg install --yes ec2-scripts ebsnvme-id                                          
                                                                                 
sysrc ec2_configinit_enable=YES                                                  
sysrc ec2_fetchkey_enable=YES                                                    
sysrc ec2_loghostkey_enable=YES                                                  
sysrc ntpd_enable=YES                                                            
sysrc dev_aws_disk_enable=YES                                                    
sysrc growfs_enable="YES"                                                        
sysrc ifconfig_DEFAULT="SYNCDHCP accept_rtadv"                                    
sysrc sshd_enable="YES"                                                          
sysrc ipv6_activate_all_interfaces="YES"                                          
sysrc rtsold_enable="YES"                                                        
sysrc rtsold_flags="-M /usr/local/libexec/rtsold-M -a"                            
                                                                                 
touch /firstboot
 
Thanks for the help so far! I've found that adding ssh_pty = true to the Packer build configuration seems to allow bsdinstall to get further...
 
Back
Top