Skip to content

f-stack tools add root user check #829

Description

@typochecker

I am accustomed to using sudo instead of directly using the root user. When I forget to add the sudo prefix, the program only outputs an error message with a reason that is hard to guess.

aaa@aaaubuntu:~/speedtest$ /data/f-stack/tools/sbin/ifconfig
EAL: Cannot open '/run/user/1000/dpdk/rte/config' for rte_mem_config
EAL: FATAL: Cannot init config
EAL: Cannot init config
EAL: Error - exiting with code: 1
Cause: Error with EAL initialization

Activity

  1. jfb8856606 commented on Mar 18, 2026

    @jfb8856606
    Contributor

    This is a known DPDK behavior: when running as a non-root user, DPDK uses a per-user runtime directory (/run/user/<uid>/dpdk/) instead of the system-wide /var/run/dpdk/. Since the F-Stack primary process is typically started as root, the shared memory config ends up in /var/run/dpdk/rte/config, and a non-root secondary process looks in the wrong place — causing the Cannot open rte_mem_config error.

    The root cause is straightforward: F-Stack applications and their tools must all be run as root (or the same user that started the primary process) so they share the same DPDK runtime directory.

    Suggestion for improvement: It would be helpful if the tools printed a clearer error message when they detect they are not running as root, e.g.:

    Error: F-Stack tools require root privileges. Please run with sudo or as root.
    

    A simple check at the start of ff_ipc_init() or in each tool's main():

    if (getuid() != 0) {
        fprintf(stderr, "Error: F-Stack tools must be run as root.
    ");
        exit(1);
    }

    This would save users from debugging cryptic DPDK EAL errors. Pull requests for this improvement are welcome.

  2. jfb8856606 commented on Mar 18, 2026

    @jfb8856606
    Contributor

    A fix has been submitted in PR #1049. The root privilege check is added at the start of ff_ipc_init() in tools/compat/ff_ipc.c, so non-root users will now see a clear error message instead of the cryptic DPDK EAL failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions