LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SystemD Service - Python Script Problem (Network Manager) (https://www.linuxquestions.org/questions/linux-newbie-8/systemd-service-python-script-problem-network-manager-4175733393/)

Gronjus 01-31-2024 01:32 PM

SystemD Service - Python Script Problem (Network Manager)
 
Hello everyone,

I am an embedeed Electronics Engineer and since 2 two months, I started to develop on a Debian Distro for a client.

I am actually developing a project which have a part that handles a MODEM4G & the os Connectivity. The modem is managed by AT Commands and the os connectivity mainly with ping and curl command.

The python script is working fine so far and have tested it for like 2 weeks now. I am happy with it but now, I am in the script automation phase.

I have tried to launch my script at boot with systemd and with the old school method (init.d). Both launched the script correctly but I am getting problem with the ouput of my ping and curl command.

Once the modem have been setted up with AT Commands, I am using a "nmcli device connect" command from the NetworkManager Package to get an ip from the network and can then interact with the network command as ping and curl.

When launched as systemd service or with the help of init.d, the output of the command are failing. I can not ping the host and the curl result is "000".

Still, when looking at Network Manager status, there is a valid ip,dns,route and even outside the script, using ping and curl command have the same failing behaviour.

Looking for solutions, I have found that Network Manager is using DBUS Session for the service to work and it seems complex to implement that kind of package with script started at boot.

I am bit stuck and I am wondering if anyone has suggestions for troubleshooting deeper ?

I have already set up Network Manager logging as debug but nothing relevant.

Thanks a lot for your help !

Antoine

___ 02-12-2024 06:35 PM

Big welcome to LQ! (Sorry it's been a couple weeks; great project: hope you return.)

I'm far from expert, but to clarify your mysterious situation, post like this:
Code:

$ ip r
default via 192.168.1.254 dev eth0  src 192.168.1.158  metric 1002
127.0.0.0/8 dev lo scope link
192.168.1.0/24 dev eth0 scope link  src 192.168.1.158  metric 1002

$ ping -c2 1.1.1.1
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: seq=0 ttl=56 time=26.870 ms
64 bytes from 1.1.1.1: seq=1 ttl=56 time=30.117 ms
--- 1.1.1.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 26.870/28.493/30.117 ms

I probably don't have the knowledge to understand your sophisticated setup,
but, as a loose analogy, telling a car mechanic that:
Quote:

My new fancy engine is ok
But "nothing works"
may not get a response!


All times are GMT -5. The time now is 05:29 AM.