util.CommandError: Command ['/usr/bin/python3', 'ns3', 'configure'] exited with code 1

1,802 views
Skip to first unread message

Halefom Kahsay

unread,
Jun 14, 2022, 8:13:14 AM6/14/22
to ns-3-...@googlegroups.com
Hey,
 After executing 
>> sudo ./build.py
I got The following  error:-
[sudo] password for user:
# Build NetAnim
Entering directory `netanim-3.108'
 =>  qmake -v
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
qmake found
 =>  qmake NetAnim.pro
 =>  make
make: Nothing to be done for 'first'.
Leaving directory `netanim-3.108'
# Build NS-3
Entering directory `./ns-3.36'
 =>  /usr/bin/python3 ns3 configure
Traceback (most recent call last):
  File "ns3", line 1336, in <module>
    main()
  File "ns3", line 1131, in main
    refuse_run_as_root()
  File "ns3", line 1124, in refuse_run_as_root
    raise Exception("Refusing to run as root. --enable-sudo will request your password when needed")
Exception: Refusing to run as root. --enable-sudo will request your password when needed
Traceback (most recent call last):
  File "./build.py", line 155, in <module>
    sys.exit(main(sys.argv))
  File "./build.py", line 146, in main
    build_ns3(config, build_examples, build_tests, args, build_options)
  File "./build.py", line 65, in build_ns3
    run_command(cmd) # ns3 configure ...
  File "/home/user/ns3.36/ns-allinone-3.36/util.py", line 25, in run_command
    raise CommandError("Command %r exited with code %i" % (argv, retval))
util.CommandError: Command ['/usr/bin/python3', 'ns3', 'configure'] exited with code 1

I could not figure out the problem.

Thank you for your help.

Gabriel Ferreira

unread,
Jun 14, 2022, 1:26:31 PM6/14/22
to ns-3-users
Exception: Refusing to run as root. --enable-sudo will request your password when needed

Do you have a legitimate reason to run build.py as root? 
If you don't, then drop the sudo and it will continue. 
If you do, we can change the ns3 script to accommodate your use case.

Akimun Jannat Alvina

unread,
Aug 1, 2022, 2:10:30 PM8/1/22
to ns-3-users
Hi,

I wanted to install nr module with ns-3-dev (ns-3.36 release). I got the following error while configuring:

./ns3 configure --enable-examples --enable-tests 

Traceback (most recent call last):
  File "./ns3", line 1336, in <module>
    main()
  File "./ns3", line 1241, in main
    configuration_step(current_cmake_cache_folder,
  File "./ns3", line 872, in configuration_step
    configure_cmake(cmake,
  File "./ns3", line 495, in configure_cmake
    os.makedirs(current_cmake_cache_folder, exist_ok=True)
  File "/usr/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/alvina/ns-3-dev/ns-3-dev/cmake-cache'
Finished executing the following commands:
mkdir cmake-cache

Any suggestions on that?

Thanks in advance,
Alvina

Gabriel Ferreira

unread,
Aug 1, 2022, 2:57:05 PM8/1/22
to ns-3-users
First run 
ls -l

It should show something like this (first 'gabriel' is the user who owns the directory and the second is the usergroup of that user)
drwxrwxrwx 1 gabriel gabriel     4096 jul 31 17:16 cmake-cache

If you don't have the ownership of the directory, try chown'ing it and all files on it (I'm doing it with my username and usergroup)
sudo chmod gabriel:gabriel -R ./cmake-cache

You can find your username and usergroup with the following
id -nu
id -ng 

To control read/write/execute permissions, you can use chmod.

If you have a GUI, you can do the same in the permissons manager for it.
On ubuntu, it looks something like this.

Screenshot from 2022-08-01 15-51-39.png

Tom Henderson

unread,
Aug 1, 2022, 2:57:43 PM8/1/22
to ns-3-...@googlegroups.com
On 8/1/22 11:10, Akimun Jannat Alvina wrote:
> Hi,
>
> I wanted to install nr module with ns-3-dev (ns-3.36 release). I got the
> following error while configuring:
>
> ./ns3 configure --enable-examples --enable-tests
> Traceback (most recent call last):
>   File "./ns3", line 1336, in <module>
>     main()
>   File "./ns3", line 1241, in main
>     configuration_step(current_cmake_cache_folder,
>   File "./ns3", line 872, in configuration_step
>     configure_cmake(cmake,
>   File "./ns3", line 495, in configure_cmake
>     os.makedirs(current_cmake_cache_folder, exist_ok=True)
>   File "/usr/lib/python3.8/os.py", line 223, in makedirs
>     mkdir(name, mode)
> PermissionError: [Errno 13] Permission denied:
> '/home/alvina/ns-3-dev/ns-3-dev/cmake-cache'
> Finished executing the following commands:
> mkdir cmake-cache
>

Check the permissions of the directory or the contents of cmake-cache;
are they possibly owned by root user?

If in doubt, run './ns3 clean' and start over, and if you do not have
permissions for that, run 'sudo ./ns3 clean'.

- Tom
Reply all
Reply to author
Forward
0 new messages