-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packer fails to build Vagrant box for Ubuntu 20.04 #9115
Comments
Right, we need packer template for cloud-init config.
|
One problem I have is that grub now automatically boots the live system after a few seconds and before packer starts typing the |
|
@JulyIghor Thanks for the link to the legacy installer. This can be used as a substitute for now, but Ubuntu has been using subiquity since Ubuntu 18.04 as the official installer and with 20.04 dropped support for d-i. |
On top of that, the new installer runs its own ssh server during installation which packer picks up on in error. |
Actually with cloud-init we can do everything without SSH server at all. I have managed to use this #9115 (comment) and get #cloud-config applied. But it does not work in UEFI mode. |
@JulyIghor how did you achieve to get to the grub command line? For me Grub always boots up ubuntu before packer starts typing, so unless I manually intervene the boot command isn't sent to the VM before it is too late. I'm unfortunately also not sure how to proceed. According to https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/QuickStart the boot_command you provided should already be sufficient to install the ubuntu system, assuming the cloud-config contains all information necessary for an autoinstall. |
You actually just need to be quick enough to stop the ISO's grub boot loader from starting the installer and instead type the boot command. |
I was able to do it only when UEFI disabled in VM bios. And this is not we need. |
FYI - this is the work from @nickcharlton with a working cloud-init configuration template for 20.04:
|
On this problem specifically, @rubenst2013, a potential solution is to use In practice with my experiments, I'd been seeing random build failures because of it. |
HTTP url is correct? or it should be http://{{.HTTPIP}}:{{.HTTPPort}} ? |
on Parallels Desktop it does not work, ALT+F2 doing nothing, but 'E' does open editor where I can add command. |
Ah, nice catch @JulyIghor. It should indeed be: |
This boot command should work, but it doesn't
|
It did no requests to http server, and I got Language selection dialog |
I'm wondering if the existing value for the boot options is what's causing this (unless you're entering them differently from my one): I'm appending
|
|
@nickcharlton @JulyIghor We could schedule a workshop via discord or some other platform to figure this out and then post the results here. what do you think? 💡 |
https://t.me/joinchat/CO-Y3hxWngKWrsmTUsPV7Q - the chat history lost, sorry |
The new Ubuntu Server installer starts an SSH server. The credentials are installer:<random_pw> Packer wrongfully tries to connect to this SSH, thinking the VM is ready for further provisioning steps - which it is NOT. Thanks to @JulyIghor we found a workaround. We simply change the port packer expects the ssh server to run at to something else AND during cloud-init late_commands we override the servers port accordingly. That way once the cloud-init finishes and reboots the VM the ssh server will run at the new port - now packer picks up on that and continues provisiong as we are used to. As a last step durng provision, we remove the conf file, essentially resettign the ssh server port back to default 22. @SwampDragons: hashicorp/packer#9115 Please check on the logic behind communicator setting "pause_before_connecting". That setting actually does still try to connect ONCE and then waits, instead of waiting for the specified duration and then and only then trying to connect. Thanks!
Here is working grub command line
|
Hi @JulyIghor, |
This example is about grub config. I'm talking about grub command line. |
OK. Will do. Anyways, thanks a lot for your constant support. |
Before I post, I just need some inputs from you. I was following the link. As per this link, I created an http directory with an empty meta-data file and another user-data file. The user-data file has a section for installing ssh server. Am I doing something wrong with this? I am pasting my user-data content below.
As you mentioned, during the packer build, after it generated the IP, I tried connecting to it using PuTTY, but got access denied when I tried connecting using myUser. Can you please check this once and let me know if I am doing something wrong or missing something? |
@vesubramanian I have had better success by creating a floppy disk with the |
@jhawk28 If you don't mind, can you please share your JSON and the user-data files? |
@vesubramanian Here is an example that has the has the floppy files from earlier in the discussion: https://gist.github.com/DVAlexHiggs/03cdbef887736f03dcfe6d1749c18669 Ubuntu 20.04+ is hard because it often has runtime issues. I have run into cloud-init misconfigurations, installer bugs, network issues, and timing issues. If the cloud-init has syntax errors, it will not be read. If the VM is not able to get an IP, the cloud-init will not be read. A timing issue will not read the file either (if packer waits too long to send in the commands) The usual symptom is that the installer just goes to the manual config screen. If there is an installer bug or or a misconfiguration in the cloud-init, you will see an error in the install logs. You can view them on the VM by switching to a different TTY. |
@jhawk28 Thank you for sharing. I have a couple of questions.
|
NOTE: Ubuntu's documentation on automating server installs may be useful: https://ubuntu.com/server/docs/install/autoinstall |
Also, I managed to do some more troubleshooting. I was watching the console (earlier, I didn't know how to get to the console from the datastore in vSphere, now I figured out, since I am very new to it). It waits at one point asking whether to continue with auto install or not. Although the boot command has auto install mentioned, it doesn't seem to pick it up. So, I typed yes in the console and it proceeded (not sure why manual intervention was required). Then it continued and stopped at a point with the following error "command systemd-cat returned non-zero exit status 3". I couldn't capture the whole error, since I am not sure how to do it. Also, it said the details can be found at /var/crash/some-long-file-name. I am not sure how to export it. Will this be of any help? I don't have much knowledge on Linux. Hence, please excuse me for being naive. |
you can switch to a different TTY using CTRL+ALT+F2 to get a command prompt to view the logs. (https://ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/) CTRL+ALT+F1 to get back to the first one. |
You are going to need a very short "boot_wait" (3-5 seconds) in order for the auto install to initialized by the boot command correctly. |
@dbond007 I have opened an issue and tagged you, as suggested by you. FYI, the issue link is https://github.com/hashicorp/packer-plugin-vsphere/issues/106 |
i've found that the first line of the |
@vesubramanian : Did you manage to fix the problem? I am also stuck at 'waiting for ssh to become available' |
Someone might find this helpful. Ubuntu 20.04 config in HCL format: AWS: |
FYI I've had good luck with ubuntu 22.04 and 22.10 using a short fixed wait at end of boot_command = [
"<esc><esc>c",
"linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall",
"<enter>",
"initrd /casper/initrd",
"<enter>",
"boot",
"<enter>",
"<wait4m>"
] plus increasing The wait delays the initial packer SSH connection attempts. |
@alexellis Did you solve it please? I have the same problem, which has been bothering me for a long time |
Sorry. I did not solve it.
…On Thu, Oct 27, 2022, 2:28 PM yanhuan ***@***.***> wrote:
Otherwise it just hangs with Nick's example here:
[image: Screenshot 2020-06-24 at 13 08 48]
<https://user-images.githubusercontent.com/6358735/85553464-e0cb1800-b61b-11ea-962c-dfe75a87234f.png>
Did you solve it please? I have the same problem, which has been bothering
me for a long time
—
Reply to this email directly, view it on GitHub
<#9115 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4XRW65WDUVQ5IA24TFWHTWFJYNPANCNFSM4MQLBX4A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I've been having the best (and most) consistent results by disabling SSH early in the build, and I've not needed to change anything for a long time since that change (I run something very similar on 22.04 too): nickcharlton/packer-ubuntu-2004@69a0e27 It's unfortunate that so many have such difficulties with this, but hopefully this can help those still struggling! |
@nickcharlton SSH winds up being re-enabled so I've resorted to adding a fixed (minimal) wait period to the end of my boot command "" or "" depending on what release/arch I'm buidling... and then I bump up connection attempts before failure so the idea is to minimze false positive log messages that the SSH connection failed and then whatever delta of time variability in boot_command execution time exists > wait time is covered by the SSH connection attempts increase. #9115 (comment) @yanhuan0802 I think you have a different issue as the installer is stuck on picking a language, have you checked what your boot_command should be doing versus what actually happens when the machine boots up initially? Of course the SSH connection will fail given the boot_command failed. |
@g0t4 I have solved the problem. Thank you for your reply. |
How? |
The following firmware = "/usr/share/ovmf/OVMF.fd"
boot_command = [
"c<wait>",
"set gfxpayload=keep<enter>",
"linux /casper/vmlinuz ",
"\"net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/http/${var.config_file}/ \" ",
"quiet autoinstall ---<enter>",
"initrd /casper/initrd<enter>",
"boot<enter>"
]
boot_wait = "5s" |
@g0t4 I have de same problem, the installer is stuck on picking a language. I need help. My json is. { |
Hi Gang, I am not really sure where to put this, but here seems great. All over the internet are complaints of:
The only solution I have found to this is to set The default is If anyone has suggestions on how to view the boot screen, that would be super! Here is my current approach, which is SUPER SLOW:
This creates an Thanks |
I have the same problem using Ubuntu 22.04 or 20.04
On the folder http I have two files:
I am getting this error:
|
There is so much I have completed a very well-documented and described implementation, from first principles here: Thank you, |
A problem with the |
Feature Description
Ubuntu has switched its installer from the debian installer to subiquity. Starting with 20.04 no more alternate images will be provided: https://discourse.ubuntu.com/t/server-installer-plans-for-20-04-lts/13631
This breaks unattended packer builds (vmware-iso, virtualbox-iso, hyperv-iso) for Ubuntu. Starting with 20.04 no alternate images seem to be available that could be used until recently to build vagrant boxes with packer.
Use Case(s)
If unattended installations for ubuntu will be supported in the future, subiquity has to be used instead of d-i.
The text was updated successfully, but these errors were encountered: