1

I'm doing a POC on SDN using miniedit (UI of mininet) and ONOS as a SDN controller, I want to invoke ONOS from miniedit when we run the topology so used the following line of code in python

os.system("gnome-terminal -e 'bash -c \"/home/paxterra/onos/tools/dev/bin/onos-karaf; exec bash\"' &")

this invokes ONOS if i execute it as a normal user, but throws error since this code present in miniedit.py and I'm running miniedit.py as super user.

Error : /home/paxterra/onos/tools/dev/bin/onos-karaf: line 7: onos-setup-karaf: command not found

I tried to set environment variable PATH="/home/paxterra/onos/tools/dev/bin/" and then tried the command again, it gives the same error.

Can anyone please help me to solve this issue. ?

StephenKing
  • 36,187
  • 11
  • 83
  • 112
Nisha
  • 11
  • 1

1 Answers1

0

When using sudo, the path variable is not preserved by default. Sudo has its own path variable. This is a security design.

since onos-setup-karaf is not in the path (ie you use full path for onos-karaf but onos-setup-karaf is probably not in your working dir) you should try to execute sudo env "PATH=$PATH" miniedit or however you start that program but you need to preserve the path variable.

channon
  • 362
  • 3
  • 16