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

Use sudo for reading ffxiv pid environ #30

Open
wants to merge 1 commit into
base: xlcore
Choose a base branch
from

Conversation

abhishekmukherg
Copy link

@abhishekmukherg abhishekmukherg commented Jan 14, 2023

For reasons I can't quite find on the internet, I was unable to read the environ file from processes created from xlcore (AUR), despite the file being owned by my user, having 0400 permissions.

The only thing I could find online was a RedHat KB entry, which I can't read as I don't have a subscription. The fact that article exists makes me think that there's something in the kernel that prevents this, potentially related to cgroups, but I don't know enough about how xlcore/wine work to know if any of that could be related.

I can confirm that this seems specific to the FFXIV process as kicked off by xlcore from AUR on my machine -- I can enumerate environments of other processes just fine... So I'm really not sure what's going on

For reasons I can't quite find on the internet, I was unable to read the
environ file from processes created from xlcore (AUR), despite the file being
owned by my user, having 0400 permissions. The only thing I could find
online was [a RedHat KB entry][1], which I can't read as I don't have a
subscription. The fact that article exists makes me think that there's
something in the kernel that prevents this, potentially related to
cgroups, but I don't know enough about how xlcore/wine work to know if
any of that could be related. I can confirm that this seems specific to
the FFXIV process as kicked off by xlcore from AUR on my machine -- I
can enumerate environments of other processes just fine... So I'm really
not sure what's going on

[1]: https://access.redhat.com/solutions/1446823
@valarnin
Copy link
Owner

I can't think of a reason this would be happening unless XL/FFXIV was running under another user or group from your normal terminal user. It works fine for me with xivlauncher-git from AUR on both my desktop linux install and my steam deck.

Is it possible you have selinux or some other analog enabled which is blocking this instead?

@abhishekmukherg
Copy link
Author

abhishekmukherg commented Jan 15, 2023

Yea... I'm pretty stumped too to be honest. I don't think I have selinux on but, apparently, checking would be more work than I think it's worth given that getenforce and other user space tools are only in the AUR according to wiki. More work than it's worth because I don't remember doing anything like that and this is a pretty new install.

Just to make sure i'm not crazy, here's what I'm seeing:

❯ ps -o uid,gid -p $(pgrep ffxiv_dx11.exe)
  UID   GID
 1000  1000

❯ id -u; id -g
1000
1000

❯ stat --format='%A %u %g' /proc/$(pgrep ffxiv_dx11.exe)/environ
-r-------- 1000 1000

❯ cat /proc/$(pgrep ffxiv_dx11.exe)/environ
cat: /proc/6914/environ: Permission denied

@abhishekmukherg
Copy link
Author

@valarnin just cleaning up, what do you want to do with this PR? Close it until someone else experiences the problem?

Comment on lines +125 to +128
echo "Failed to cat /proc/$FFXIV_PID/environ. This can sometimes happen if your operating system only allows this action by root. We will try to rerun this command with sudo. You may be prompted for your password. The commands we will run with sudo are:" >&2
echo >&2
echo " sudo cat /proc/$FFXIV_PID/environ" >&2
sudo cat /proc/$FFXIV_PID/environ
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should display this message with a different color to indicate that it's more important. Use warn.

Additionally, we should always prompt before running something as sudo, so that the user can interrupt if it doesn't look correct.

Finally, a minor grammar correction.

Suggested change
echo "Failed to cat /proc/$FFXIV_PID/environ. This can sometimes happen if your operating system only allows this action by root. We will try to rerun this command with sudo. You may be prompted for your password. The commands we will run with sudo are:" >&2
echo >&2
echo " sudo cat /proc/$FFXIV_PID/environ" >&2
sudo cat /proc/$FFXIV_PID/environ
warn "Failed to cat /proc/$FFXIV_PID/environ. This can sometimes happen if your operating system only allows this action by root. We will try to rerun this command with sudo. You may be prompted for your password. The command we will run with sudo is:"
echo >&2
warn " sudo cat /proc/$FFXIV_PID/environ"
PROMPT_CONTINUE
sudo cat /proc/$FFXIV_PID/environ

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 this pull request may close these issues.

2 participants