polycube-network / polycube

eBPF/XDP-based software framework for fast network services running in the Linux kernel.
Apache License 2.0
504 stars 102 forks source link

polycubed does not start with & #398

Closed pinoOgni closed 3 years ago

pinoOgni commented 3 years ago

Describe the bug

Polycubed does not start

To Reproduce

Steps to reproduce the behavior:

  1. Run polycube with sudo polycubed & for the first time in the system

Expected behavior

It should ask for the password and run Polycube normally

Please tell us about your environment:

  1. OS details: cat /etc/*-release
    
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=20.04
    DISTRIB_CODENAME=focal
    DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
    NAME="Ubuntu"
    VERSION="20.04.2 LTS (Focal Fossa)"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 20.04.2 LTS"
    VERSION_ID="20.04"
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    VERSION_CODENAME=focal
    UBUNTU_CODENAME=focal
2. Kernel details: `uname -a`

Linux giuseppe 5.4.0-81-generic #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

3. Polycube Version: `polycubectl version`

polycubectl: version: v0.9.0+ [git: (branch/commit): master/7ca18708-dirty]


4. Polycube Log: Attach the log from `/var/log/polycube/polycubed.log`

## Additional context

With @frisso we have seen that launching Polycube the first time with `sudo polycubed &`, a process is created but it does not even ask for the password so in practice polycubed does not start. If you kill the process and give the same command again, you are asked for the password and everything seems to work.

In addition, running it with `sudo systemctl start polycubed` or `sudo polycubed` works normally. So the problem seems to be related to the fact that you want to run polycubed in the background but the problem **only** occurs the first time.

Has anyone ever had a similar problem?

@frisso I hope I have not forgotten something
frisso commented 3 years ago

@pinoOgni When you start "sudo polycubed &" for the first time, the process is started in the background, but then it is stopped because "sudo" is asking you for the root password. So, you're stuck there, with a background process that requires you to type the password. In fact, if you type "fg" and bring again everything in foreground, you are asked for the password and everything works. So, I would close this issue and suggest not to use the "&" to run polycubed in background, but use the proper flag that starts the software in daemon mode (polycubed -d).