Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ego user home directory not created by AUR package #131

Closed
Bad3r opened this issue Jun 10, 2023 · 9 comments · Fixed by #134
Closed

ego user home directory not created by AUR package #131

Bad3r opened this issue Jun 10, 2023 · 9 comments · Fixed by #134
Assignees

Comments

@Bad3r
Copy link

Bad3r commented Jun 10, 2023

  • Arch Linux
  • ego v1.1.5
  • Tested applications: Logseq , Joplin, VS Code.
@intgr
Copy link
Owner

intgr commented Jun 11, 2023

Hi! I tried the code package from Arch Linux (open source build of VS Code) and logseq-desktop-bin package from AUR and they seemed to start up fine on my setup.

Please be more specific than "unable to run". What happens when you try to run them? Do some other applications work? What output do you see on console when you attempt to run these? What desktop environment are you running? Using Wayland or not? Are you using any custom flags with ego?

Also please run ego -vvv with some application and post the console output.

@Bad3r
Copy link
Author

Bad3r commented Jun 13, 2023

Please be more specific than "unable to run". What happens when you try to run them? Do some other applications work? What output do you see on console when you attempt to run these? What desktop environment are you running? Using Wayland or not? Are you using any custom flags with ego?
Also please run ego -vvv with some application and post the console output.

Yes sorry. They immediately crash with a javascript related error when initializing electron. I am using i3wm on Xorg.

❯ ego -vvv logseq                                   
[ego::logging] Log level TRACE
[users::base] Running getpwnam_r for user "ego"
[users::base] Loading user with uid 921
Setting up Alter Ego for user ego (921)
Runtime data dir '/run/user/1000' configured
Wayland: WAYLAND_DISPLAY not set, skipping
Running: xhost +si:localuser:ego
Publishing PulseAudio cookie /home/user/.config/pulse/cookie to /run/user/1000/ego/pulse-cookie
PulseAudio dir '/run/user/1000/pulse' configured
Running command: machinectl shell '--uid=ego' '-EDISPLAY=:0' '-EPULSE_SERVER=unix:/run/user/1000/pulse/native' '-EPULSE_COOKIE=/run/user/1000/ego/pulse-cookie' -- .host /bin/sh -c 'dbus-update-activation-environment --systemd DISPLAY PULSE_SERVER PULSE_COOKIE; systemctl --user start xdg-desktop-portal-gtk; exec logseq'
Executing: machinectl shell '--uid=ego' '-EDISPLAY=:0' '-EPULSE_SERVER=unix:/run/user/1000/pulse/native' '-EPULSE_COOKIE=/run/user/1000/ego/pulse-cookie' -- .host /bin/sh -c 'dbus-update-activation-environment --systemd DISPLAY PULSE_SERVER PULSE_COOKIE; systemctl --user start xdg-desktop-portal-gtk; exec logseq'
Connected to the local host. Press ^] three times within 1s to exit session.
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Failed to get 'userData' path
    at /opt/logseq-desktop-git/resources/app/electron.js:12689:211
    at Object.<anonymous> (/opt/logseq-desktop-git/resources/app/electron.js:16772:3)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1296:10)
    at Module.load (node:internal/modules/cjs/loader:1096:32)
    at Module._load (node:internal/modules/cjs/loader:937:12)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at node:electron/js2c/browser_init:2:115880
    at node:electron/js2c/browser_init:2:116083
    at node:electron/js2c/browser_init:2:116087
Connection to the local host terminated.

I tested with firefox (non electron app example) and it fails due to a permission issue related to dbus.

❯ ego -vvv firefox
[ego::logging] Log level TRACE
[users::base] Running getpwnam_r for user "ego"
[users::base] Loading user with uid 921
Setting up Alter Ego for user ego (921)
Runtime data dir '/run/user/1000' configured
Wayland: WAYLAND_DISPLAY not set, skipping
Running: xhost +si:localuser:ego
Publishing PulseAudio cookie /home/user/.config/pulse/cookie to /run/user/1000/ego/pulse-cookie
PulseAudio dir '/run/user/1000/pulse' configured
Running command: machinectl shell '--uid=ego' '-EDISPLAY=:0' '-EPULSE_SERVER=unix:/run/user/1000/pulse/native' '-EPULSE_COOKIE=/run/user/1000/ego/pulse-cookie' -- .host /bin/sh -c 'dbus-update-activation-environment --systemd DISPLAY PULSE_SERVER PULSE_COOKIE; systemctl --user start xdg-desktop-portal-gtk; exec firefox'
Executing: machinectl shell '--uid=ego' '-EDISPLAY=:0' '-EPULSE_SERVER=unix:/run/user/1000/pulse/native' '-EPULSE_COOKIE=/run/user/1000/ego/pulse-cookie' -- .host /bin/sh -c 'dbus-update-activation-environment --systemd DISPLAY PULSE_SERVER PULSE_COOKIE; systemctl --user start xdg-desktop-portal-gtk; exec firefox'
Connected to the local host. Press ^] three times within 1s to exit session.
[Parent 2102299, Main Thread] WARNING: Failed to mkdir /home/ego/.config/ibus/bus: Permission denied: 'glib warning', file /build/firefox-developer-edition/src/firefox-115.0/toolkit/xre/nsSigHandlers.cpp:167

(firefoxdeveloperedition:2102299): IBUS-WARNING **: 01:00:12.941: Failed to mkdir /home/ego/.config/ibus/bus: Permission denied
Connection to the local host terminated.

@intgr
Copy link
Owner

intgr commented Jun 18, 2023

Sorry for not getting back to you earlier.

Please check the filesystem permissions of /home/ego and subdirectories. I think they have incorrect ownership. If so, running sudo chown ego: -R /home/ego should fix it.

@Bad3r
Copy link
Author

Bad3r commented Jun 18, 2023

Sorry for not getting back to you earlier.

Please check the filesystem permissions of /home/ego and subdirectories. I think they have incorrect ownership. If so, running sudo chown ego: -R /home/ego should fix it.

No worries. Strangely the home directory for the user ego was never created. Looking how I can force creating the home directory. Not sure if I missed something.

@intgr
Copy link
Owner

intgr commented Jun 19, 2023

The command that ego recommends to create the user explicitly uses --create-home. I guess you created the user some other way?

% ego -u blabla
error: Unknown user 'blabla'
hint: Specify different user with --user= or create a new user with the command:
    sudo useradd 'blabla' --uid 154 --create-home

I suppose I could add a check for the user's home directory and log a warning in that case, maybe it helps someone else in the future.

@intgr intgr self-assigned this Jun 19, 2023
@Bad3r
Copy link
Author

Bad3r commented Jun 21, 2023

The command that ego recommends to create the user explicitly uses --create-home. I guess you created the user some other way?

% ego -u blabla
error: Unknown user 'blabla'
hint: Specify different user with --user= or create a new user with the command:
    sudo useradd 'blabla' --uid 154 --create-home

I suppose I could add a check for the user's home directory and log a warning in that case, maybe it helps someone else in the future.

I didn't create any extra users. the user ego exist in /etc/shadow

ego:x:921:921:Alter Ego:/home/ego:/bin/bash

Somehow the home directory for the user ego was not initialized. I installed via the AUR will double check if something is missing from the pkgbuild.

@intgr
Copy link
Owner

intgr commented Jun 21, 2023

OH! Then the issue is with AUR packaging instead of this repository. I had forgotten that the AUR package autocreates the user.

Thanks, that's something that should be fixed.

@intgr intgr changed the title Unable to run electron applications ego user home directory not created by AUR package Jun 22, 2023
@intgr intgr changed the title ego user home directory not created by AUR package ego user home directory not created by AUR package Jun 22, 2023
@intgr
Copy link
Owner

intgr commented Jun 22, 2023

From sysusers.d man page https://man.archlinux.org/man/sysusers.d.5#Home_Directory

systemd-sysusers only sets the home directory record in the user database. To actually create the directory, consider adding a corresponding tmpfiles.d(5) fragment.

intgr added a commit that referenced this issue Jun 25, 2023
Add tmpfiles.d configuration file to create the /home/ego directory for ego user.

Fixes #131, turns out sysusers.d doesn't create the home directory: https://man.archlinux.org/man/sysusers.d.5#Home_Directory
@Bad3r
Copy link
Author

Bad3r commented Jun 25, 2023

to confirm; creating the missing home directory fixed the issue for me. Thank you for your help!

intgr added a commit that referenced this issue Jun 25, 2023
Adds additional log output when target user's home directory seems incorrectly configured. This would make issues like #131 less puzzling.

* Also added snapshot tests for log output using new `testing_logger` dependency.
* Also now using an unprivileged user to build in Docker, as tests assume `/root/` directory is not accessible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants