构建电子Linux发行版:找到了SUID沙箱帮助程序二进制文件,但配置不正确

问题描述

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

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

此应用程序结构myApp-> myApp(Linux可执行文件),mian.js,资源-> myApp.asar

这给出了一个Linux版本的electronic软件包。但是我必须运行以下命令来运行应用程序

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

实际上,我是从tfs构建工件中获得该应用程序的,下载此应用程序时,我想直接运行./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中电子框架的一个热门问题。您可以检查this discussion了解更多详细信息。

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

1.chown和chmod首先像您所做的一样。

sudo chown root chrome-sandbox
chmod 4755 chrome-sandbox

2。如果您获得一个应用程序映像,则可以直接使用--no-sandbox arguemnt

运行它

3。sysctl kernel.unprivileged_userns_clone=1enable unprivileged access

您已经使用过#1,但是您也可以检查#2/#3是否更适合您的情况。

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

由于部分代理是Linux,其他部分是Windows,因此建议您使用Conditions来管理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(),'Windows_NT'))

关于预定义变量Agent.OS,您可以检查this document

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...