Skip to main content
Question

Error when running .\main.ps1 -resource 'KUBERNETES' in an Upgrade [Remote]

  • December 19, 2024
  • 2 replies
  • 116 views

Dilshan Aththanayake
Sidekick (Employee)
Forum|alt.badge.img+5

Hello Experts ;

 

  •  This is regarding creating the Middle Tier setup for IFS Cloud environment in a Remote customer Upgrade.

    - When running the command .\main.ps1 -resource 'KUBERNETES' to install IFS Cloud Middle Tier, getting the error as;

 

 

New-SFTPSession : Channel was closed.
At E:\UPGRADE\ifsroot\utils\common.psm1:48 char:24
+ ... OBAL:sftp = New-SFTPSession -ComputerName $NodeName -Credential $cred ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Renci.SshNet.SftpClient:SftpClient) [New-SFTPSession], SshException
+ FullyQualifiedErrorId : SSH.NewSftpSession

Exception Occurred While Opening Connection with the Linux Box.


 

  • These commands executed successfully.

    .\main.ps1 -resource 'INIT'
    .\main.ps1 -resource 'KEY'

 

  • Error occurs when running : .\main.ps1 -resource 'KUBERNETES'  command.

    - All these servers are remote customer servers

 

  • Could you please support to solve this issue.

 

BR!

/Dilshan

2 replies

binuriJ
Do Gooder (Employee)
Forum|alt.badge.img+3
  • Do Gooder (Employee)
  • 20 replies
  • February 3, 2025

Hi ​@Dilshan Aththanayake,

 

The issue might be of the following as it seems.


Authentication Issues:

If the $keyFilePath(c:\ifsremote\ifsroot\utils\common.psm1) is incorrect or not accessible, the New-SFTPSession command will fail. Make sure that the SSH private key is valid, the file path is correct, and the key has the appropriate permissions.(may be an issue with the extraction of necessary binaries/artifacts used to create the ifsroot directory)


Incorrect Credentials:

Ensure that the $cred(same common.psm1) object holds valid credentials (username and password) or that the key file matches the expected public key on the Linux box.


Network/Connectivity Issues:

Ensure the target machine ($NodeName) is accessible, and there's no firewall or network issue blocking SSH (port 22 by default) or SFTP.


SFTP Module:

Make sure the module providing New-SFTPSession is installed and available. It could be something like Posh-SSH.


File Path for SSH Key:

Ensure that the $keyFilePath is correct and points to an existing private key file. The key file should be in a format supported by SSH(I have seen that this typical key type can have issues with a latest update for Linux, that would  need to be updated for more secured types in 23R1.This is a workaround to be applied if this is a test env with the local.psm1 util file. But not sure this has an impact with the given issue)

 

Regards,

Binuri


Forum|alt.badge.img+7
  • Hero (Partner)
  • 21 replies
  • February 19, 2025

@Dilshan Aththanayake , Try the below steps.
 

  • Add this line in /etc/ssh/sshd_config :- PubkeyAcceptedAlgorithms +ssh-rsa
  • restart the sshd service afterwards and try the kubernetes command from the main.ps1 script.

    if you are trying to install an older version, try out the below steps.
  • Go to ifsroot\utils directory and backup the “local.psm1” file. 

  • Open the file and locate the function Add-KeybasedAuthWithLinuxBox

  • Find following line:- ssh-keygen -b 2048 -t rsa -f "$prvKeyFile" -q -N

  • Change it like below by adding -m PEM option.
    ssh-keygen -b 2048 -t rsa -m PEM -f "$prvKeyFile" -q -N
    (In newer versions the “-m PEM” parameter is included in the file)
  • Once the above change is completed, try the kubernetes command from the main.ps1 script

    Best regards,
    Herath

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings