rpi-imager icon indicating copy to clipboard operation
rpi-imager copied to clipboard

Incorrect `imagerOsArch` detection in telemetry

Open Botspot opened this issue 2 years ago • 1 comments

I'm a Raspberry Pi power-user and I use RPi Imager often. For unrelated reasons, I was running rpi-imager in a terminal and noticed that the telemetry payload contained incorrect information.

Part of the payload being sent was "&imagerOsArch=arm64", but I am actually running Raspberry Pi OS armhf.

Turns out QSysInfo::currentCpuArchitecture() on line 26 of downloadstatstelemetry.cpp is merely getting the system's kernel architecture. This method is inaccurate and is incorrect if the arm64 kernel is enabled by placing arm_64bit=1 in /boot/config.txt.

I know for a fact that many people use arm_64bit=1 on Raspberry Pi OS 32-bit, for various reasons. Imager will report an arm64 OS, when in reality it is armhf. To avoid skewing telemetry results, I suggest fixing this problem and using one of the methods outlined below:

getconf -a | grep LONG_BIT #Correctly returns `32' on my system
#determine what architecture /sbin/init is written in
if [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 02' ];then
  echo 64
elif [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 01' ];then
   echo 32
fi

Botspot avatar Apr 30 '22 19:04 Botspot