Error while port forwarding to remote host

Trying to communicate with a remote device via the mender device through port forwarding.

This is the command I use to start port forwarding:

sudo mender-cli port-forward <DEVICE_ID> 80:192.168.0.111:80

With the first request, I get this error on the client side:

Handling connection from 127.0.0.1:40920 to 127.0.0.1:80
FAILURE: Unable to start the port-forwarding: ��err�unknown connection�msgtype�ack

On the mender device, mender-connect logs the following:

Jan 21 11:33:18 linux mender-connect[5455]: time="2022-01-21T11:33:18-05:00" level=error msg="portForwardHandler(unknown connection
github.com/mendersoftware/mender-connect/session.init
    /github.com/mendersoftware/mender-connect/session/portforward.go:40
runtime.doInit
    /usr/local/go/src/runtime/proc.go:5420
runtime.doInit
    /usr/local/go/src/runtime/proc.go:5415
runtime.doInit
    /usr/local/go/src/runtime/proc.go:5415
runtime.doInit
    /usr/local/go/src/runtime/proc.go:5415
runtime.main
    /usr/local/go/src/runtime/proc.go:190
runtime.goexit
    /usr/local/go/src/runtime/asm_arm64.s:1148)"

So I am wondering

  • what the error messasge unknown connection means

  • where I can find more information about what is wrong

  • if anybody has an idea about what might be going on.

Thanks for your help!

Maybe @merlin or @tranchitella have an idea about this one?

hello @francoislefebvre

merci for using Mender.
it is nice to meet you.
the error you see in mender-connect is not a regular error – it looks really bad.
I need to know more:

  • is it hosted.mender.io ?
  • what version of the mender-cli is it?
  • if it is your own installation I need to know the version you are running, and all the details of the installation you can provide

best regards,
peter

Hello. Sorry for delay.

Here is a little more information. Tell me if you need more.

  1. Yes, it is on hosted.mender.io

  2. mender-cli version 1.7.0

  3. Mender installed on device using apt repository directions

# apt show mender-client

Package: mender-client
Version: 3.2.0-1
Priority: optional
Section: admin
Maintainer: Mender Team <mender@northern.tech>
Installed-Size: 7,567 kB
Depends: libc6 (>= 2.12), libglib2.0-0 (>= 2.50), liblzma5 (>= 5.1), libssl1.1 (>= 1.1), libffi6 (>= 3.2)
Conflicts: mender
Download-Size: 2,081 kB
APT-Manual-Installed: yes
APT-Sources: https://downloads.mender.io/repos/debian stable/main arm64 Packages
Description: Mender client
 Mender is an open source over-the-air (OTA) software updater for embedded Linux devices.

Mender connect

# apt show mender-connect
Package: mender-connect
Version: 2.0.0-1
Priority: optional
Section: admin
Maintainer: Mender Team <mender@northern.tech>
Installed-Size: 6,351 kB
Depends: libc6 (>= 2.12), libglib2.0-0 (>= 2.50), mender-client (>= 3.1.99)
Download-Size: 1,757 kB
APT-Manual-Installed: yes
APT-Sources: https://downloads.mender.io/repos/debian stable/main arm64 Packages
Description: Mender Connect
Mender Connect is a Mender add-on which enhances the Mender Client providing a bidirectional
communication channel with the server. It supports the following troubleshooting features:
- Interactive shell terminal sessions
- File Transfer
- Port forward

Device extra info

# uname -a
Linux linux 4.9.253-tegra #1 SMP PREEMPT Mon Jul 26 12:19:28 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux

ok thank you. I have installed exactly the same binaries and versions, and I cant reproduce it:

./mender-cli port-forward my-id 80:192.168.0.111:80
Configuration file not found. Continuing.
Connecting to the device my-id...
Forwarding from 127.0.0.1:80 -> 192.168.0.111:80

if you restart mender-connect, it happens immediately? does it happen every time? sorry for stupid questions, atm I have no idea.
what is the network topology there? are there any devices present between your device and hosted.mender.io? are there any proxies? firewalls?

pg

It happens with a specific device. Its a security camera. I can port forward on port 554 the rtsp feed (only for a test) but the problem occurs with web interface of the camera provided on port 80.

Its probably the camera. Seems like it closes the connection at some point, before responses completes. Logging on the camera is very limited, so it is not possible to know exactly what is going on.

Anyway, thanks for your help.

ok thanks. let me know if I can be of any use.

best regards,
peter