Unhandled exception: Value must be positive and below the buffer width

OS Name/Version:
Ubuntu 22.04.3 LTS

Product Name/Version:
[Info] AMP Instance Manager v2.4.7 built 09/01/2024 03:41
[Info] Stream: Mainline / Release - built by CUBECODERS/buildbot on CCL-DEV

Problem Description:
I wrote a cloud-init script (see below) to automate the installation process. Unfortunately, I get an error when setting up the VM with cloud-init. The snipped below shows the cloud-init logs at the critical point.
Interestingly: If I execute the exp file (written by cloud-init) manually, everything works fine.
So I am also suspicious of cloud-init itself in regards to that, but since I am no expert - could you maybe advise on how this could possibly be fixed?
(I was also thinking about making a separate runcmd command for installing the instance after the failure, but then I will miss out on the nginx installation/configuration and it just would not be clean.)

cloud-init.log
ESC[39;49mESC[?1lESC>ESC[39;49mCreating default instance...
[Info] AMP Instance Manager v2.4.7 built 09/01/2024 03:41
ESC[?1hESC=ESC[6nESC[HESC[2JESC[39;49m[Info] Stream: Mainline / Release - built by CUBECODERS/buildbot on CCL-DEV
ESC[39;49mESC[34m[Notice] AMP Service port ranges have not been specified, using any available...
ESC[39;49mESC[34m[Notice] Application Service port ranges have not been specified, using any available...
ESC[39;49mCan't find custom attr constructor image: /opt/cubecoders/amp/plugins/ADSModule.dll mtoken: 0x0a00001e due to: Could not load file or assembly 'SQLite-net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
[Activity] Audit: Unknown/None [CreateInstance] Created instance ADS01 using ADS module on port 8080.
ESC[39;49m[Info] Downloading AMP from https://downloads.cubecoders.com/AMP/Mainline/20240109.1/AMP_x86_64.zip...
ESC[39;49m
Unhandled Exception:
System.ArgumentOutOfRangeException: Value must be positive and below the buffer width.
Parameter name: left
  at System.TermInfoDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00021] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.TermInfoDriver.set_CursorLeft (System.Int32 value) [0x00016] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.ConsoleDriver.set_CursorLeft (System.Int32 value) [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Console.set_CursorLeft (System.Int32 value) [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at InstanceManagerPlugin.LocalInstanceManager+<>c__DisplayClass241_0.<WriteDownloadProgress>g__ShowDownloadProgress|0 (System.Object sender, System.EventArgs e) [0x00010] in <f3bb5c10ecad4321bc58366d1041e4e1>:0
  at ModuleShared.RunningTask.set_ProgressPercent (System.Int32 value) [0x00023] in <5bfcd237691948d59b3830019d0b4234>:0
  at ModuleShared.Utilities+<>c__DisplayClass18_0.<DownloadFileWithProgressAsync>g__DownloadProgressChanged|0 (System.Object sender, System.Net.DownloadProgressChangedEventArgs e) [0x00091] in <5bfcd237691948d59b3830019d0b4234>:0
  at System.Net.WebClient.OnDownloadProgressChanged (System.Net.DownloadProgressChangedEventArgs e) [0x0000a] in <f2109503c3e3478285aacd4ff1d0db97>:0
  at System.Net.WebClient.<StartAsyncOperation>b__78_9 (System.Object arg) [0x00000] in <f2109503c3e3478285aacd4ff1d0db97>:0
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Value must be positive and below the buffer width.
Parameter name: left
  at System.TermInfoDriver.SetCursorPosition (System.Int32 left, System.Int32 top) [0x00021] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.TermInfoDriver.set_CursorLeft (System.Int32 value) [0x00016] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.ConsoleDriver.set_CursorLeft (System.Int32 value) [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Console.set_CursorLeft (System.Int32 value) [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at InstanceManagerPlugin.LocalInstanceManager+<>c__DisplayClass241_0.<WriteDownloadProgress>g__ShowDownloadProgress|0 (System.Object sender, System.EventArgs e) [0x00010] in <f3bb5c10ecad4321bc58366d1041e4e1>:0
  at ModuleShared.RunningTask.set_ProgressPercent (System.Int32 value) [0x00023] in <5bfcd237691948d59b3830019d0b4234>:0
  at ModuleShared.Utilities+<>c__DisplayClass18_0.<DownloadFileWithProgressAsync>g__DownloadProgressChanged|0 (System.Object sender, System.Net.DownloadProgressChangedEventArgs e) [0x00091] in <5bfcd237691948d59b3830019d0b4234>:0
  at System.Net.WebClient.OnDownloadProgressChanged (System.Net.DownloadProgressChangedEventArgs e) [0x0000a] in <f2109503c3e3478285aacd4ff1d0db97>:0
  at System.Net.WebClient.<StartAsyncOperation>b__78_9 (System.Object arg) [0x00000] in <f2109503c3e3478285aacd4ff1d0db97>:0
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <84860023ab994fb899a1d6d68e96bfb8>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <84860023ab994fb899a1d6d68e96bfb8>:0
ESC[?1lESC>ESC[39;49mFailed to create default instance.
Removing generated nginx config...
Aborting...

Something went wrong during the installation. Would you like to upload your setup log for easy sharing?
This will upload /getamp-20240116-142928.log to the hastebin service and give you a URL you can share.

The log file may contain sensitive information such as username, any supplied domain names or your systems hostname
so if in doubt - check the file manually and upload it yourself.
[y/N]

(I can also deliver the getamp log file, but it exceeds the character limit for this ticket.)

Steps to reproduce:
create a similar VM with cloud-init - I used the following cloud-init script for reference

cloud-init-script
#cloud-config
packages:
  - vim
  - expect
write_files:
  - path: /root/install_amp.exp
    content: |
      #!/usr/bin/expect
      set NAME "username"
      set PW "password"
      spawn /root/install_amp.sh
      expect "Username \[admin\]: "
      send -- "$NAME\r"
      expect "Password: "
      send -- "$PW\r"
      expect "Confirm Password:"
      send -- "$PW\r"
      expect "\[y/N\] "
      send -- "N"
      sleep 1
      expect "\[Y/n\] "
      send -- "Y"
      sleep 1
      expect "\[Y/n\] "
      send -- "Y"
      sleep 1
      expect "\[y/N\] "
      send -- "y"
      expect "E.g. amp.mydomain.com"
      expect "Domain"
      sleep 2
      send -- "amp.domain.invalid\r"
      expect "Email: "
      send -- "mail.address@domain.invalid\r"
      expect "Ready to install AMP. Press ENTER to continue or CTRL+C to cancel.\r"
      send -- "\r"
      set timeout -1
      expect eof
    permissions: '0754'
  - path: /root/install_amp.sh
    content: |
      #!/bin/bash
      bash <(wget -qO- getamp.sh)
    permissions: '0754'
runcmd:
  - 'apt-get update'
  - 'apt-get upgrade -y'
  - '/root/install_amp.exp'

Actions taken to resolve so far:
nothing - I got it working manually, but I want to automate the installation process

KB Search :wink:

I have not even thought about that possibility… but makes sense…
Thank you for sharing! I will give it a try.

Edit: Works just fine.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.