Skip to content

Error: EACCES: permission denied on uhk-agent launch #2679

@jonhermansen

Description

@jonhermansen

While testing uhk-agent on NixOS, I saw this issue on startup where a directory is being created, however, the parent directory is not writable. The GUI is not visible, and the application hangs on the last line of the log:

$ uhk-agent
09:51:13.508 › [Electron Main] command line arguments {}
09:51:13.510 › [Electron Main] init services.
09:51:13.510 › [Electron Main] packagesDir: /nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent
09:51:13.563 › [Electron Main] Create new window.
09:51:13.563 › [WindowState] load settings
09:51:13.565 › [WindowState] loaded settings null
09:51:13.565 › [WindowState]save state not exists, use default
09:51:13.565 › [SmartMacroService] starting...
09:51:13.566 › [SmartMacroCopy] start
09:51:13.569 › [SmartMacroCopy] copy {
  destination: '/home/user/.config/uhk-agent/smart-macro-docs/UltimateHackingKeyboard/firmware/v14.0.0',
  smartMacroDocFirmwarePath: '/nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent/packages/firmware/doc'
}
09:51:13.576 › [SmartMacroService] can't be started on undefined Error: EACCES: permission denied, mkdir '/home/user/.config/uhk-agent/smart-macro-docs/UltimateHackingKeyboard/firmware/v14.0.0/doc-dev'
    at async mkdir (node:internal/fs/promises:852:10)
    at async mkDirAndCopy (node:internal/fs/cp/cp:308:3)
    at async Ts (/nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent/app.asar.unpacked/electron-main.js:5:237647)
    at async Object.start (/nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent/app.asar.unpacked/electron-main.js:5:466209)
    at async App.Dh (/nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent/app.asar.unpacked/electron-main.js:5:471300)
(node:7562) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/home/user/.config/uhk-agent/smart-macro-docs/UltimateHackingKeyboard/firmware/v14.0.0/doc-dev'
    at async mkdir (node:internal/fs/promises:852:10)
    at async mkDirAndCopy (node:internal/fs/cp/cp:308:3)
    at async Ts (/nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent/app.asar.unpacked/electron-main.js:5:237647)
    at async Object.start (/nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent/app.asar.unpacked/electron-main.js:5:466209)
    at async App.Dh (/nix/store/4lx2jfxkngnrvrq89fscvw09rm00757d-uhk-agent-7.0.0/opt/uhk-agent/app.asar.unpacked/electron-main.js:5:471300)
(Use `electron --trace-warnings ...` to show where the warning was created)
(node:7562) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

This issue can be worked around by manually setting the permissions on the parent directory, and creating the doc-dev dir:

chmod +w ~/.config/uhk-agent/smart-macro-docs/UltimateHackingKeyboard/firmware/v14.0.0
mkdir ~/.config/uhk-agent/smart-macro-docs/UltimateHackingKeyboard/firmware/v14.0.0/doc-dev

However, maybe there is a deeper issue here? Why would the parent directory be set to not writable?

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