Weston on RPi: running as non-root

Kristian Høgsberg hoegsberg at gmail.com
Thu Jan 3 10:46:29 PST 2013


On Thu, Jan 03, 2013 at 12:31:50PM +0200, Mika Boström wrote:
> I had a strange problem: after weston had started on RPi, I couldn't get
> any of the clients to run. I'm posting this in the hope that it will
> help someone else solve similar problems.
> 
> Steps taken:
> 1. went with raspbian (from official image)
> 2. rebuilt cairo packages to enable cairo-glesv2
> 3. followed http://wayland.freedesktop.org/raspberrypi.html with slight
> modifications:
> A) --disable-configuration for wayland build
> B) made sure weston was built without cairo-egl
> C) -rwsr-xr-x 1 root pi 382624 Jan  3 10:55 local/bin/weston
> 
> Last change was needed to get weston running at all. It starts, and
> seems to work, but trying to launch any of the applications simply
> results in an error. Weston-terminal, smoke and flower all result in
> identical error message:
> 
> """
> failed to create display: Permission denied
> failed to create display: Permission denied
> """
> 
> ... which was kind of strange. Looking through the client code, this
> comes from display_create() error handling, and the code itself
> eventually expands to wl_display_connect(). The reason seems to be this:
> 
> srwxr-xr-x 1 root pi    0 Jan  3 11:52 wayland-0
> 
> Yep. Non-root user doesn't have permission to connect to Wayland socket.

Weston will create the socket with permissions so that only the user
weston runs as can access it.  This is deliberate and how the
authentication works.  As such, you can't run weston as root and then
connect to it as a different, regular user.  In fact, you shouldn't
run weston (including all of GL, shader compiler, protocol handling
etc) as root.  I'm not familiar with the requirements of the rpi
backend, that is, what kind of access is required to run weston, but
if there's a graphics device that you need to be root to open, we
should do that in weston-launch, similar to how we handle the
limitations of linux drm and input devices.

Kristian

> ** ONE-TIME SOLUTION **
> 
> After weston has launched:
> 
> % sudo chmod g+w /run/shm/wayland/wayland-0
> 
> 
> ** "More permanent" solution **
> 
> Launch weston via a wrapper which first sets umask to 0002, so the
> socket is created with group rw bits set.
> 
> 
> That's it. Have fun, and keep on hacking.
> 
> -- 
>  Mika Boström / mika.bostrom at nomovok.com
>  Software Architect
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list