繁体   English   中英

构建电子 linux 发行版:找到了 SUID 沙箱助手二进制文件,但未正确配置

[英]Building electron linux distro : The SUID sandbox helper binary was found, but is not configured correctly

我正在为 linux 生成电子发行版。 这就是应用程序的构建方式 这是应用程序在 packge.json 中构建的方式

 "builderForLinx": "electron-packager --out linx64 --overwrite --platform linux --appname myApp --asar"  

这个应用程序结构 myApp -> myApp(linux 可执行文件), mian.js, resources -> myApp.asar

这给出了一个 linux 版本的电子包。 但是我必须运行以下命令才能运行该应用程序

sudo chmod +x ./myApp
sudo chown root chrome-sandbox
sudo chmod 4755 chrome-sandbox

实际上,我是从 tfs build artifact 获取该应用程序的,当我下载此应用程序时,我想直接运行 ./myApp。

这是我的 tfs 定义,我在 bash 中运行所有这些,而不是我的代理/构建机器是 Windows 机器。

#!/bin/bash 
cd "$(Build.ArtifactStagingDirectory)/myApp" ; pwd
chown <<username>> chrome-sandbox
chmod 4755 chrome-sandbox

注意:$(Build.ArtifactStagingDirectory) 是指向工件目录的 tfs 变量。 当我直接在 linux 机器上运行应用程序时,我看到了这个错误

The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/staff/kjeeva/licregsNew/v211/licensingclient/linx64/ClientSettings-asar/chrome-sandbox is owned by root and has mode 4755.

我不太熟悉 linux 环境,任何有关这方面的帮助或建议都会有很大帮助。

The SUID sandbox helper binary was found ...似乎是 Linux 中电子框架的一个热点问题。 您可以查看此讨论以获取更多详细信息。

以下是该讨论中可用的解决方法:

1.chown 和 chmod 文件首先像你所做的那样。

sudo chown root chrome-sandbox
chmod 4755 chrome-sandbox

2.如果得到一个appimage,直接用--no-sandbox arguemnt运行--no-sandbox arguemnt

3. sysctl kernel.unprivileged_userns_clone=1 开启非特权访问

您已经使用了#1 ,但您还可以检查#2/#3是否更适合您的场景。

这是我的 tfs 定义,我在 bash 中运行所有这些,而不是我的代理/构建机器是 Windows 机器。

由于您的代理部分是 Linux,而其他代理是 Windows,我建议您可以使用条件来管理 bash 任务。 您可以有两个不同的 bash 任务/步骤,一个用于 Linux,另一个用于 Windows。 然后设置他们的条件以有条件地运行正确的命令。 像这样的东西:

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      # Write commands here
      # ...
  displayName: 'Bash command for Linux'
  condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      # Write commands here
      # ...
  displayName: 'Bash command for Windows'
  condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))

关于预定义变量Agent.OS ,您可以查看此文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM