Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code/Server/Server.py get_interface_ip() fails on RasPi 4 with Raspberry Pi OS Bookworm #30

Open
emendir opened this issue Nov 10, 2023 · 8 comments

Comments

@emendir
Copy link

emendir commented Nov 10, 2023

When running the server code with the following commands

cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server
sudo python main.py

I get the following error:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Traceback (most recent call last):
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/main.py", line 85, in <module>
    myshow=MyWindow()
           ^^^^^^^^^^
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/main.py", line 23, in __init__
    self.on_and_off_server()
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/main.py", line 50, in on_and_off_server
    self.server.turn_on_server()
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/Server.py", line 50, in turn_on_server
    HOST=self.get_interface_ip()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/Server.py", line 44, in get_interface_ip
    return socket.inet_ntoa(fcntl.ioctl(s.fileno(),
                            ^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 99] Cannot assign requested address

OS info:
Linux raspberrypi 6.1.0-rpi6-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.58-1+rpt2 (2023-10-27) aarch64 GNU/Linux

The system has an IP network connection while producing this error.

Any ideas as to the cause of and solution to this problem?

@Shaynee-MO
Copy link
Member

The system has an IP network connection while producing this error.
Would you mind sending us a screenshot of the IP network connection?

@emendir
Copy link
Author

emendir commented Nov 13, 2023

I'm using the raspberry pi's ethernet port. (eth0)
Here's the network connection config as displayed by the ip addr command, with sensitive digits blanked out with X:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    inet 192.168.XX.XX/24 brd 192.168.XX.255 scope global dynamic noprefixroute eth0
       valid_lft 259098sec preferred_lft 259098sec
    inet6 fe80::XXXX:XXXX:XXXX:XXXX/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
   link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff

@Shaynee-MO
Copy link
Member

Here is an image of our raspberry pi OS, you can download and write it to your Raspberry Pi and try again.
https://drive.google.com/file/d/1wbHLgsfKt4HgR8Ck9yGjvVc2Tvtvsyqj/view?usp=drive_link

@emendir
Copy link
Author

emendir commented Nov 17, 2023

I have managed to narrow down the issue a little further. This error only occurs when using wired-LAN using the RasPi's ethernet port instead of wireless LAN.

Workaround:

Connect to wireless LAN instead of wired-LAN.

Having found this workaround, the problem is still not solved.

I expect we can call it a software bug, that using wired-LAN causes this error?
Or is this a limitation of the network architecture between client and server?

In the latter case, it would be useful to provide the user with a helpful message instructing them to connect to a wireless LAN instead of this relatively useless error-message.

@Shaynee-MO
Copy link
Member

Hi! Many thanks for the input. We will make it clear in our tutorial. We are sorry for any inconvenience it may cause.

@developervova
Copy link

Hi! Where can I see this explanation?

@jaywalker68
Copy link

jaywalker68 commented Jan 5, 2025

Hi, I'm having the same issue when I run sudo python camera.py. I'm using a raspberry pi 5, connected to it via wifi and using RealVNC on Windows 11. When I run env | grep XDG I see XDG_RUNTIME_DIR=/run/user/1000.

[0:32:17.433523222] [2937] INFO Camera camera_manager.cpp:325 libcamera v0.3.2+99-1230f78d
[0:32:17.441506811] [2940] INFO RPI pisp.cpp:695 libpisp version v1.0.7 28196ed6edcf 29-08-2024 (16:33:32)
[0:32:17.452433417] [2940] INFO RPI pisp.cpp:1154 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/ov5647@36 to CFE device /dev/media0 and ISP device /dev/media2 using PiSP variant BCM2712_C0
[0:32:17.456965803] [2937] INFO Camera camera.cpp:1197 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-GBRG_PISP_COMP1
[0:32:17.457175933] [2940] INFO RPI pisp.cpp:1450 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected CFE format: 640x480-PC1g
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
[0:32:21.004321378] [2944] INFO Camera camera.cpp:1197 configuring streams: (0) 2592x1944-BGR888 (1) 2592x1944-GBRG_PISP_COMP1
[0:32:21.007719210] [2940] INFO RPI pisp.cpp:1450 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/ov5647@36 - Selected sensor format: 2592x1944-SGBRG10_1X10 - Selected CFE format: 2592x1944-PC1g
[0:32:21.380299090] [2944] INFO Camera camera.cpp:1197 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-GBRG_PISP_COMP1
[0:32:21.384028255] [2940] INFO RPI pisp.cpp:1450 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected CFE format: 640x480-PC1g
leroy@reliance1:~/Downloads/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi-master/Code/Server $ env | grep XDG
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_MENU_PREFIX=lxde-pi-
XDG_SEAT=seat0
XDG_SESSION_DESKTOP=LXDE-pi-labwc
XDG_SESSION_TYPE=wayland
XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/leroy
XDG_CURRENT_DESKTOP=labwc:wlroots
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_VTNR=7
XDG_SESSION_ID=1
XDG_RUNTIME_DIR=/run/user/1000
XDG_DATA_DIRS=/usr/local/share:/usr/share/raspi-ui-overrides:/usr/share:/usr/share/gdm:/var/lib/menu-xdg:/usr/local/share:/usr/share:/var/lib/snapd/desktop
ORIGINAL_XDG_CURRENT_DESKTOP=labwc:wlroots

@techapplez
Copy link

techapplez commented Jan 5, 2025

When running the server code with the following commands

cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server
sudo python main.py

I get the following error:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Traceback (most recent call last):
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/main.py", line 85, in <module>
    myshow=MyWindow()
           ^^^^^^^^^^
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/main.py", line 23, in __init__
    self.on_and_off_server()
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/main.py", line 50, in on_and_off_server
    self.server.turn_on_server()
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/Server.py", line 50, in turn_on_server
    HOST=self.get_interface_ip()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hex/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server/Server.py", line 44, in get_interface_ip
    return socket.inet_ntoa(fcntl.ioctl(s.fileno(),
                            ^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 99] Cannot assign requested address

OS info: Linux raspberrypi 6.1.0-rpi6-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.58-1+rpt2 (2023-10-27) aarch64 GNU/Linux

The system has an IP network connection while producing this error.

Any ideas as to the cause of and solution to this problem?

I think i had the same error and you only have to run:

cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server
sudo python main.py -tn

this works if you use ssh and no vnc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants