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

Relinquishing root permissions too early #118

Closed
dorian-eydoux opened this issue Apr 9, 2019 · 15 comments
Closed

Relinquishing root permissions too early #118

dorian-eydoux opened this issue Apr 9, 2019 · 15 comments
Assignees
Labels
bug Something isn't working helpme Questions from users having trouble

Comments

@dorian-eydoux
Copy link

$ ps4-waker 
Device must be awake for initial registration. Please turn it on manually and try again.
$ sudo ps4-waker 
WAKEUP sent to device... 192.168.1.4
Logging in...

normally the sudo is not right for the configuration, right?
It annoys me because I do not want to leave the sudo without passwords for Homebridge

$ node -v
v10.15.3
$ npm -v
6.4.1
@dhleong
Copy link
Owner

dhleong commented Apr 9, 2019

Did you use sudo ps4-waker originally to configure it? If so, your config file is probably in the root user's home directory (maybe /root/.ps4-wake.credentials.json), which is why a normal invocation cannot find it but sudo ps4-waker can.

You could try:

  1. Redo registration without sudo. This should create the credentials file in your normal user's home directory. If it does not, please let me know.
  2. Move the credentials file from the root user's home directory to your home directory.

As of version 1.8.0, you should not need to manually use sudo with ps4-waker; doing so is the probably the biggest source of issues. If you needed sudo for some reason, please describe what happened that led you to that. Also, please include the output from ps4-waker --version.

@dhleong dhleong added the helpme Questions from users having trouble label Apr 9, 2019
@hkccmaster
Copy link

i got the same problem, and if i redo the registration without sudo, it fail. i need to make success pair process using sudo to execute the ps4-waker at the first time...

@dhleong
Copy link
Owner

dhleong commented May 9, 2019

In what way does it fail? Can you copy and paste what happens with any error messages?

@hkccmaster
Copy link

In what way does it fail? Can you copy and paste what happens with any error messages?

pi@raspberrypi:~ $ sudo npm -g install ps4-waker
/usr/bin/ps4-waker -> /usr/lib/node_modules/ps4-waker/dist/cli.js

  • ps4-waker@1.8.4
    added 9 packages from 12 contributors in 4.559s
    pi@raspberrypi:~ $ ps4-waker
    No credentials; Use the PS4 Second Screen App and try to connect to "PS4-Waker"
    Root permissions required to start PS4 Dummy
    Attempting to request root permissions now (we will relinquish them as soon as possible):
    sudo /usr/bin/node /usr/bin/ps4-waker --user-id 1000 -c /home/pi/.ps4-wake.credentials.json
    No credentials; Use the PS4 Second Screen App and try to connect to "PS4-Waker"
    Relinquished root privileges
    events.js:183
    throw er; // Unhandled 'error' event
    ^

Error: bind EACCES 0.0.0.0:987
at _handle.lookup (dgram.js:266:18)
at _combinedTickCallback (internal/process/next_tick.js:142:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
pi@raspberrypi:~ $

@hkccmaster
Copy link

i need to add "sudo" in front of ps4-waker to make it success pairing with the app

@dhleong
Copy link
Owner

dhleong commented May 9, 2019 via email

@hkccmaster
Copy link

Interesting. Does it say "Relinquishing root privileges" immediately after the "Use the PS4 Second Screen App" prompt?

On Thu, May 9, 2019 at 12:31 PM hkccmaster @.***> wrote: i need to add "sudo" in front of ps4-waker to make it success pairing with the app — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#118 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGHIFVXQLQ5EJJ2OE24EW3PURGWZANCNFSM4HEP6QHQ .

the above is copy & paste from ssh screen. bottom 3 line show "Relinquished root privileges"

@hkccmaster
Copy link

i also cant find the file .ps4-wake.credentials.json
can u let me know how? of coz it is not in my user directory but the root directory is blank...

@dhleong
Copy link
Owner

dhleong commented May 9, 2019 via email

@hkccmaster
Copy link

Yes I see that, but I'm asking if it waits for you to do anything before showing "Relinquished root privileges," or if that happens immediately after the line above it. Under normal operation the app should pause and wait for you to connect during that step.

On Thu, May 9, 2019 at 1:35 PM hkccmaster @.> wrote: Interesting. Does it say "Relinquishing root privileges" immediately after the "Use the PS4 Second Screen App" prompt? … <#m_2427254840439583125_> On Thu, May 9, 2019 at 12:31 PM hkccmaster @.> wrote: i need to add "sudo" in front of ps4-waker to make it success pairing with the app — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#118 (comment) <#118 (comment)>>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGHIFVXQLQ5EJJ2OE24EW3PURGWZANCNFSM4HEP6QHQ . the above is copy & paste from ssh screen. bottom 3 line show "Relinquished root privileges" — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#118 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGHIFTYWEOQVAU4VC7GLVDPUROEZANCNFSM4HEP6QHQ .

the whole message show at the same time. it show immediately.

@hkccmaster
Copy link

all other plugin in my homebridge working fine.

@hkccmaster
Copy link

now when i leave the homebridge running at the background (i mean reboot auto load), the ps4-waker wont work.

however, if i execute "sudo homebridge -U /etc/homebridge -D" and keep the ssh running, the ps4-waker will work

@dhleong
Copy link
Owner

dhleong commented May 9, 2019

See here for the ps4-wake.credentials.json: https://github.com/dhleong/ps4-waker/wiki/Troubleshooting#error-device-didnt-wake-in-time

If it's not in any of those places then I don't know. I don't have a raspberry pi so I cannot test it. I also don't use homebridge nor do I know anything about it. The reason it works with sudo is probably because, when run as root, it has access to the credentials file. Again, though, I cannot provide support for your homebridge configuration since I don't use it. All I can do is help with getting ps4-waker to work in the conditions for which it's intended to work.

I'll take a look when I get some time later to see if I can figure out why the setup is relinquishing root privileges early like that.

@hkccmaster
Copy link

See here for the ps4-wake.credentials.json: https://github.com/dhleong/ps4-waker/wiki/Troubleshooting#error-device-didnt-wake-in-time

If it's not in any of those places then I don't know. I don't have a raspberry pi so I cannot test it. I also don't use homebridge nor do I know anything about it. The reason it works with sudo is probably because, when run as root, it has access to the credentials file. Again, though, I cannot provide support for your homebridge configuration since I don't use it. All I can do is help with getting ps4-waker to work in the conditions for which it's intended to work.

I'll take a look when I get some time later to see if I can figure out why the setup is relinquishing root privileges early like that.

i understand. thank you very much for your time. and your work.

@dhleong dhleong changed the title sudo needed Relinquishing root permissions too early May 10, 2019
@dhleong dhleong added the bug Something isn't working label May 10, 2019
@dhleong
Copy link
Owner

dhleong commented May 10, 2019

@hkccmaster I've just released version 1.8.5 that should fix the issue you were encountering.
@dorianeydx I'm assuming you were encountering the same issue since you haven't responded with more information. If you had a different issue that 1.8.5 doesn't fix for you, please open a new ticket.

@dhleong dhleong self-assigned this May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working helpme Questions from users having trouble
Projects
None yet
Development

No branches or pull requests

3 participants