Vivado path and license are lost when running with sudo
Description
When the program is run normally, Vivado works because the shell already has the required environment variables:
PATH=/opt/AMDDesignTools/Vivado/2023.2/bin:$PATH XILINXD_LICENSE_FILE=/home/aiko/Desktop/Xilinx.lic LM_LICENSE_FILE=/home/aiko/Desktop/Xilinx.lic
However, when the program is run with sudo, Ubuntu removes or replaces most environment variables. The program can still locate Vivado through --vivado-path, but Vivado cannot find the license file.
"ERROR: Vivado Design Suite cannot be launched because a valid license was not found." Error EXIT 1 or 43 and such
The program launches Vivado as a child process, so Vivado only receives the environment available to the program after sudo has filtered it.
The launch script should explicitly pass the Vivado path and license variables when running under sudo, for example:
sudo env
PATH="/opt/AMDDesignTools/Vivado/2023.2/bin:$PATH"
XILINXD_LICENSE_FILE="/home/aiko/Desktop/Xilinx.lic"
LM_LICENSE_FILE="/home/aiko/Desktop/Xilinx.lic"
./program
--vivado-path /opt/AMDDesignTools/Vivado/2023.2/bin/vivado
Ideally, only the PCI device operations should require sudo, while Vivado synthesis and project generation should run as the normal user.
Error Type
Other
Device Context File
Windows Event Log
Device Manager Error Details
No response
Terminal Output
thank you for reporting this. we have resolved the problem. thanks to @VoidChecksum for their contributions in the process.
https://github.com/sercanarga/PCILeechGen/commit/0eb3bf955d906b69391e978bcbf13b94bd909d67