PX4 Raspberry Pi communication issue

Hello everyone!
We are trying to connect to PX4 from a Raspberry Pi, using Mavros. the Pi is running Ubuntu, and not Raspbian.
We are able to ping the PX4 and get appropriate values for some of the commands. But, we are not able to switch modes.
Here’s a copy of the console message:

arm throttle
MANUAL> CAUTION:ARMED
LAND> Mode LAND
Arming checks disabled
APM: ARMED by arm/disarm component command
APM: Failsafe mode enabled
LAND> mode 0
LAND> Got MAVLink msg: COMMAND_ACK {command : 176, result : 0}

And also, sometimes we see messages like this:
LAND>
k;S=#?x::;[=F(?w|>^2:oM
LAND> modsY@/`/<UDe 0
LAND> Got MAVLink msg: COMMAND_ACK {command : 176, result : 0}
w?><=0Q$h=
LAND> E

Has anyone faced this issue before?

Please don’t double post.

Duplicate of PX4 RPi communication issue - Flight mode not changing