Unable to initialize SDL, over X11 for only root

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to initialize SDL, over X11 for only root

Jeff-2
Moritz  / all,

I thought we had all of our X11 issues solved with v3.4.0 of FFMpeg and SDL
v2.0.7 (both built with standard configure/make/make install), but have
since come across an unusual error.   When launching *ffplay* as any normal
user (X11 or direct terminal/desktop), I am able to play videos without a
problem.

However when running *ffplay* as the root user over X11 on the same files,
I am getting met with the '*Unable to initialize SDL*' error.

If I run that same file as the root user directly its root desktop (vice
X11), it launches just fine.  So it's only root over X11 (and possibly in
VM vs. a pure hardware platform, but will need to confirm that).

I came across this (
http://www.ffmpeg-archive.org/help-ffplay-Could-not-initialize-SDL-td4675063.html)
thread/post form Moritz indicating there may be an issue using ffplay as
root?

In this particular case, there is a program daemon which is run as root
that calls ffplay.  This is why the call is being made by the root user.
It seems something is different in the case of root over X11 vs. a direct
terminal call from the root user's desktop, but I don't have the foggiest
idea.

Any thoughts would be greatly appreciated.

Thanks,

Jeff
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unable to initialize SDL, over X11 for only root

Cley Faye
>
>
> In this particular case, there is a program daemon which is run as root
> that calls ffplay.  This is why the call is being made by the root user.
> It seems something is different in the case of root over X11 vs. a direct
> terminal call from the root user's desktop, but I don't have the foggiest
> idea.
>
> Any thoughts would be greatly appreciated.
>
>
>
​First thought is "can root run anything else using X11 in the same
condition". Instead of ffplay, try running something like xclock/xmessage
to check (there are probably better way to check this though).​
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unable to initialize SDL, over X11 for only root

Moritz Barsnick
Hi Jeff,

On Sun, Apr 01, 2018 at 16:28:28 -0400, Jeff wrote:
> However when running *ffplay* as the root user over X11 on the same files,
> I am getting met with the '*Unable to initialize SDL*' error.

First of all: *WHY*?? There is usually no good reason to run anything
as root, if you are not administrating the system. If the user and
ffplay need access to some files or devices, grant the user access,
instead of using root.

> I came across this (
> http://www.ffmpeg-archive.org/help-ffplay-Could-not-initialize-SDL-td4675063.html)
> thread/post form Moritz indicating there may be an issue using ffplay as
> root?

The user never gave indication as to what he was doing, so we can't
know. My questions in the last e-mail are still valid.

> In this particular case, there is a program daemon which is run as root
> that calls ffplay.  This is why the call is being made by the root user.

A daemon that has access to a display? In that case, ffplay should be
called as something like "su <displayuser> -c 'ffplay'".

> It seems something is different in the case of root over X11 vs. a direct
> terminal call from the root user's desktop, but I don't have the foggiest
> idea.

I don't see a specific ffmpeg / ffplay issue. See Cley's answer: No X11
program may work at all. It has always been that way, at least for the
last 20 years or so. X11 uses "cookie authentication". To allow root to
use the user's cookies, you can either:
- open up access to the display using "xhost +local" (giving up all
  security),
- migrate the auth cookie to the root process,
- use sudo from the user account to root (I think),
- log into root's account with "ssh -X" (which will automatically
  migrate the cookie and give access via an SSH tunnel).

The latter two require interactive use, I guess.

Extra issue: If your display uses Xwayland, some of the above no longer
work. See also e.g. here:
https://bugzilla.redhat.com/show_bug.cgi?id=1266771#c4

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unable to initialize SDL, over X11 for only root

Jeff-2
Moritz & Cley,

Thanks for the responses! I believe I checked most of these points, but I will do so more methodically to ensure I didn’t miss anything.  

As far as why on the root user, I’m only speculating that’s how this application is working. I know its daemon runs as root, so I’m guessing that why it’s having issues calling ffplay. That said, a daemon calling it is different than me starting an interactive shell and calling it, so as you point out that may be where my issue is! I will dig into this more tomorrow and let you all know what I find.

Thanks again! I appreciate the great support you all provide.

Jeff

> On Apr 2, 2018, at 07:46, Moritz Barsnick <[hidden email]> wrote:
>
> Hi Jeff,
>
>> On Sun, Apr 01, 2018 at 16:28:28 -0400, Jeff wrote:
>> However when running *ffplay* as the root user over X11 on the same files,
>> I am getting met with the '*Unable to initialize SDL*' error.
>
> First of all: *WHY*?? There is usually no good reason to run anything
> as root, if you are not administrating the system. If the user and
> ffplay need access to some files or devices, grant the user access,
> instead of using root.
>
>> I came across this (
>> http://www.ffmpeg-archive.org/help-ffplay-Could-not-initialize-SDL-td4675063.html)
>> thread/post form Moritz indicating there may be an issue using ffplay as
>> root?
>
> The user never gave indication as to what he was doing, so we can't
> know. My questions in the last e-mail are still valid.
>
>> In this particular case, there is a program daemon which is run as root
>> that calls ffplay.  This is why the call is being made by the root user.
>
> A daemon that has access to a display? In that case, ffplay should be
> called as something like "su <displayuser> -c 'ffplay'".
>
>> It seems something is different in the case of root over X11 vs. a direct
>> terminal call from the root user's desktop, but I don't have the foggiest
>> idea.
>
> I don't see a specific ffmpeg / ffplay issue. See Cley's answer: No X11
> program may work at all. It has always been that way, at least for the
> last 20 years or so. X11 uses "cookie authentication". To allow root to
> use the user's cookies, you can either:
> - open up access to the display using "xhost +local" (giving up all
>  security),
> - migrate the auth cookie to the root process,
> - use sudo from the user account to root (I think),
> - log into root's account with "ssh -X" (which will automatically
>  migrate the cookie and give access via an SSH tunnel).
>
> The latter two require interactive use, I guess.
>
> Extra issue: If your display uses Xwayland, some of the above no longer
> work. See also e.g. here:
> https://bugzilla.redhat.com/show_bug.cgi?id=1266771#c4
>
> Cheers,
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Unable to initialize SDL, over X11 for only root

Jeff-2
You guys were right! The magic cookie was not getting set, which was the root of the problem! All is working now.

Thanks for the assist!

Jeff

> On Apr 2, 2018, at 18:44, Jeff <[hidden email]> wrote:
>
> Return-Path: <[hidden email]>
> Received: from [192.168.1.2] (pool-100-15-204-239.washdc.fios.verizon.net.
> [100.15.204.239]) by smtp.gmail.com with ESMTPSA id
> a12sm1099978qtm.74.2018.04.02.15.44.58 for <[hidden email]>
> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr
> 2018 15:44:58 -0700 (PDT)
> From: Jeff <[hidden email]>
> Content-Type: text/plain; charset=utf-8
> Content-Transfer-Encoding: quoted-printable
> Mime-Version: 1.0 (1.0)
> Date: Mon, 2 Apr 2018 18:44:58 -0400
> Subject: Re: [FFmpeg-user] Unable to initialize SDL, over X11 for only root
> Message-Id: <[hidden email]>
> References: <[hidden email]>
> In-Reply-To: <[hidden email]>
> To: FFmpeg user questions <[hidden email]>
> X-Mailer: iPhone Mail (15D100)
>
> Moritz & Cley,
>
> Thanks for the responses! I believe I checked most of these points, but I wi=
> ll do so more methodically to ensure I didn=E2=80=99t miss anything. =20
>
> As far as why on the root user, I=E2=80=99m only speculating that=E2=80=99s h=
> ow this application is working. I know its daemon runs as root, so I=E2=80=99=
> m guessing that why it=E2=80=99s having issues calling ffplay. That said, a d=
> aemon calling it is different than me starting an interactive shell and call=
> ing it, so as you point out that may be where my issue is! I will dig into t=
> his more tomorrow and let you all know what I find.
>
> Thanks again! I appreciate the great support you all provide.
>
> Jeff
>
>> On Apr 2, 2018, at 07:46, Moritz Barsnick <[hidden email]> wrote:
>> =20
>> Hi Jeff,
>> =20
>>> On Sun, Apr 01, 2018 at 16:28:28 -0400, Jeff wrote:
>>> However when running *ffplay* as the root user over X11 on the same files=
> ,
>>> I am getting met with the '*Unable to initialize SDL*' error.
>> =20
>> First of all: *WHY*?? There is usually no good reason to run anything
>> as root, if you are not administrating the system. If the user and
>> ffplay need access to some files or devices, grant the user access,
>> instead of using root.
>> =20
>>> I came across this (
>>> http://www.ffmpeg-archive.org/help-ffplay-Could-not-initialize-SDL-td4675=
> 063.html)
>>> thread/post form Moritz indicating there may be an issue using ffplay as
>>> root?
>> =20
>> The user never gave indication as to what he was doing, so we can't
>> know. My questions in the last e-mail are still valid.
>> =20
>>> In this particular case, there is a program daemon which is run as root
>>> that calls ffplay.  This is why the call is being made by the root user.
>> =20
>> A daemon that has access to a display? In that case, ffplay should be
>> called as something like "su <displayuser> -c 'ffplay'".
>> =20
>>> It seems something is different in the case of root over X11 vs. a direct=
>
>>> terminal call from the root user's desktop, but I don't have the foggiest=
>
>>> idea.
>> =20
>> I don't see a specific ffmpeg / ffplay issue. See Cley's answer: No X11
>> program may work at all. It has always been that way, at least for the
>> last 20 years or so. X11 uses "cookie authentication". To allow root to
>> use the user's cookies, you can either:
>> - open up access to the display using "xhost +local" (giving up all
>> security),
>> - migrate the auth cookie to the root process,
>> - use sudo from the user account to root (I think),
>> - log into root's account with "ssh -X" (which will automatically
>> migrate the cookie and give access via an SSH tunnel).
>> =20
>> The latter two require interactive use, I guess.
>> =20
>> Extra issue: If your display uses Xwayland, some of the above no longer
>> work. See also e.g. here:
>> https://bugzilla.redhat.com/show_bug.cgi?id=3D1266771#c4
>> =20
>> Cheers,
>> Moritz
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> =20
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
> Moritz & Cley,
>
> Thanks for the responses! I believe I checked most of these points, but I wi=
> ll do so more methodically to ensure I didn=E2=80=99t miss anything. =20
>
> As far as why on the root user, I=E2=80=99m only speculating that=E2=80=99s h=
> ow this application is working. I know its daemon runs as root, so I=E2=80=99=
> m guessing that why it=E2=80=99s having issues calling ffplay. That said, a d=
> aemon calling it is different than me starting an interactive shell and call=
> ing it, so as you point out that may be where my issue is! I will dig into t=
> his more tomorrow and let you all know what I find.
>
> Thanks again! I appreciate the great support you all provide.
>
> Jeff
>
>> On Apr 2, 2018, at 07:46, Moritz Barsnick <[hidden email]> wrote:
>> =20
>> Hi Jeff,
>> =20
>>> On Sun, Apr 01, 2018 at 16:28:28 -0400, Jeff wrote:
>>> However when running *ffplay* as the root user over X11 on the same files=
> ,
>>> I am getting met with the '*Unable to initialize SDL*' error.
>> =20
>> First of all: *WHY*?? There is usually no good reason to run anything
>> as root, if you are not administrating the system. If the user and
>> ffplay need access to some files or devices, grant the user access,
>> instead of using root.
>> =20
>>> I came across this (
>>> http://www.ffmpeg-archive.org/help-ffplay-Could-not-initialize-SDL-td4675=
> 063.html)
>>> thread/post form Moritz indicating there may be an issue using ffplay as
>>> root?
>> =20
>> The user never gave indication as to what he was doing, so we can't
>> know. My questions in the last e-mail are still valid.
>> =20
>>> In this particular case, there is a program daemon which is run as root
>>> that calls ffplay.  This is why the call is being made by the root user.
>> =20
>> A daemon that has access to a display? In that case, ffplay should be
>> called as something like "su <displayuser> -c 'ffplay'".
>> =20
>>> It seems something is different in the case of root over X11 vs. a direct=
>
>>> terminal call from the root user's desktop, but I don't have the foggiest=
>
>>> idea.
>> =20
>> I don't see a specific ffmpeg / ffplay issue. See Cley's answer: No X11
>> program may work at all. It has always been that way, at least for the
>> last 20 years or so. X11 uses "cookie authentication". To allow root to
>> use the user's cookies, you can either:
>> - open up access to the display using "xhost +local" (giving up all
>> security),
>> - migrate the auth cookie to the root process,
>> - use sudo from the user account to root (I think),
>> - log into root's account with "ssh -X" (which will automatically
>> migrate the cookie and give access via an SSH tunnel).
>> =20
>> The latter two require interactive use, I guess.
>> =20
>> Extra issue: If your display uses Xwayland, some of the above no longer
>> work. See also e.g. here:
>> https://bugzilla.redhat.com/show_bug.cgi?id=3D1266771#c4
>> =20
>> Cheers,
>> Moritz
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> =20
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".