Show system notification when fixing electron sandbox fails

This commit is contained in:
Patrick Pacher
2022-03-22 09:45:37 +01:00
parent 50720ff099
commit 532e4f3792

View File

@@ -13,10 +13,7 @@ import (
var pmElectronUpdate *updater.File
const suidBitWarning = `Failed to set SUID permissions for chrome-sandbox.
This is required for Linux kernel versions that do not have unprivileged user namespaces (CONFIG_USER_NS_UNPRIVILEGED) enabled.
If you're running and up-to-date distribution kernel you can likely ignore this warning. If you encounter issue starting the
user interface please either update your kernel or set the SUID bit (mode 0%0o) on %s`
const suidBitWarning = `Failed to set SUID permissions for chrome-sandbox. This is required for Linux kernel versions that do not have unprivileged user namespaces (CONFIG_USER_NS_UNPRIVILEGED) enabled. If you're running and up-to-date distribution kernel you can likely ignore this warning. If you encounter issue starting the user interface please either update your kernel or set the SUID bit (mode 0%0o) on %s`
// EnsureChromeSandboxPermissions makes sure the chrome-sandbox distributed
// by our app-electron package has the SUID bit set on systems that do not
@@ -46,7 +43,7 @@ func EnsureChromeSandboxPermissions(reg *updater.ResourceRegistry) error {
)
sandboxFile := filepath.Join(unpackedPath, "chrome-sandbox")
if err := os.Chmod(sandboxFile, 0o0755|os.ModeSetuid); err != nil {
log.Warningf(suidBitWarning, 0o0755 | os.ModeSetuid, sandboxFile)
log.Errorf(suidBitWarning, 0o0755|os.ModeSetuid, sandboxFile)
return fmt.Errorf("failed to chmod: %w", err)
}