framework icon indicating copy to clipboard operation
framework copied to clipboard

permission to bind input_method denied

Open Michael65589 opened this issue 4 years ago • 34 comments

When I want to start the maliit-server I always get a permission denied message. This error occurs as non-root-user and as root-user as well.

maliit-server WARNING: PulseAudioService: pa_context_connect() failed WARNING: PulseAudioService: pa_context_connect() failed zwp_input_method_v1@17: error 0: [ 139.491622] audit: type=1701 audit(1632379225.736:3): auid=4294967295 uid=1000 gid=1001 ses=4294967295 pid=813 comm="maliit-server" exe="/usr/bin/maliit-server" sig=6 res=1 permission to bind input_method denied FATAL: The Wayland connection experienced a fatal error: Protocol error Aborted

Any suggestions?

Michael65589 avatar Sep 23 '21 06:09 Michael65589

What compositor you're running against? And for Wayland you should use the maliit-keyboard directly, and not maliit-server

bhush9 avatar Sep 23 '21 07:09 bhush9

I use the Weston compositor. When I use maliit-keyboard directly I got the following message: maliit-keyboard wordengine.cpp plugin "/usr/lib/maliit/keyboard2/languages/en/libenplugin.so" loaded PulseAudioService: pa_context_connect() failed PulseAudioService: pa_context_connect() failed inputmethod_p.h registerActiveLanguage(): activeLanguage is: "en" in inputMethod.cpp setActiveLanguage() activeLanguage is: "en" inputMethod::reset() in clear preedit.. clearing word engine keyboard is reporting : < 0 -8 0 8 > to the app manager. maliit.connection.wayland: Maliit[ 4304.985544] audit: type=1701 audit(1632383391.232:8): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=1172 comm="maliit-keyboard" exe="/usr/bin/maliit-keyboard" sig=6 res=1 ::Wayland::InputMethod::InputMethod(MInputContextConnection*, wl_registry*, int) zwp_input_method_v1@17: error 0: permission to bind input_method denied The Wayland connection experienced a fatal error: Protocol error Aborted

Michael65589 avatar Sep 23 '21 07:09 Michael65589

I follow this information for weston: http://maliit.github.io/news/2017/05/24/standalone-mode/

Michael65589 avatar Sep 23 '21 07:09 Michael65589

Hi Bhushan,

here is a log weston.log

Michael65589 avatar Sep 23 '21 08:09 Michael65589

I forgot to make the script executable.

/usr/bin/maliit-keyboard.sh

#!/bin/sh
export QT_WAYLAND_SHELL_INTEGRATION=inputpanel-shell
maliit-keyboard -platform wayland

After make it executable the weston.log looks weston_1.log

It looks that maliit-keyboard is running but I can't see any keyboard on my screen. ps aux | grep maliit user 706 0.0 0.0 3440 900 ? S 08:17 0:00 /bin/sh /usr/bin/maliit-keyboard.sh user 708 0.2 2.3 877436 46740 ? Sl 08:17 0:00 maliit-keyboard -platform wayland user 857 0.0 0.1 6336 2012 ttymxc1 S+ 08:21 0:00 grep --color=auto maliit

Michael65589 avatar Sep 23 '21 08:09 Michael65589

ep 23 08:56:37 hmi daemon.info dbus-daemon[781]: [session uid=1000 pid=781] Activating service name='org.maliit.server' requested by ':1.10' (uid=1000 pid=1405 comm="./Maliit-Keyboard-Test ") Sep 23 08:56:37 hmi daemon.info dbus-daemon[781]: [session uid=1000 pid=781] Activated service 'org.maliit.server' failed: Process org.maliit.server received signal 6

Michael65589 avatar Sep 23 '21 08:09 Michael65589

For Weston the virtual keyboard needs to be started from the compositor itself.

So in weston.ini there need to be a section [input-method] path=/path/to/maliit-keyboard

jpetersen avatar Sep 23 '21 15:09 jpetersen

I changed the entry in weston.ini to your suggsetion but then the weston.log print the following [16:45:02.483] Loading module '/usr/lib/weston/desktop-shell.so' [16:45:02.485] launching '/usr/bin/maliit-keyboard' [16:45:02.489] launching '/usr/libexec/weston-desktop-shell' [16:45:02.765] input_method disconnected, respawning... [16:45:02.765] launching '/usr/bin/maliit-keyboard' [16:45:02.779] /usr/bin/maliit-keyboard died on signal 6 [16:45:02.890] input_method disconnected, respawning... [16:45:02.890] launching '/usr/bin/maliit-keyboard' [16:45:02.904] /usr/bin/maliit-keyboard died on signal 6 [16:45:03.023] input_method disconnected, respawning... [16:45:03.023] launching '/usr/bin/maliit-keyboard' [16:45:03.038] /usr/bin/maliit-keyboard died on signal 6 [16:45:03.145] input_method disconnected, respawning... [16:45:03.145] launching '/usr/bin/maliit-keyboard' [16:45:03.149] /usr/bin/maliit-keyboard died on signal 6 [16:45:03.273] input_method disconnected, respawning... [16:45:03.273] launching '/usr/bin/maliit-keyboard' [16:45:03.277] /usr/bin/maliit-keyboard died on signal 6 [16:45:03.390] input_method disconnected, giving up. [16:45:03.392] /usr/bin/maliit-keyboard died on signal 6

:~$ which maliit-keyboard /usr/bin/maliit-keyboard

Why is maliit-keybord died on signal6? How can I debug this?

Michael65589 avatar Sep 23 '21 16:09 Michael65589

Look what happend when I call maliit-keyboard manualy:

:~$ maliit-keyboard wordengine.cpp plugin "/usr/lib/maliit/keyboard2/languages/en/libenplugin.so" loaded PulseAudioService: pa_context_connect() failed PulseAudioService: pa_context_connect() failed "Rejected send message, 2 matched rules; type="method_call", sender=":1.14" (uid=1000 pid=864 comm="maliit-keyboard ") interface="net.connman.Manager" member="GetProperties" error name="(unset)" requested_reply="0" destination="net.connman" (uid=0 pid=780 comm="/usr/sbin/connmand -n ")" "Rejected send message, 2 matched rules; type="method_call", sender=":1.14" (uid=1000 pid=864 comm="maliit-keyboard ") interface="net.connman.Manager" member="GetServices" error name="(unset)" requested_reply="0" destination="net.connman" (uid=0 pid=780 comm="/usr/sbin/connmand -n ")" inputmethod_p.h registerActiveLanguage(): activeLanguage is: "en" in inputMethod.cpp setActiveLanguage() activeLanguage is: "en" inputMethod::reset() in clear preedit.. clearing word engine keyboard is reporting : < 0 -8 0 8 > to the app manager. maliit.connection.wayland: Maliit::Wayland::InputMethod::InputMethod(MInputContextConnection*, wl_registry*, int) zwp_input_method_v1@17: error 0: permission to bind input_method denied The Wayland connection experienced a fatal error: Protocol error Aborted [ 807.474181] audit: type=1701 audit(1632416300.744:9): auid=4294967295 uid=1000 gid=1001 ses=4294967295 pid=864 comm="maliit-keyboard" exe="/usr/bin/maliit-keyboard" sig=6 res=1

I think that "zwp_input_method_v1@17: error 0: permission to bind input_method denied" is the problem.

Michael65589 avatar Sep 23 '21 17:09 Michael65589

I think that "zwp_input_method_v1@17: error 0: permission to bind input_method denied" is the problem.

Yes, as @jpetersen said in https://github.com/maliit/framework/issues/73#issuecomment-925907231 you cannot simply run maliit-keyboard with weston, as it has to be started by weston itself. By default, weston starts its own keyboard, therefore preventing maliit from connecting.

dobey avatar Sep 23 '21 17:09 dobey

Okay, thats the reason of the permission denied problem, but with the entry [input-method] in the weston.ini I thought this let weston start the maliit keyboard. @jpetersen said that I should enter the path to maliit-keyboard binary. http://maliit.github.io/news/2017/05/24/standalone-mode/ tells me that I have to create a script and configure the path to this script in weston.ini

Okay, step by step. I created the maliit-keyboard.sh as descriped in http://maliit.github.io/news/2017/05/24/standalone-mode/ . I put the script to /usr/bin/. I set the permissions to executable for all I set the path to this script in weston.ini at [input-method] key

When I boot my system and weston starts I can see that maliit-keyboard is started as well

>:~$ ps aux | grep maliit
user         704  0.0  0.0   3440   936 ?        S    17:55   0:00 /bin/sh /usr/bin/maliit-keyboard.sh
user         706  1.3  2.2 877436 45120 ?        Sl   17:55   0:00 maliit-keyboard -platform wayland
user         805  0.0  0.1   6336  2080 ttymxc1  S+   17:56   0:00 grep --color=auto maliit

weston.log also tells me that the maliit-keyboard is starte ... [17:55:47.463] Loading module '/usr/lib/weston/desktop-shell.so' [17:55:47.465] launching '/usr/bin/maliit-keyboard.sh' [17:55:47.469] launching '/usr/libexec/weston-desktop-shell' ...

When I start weston-terminal and click into the terminal nothing happens. Why is there no keyboard visible?

I create a simple QT-Application with only one TextInput Field. I set QT_IM_MODULE=Maliit Then I start my application. ... ~$ ./Maliit-Keyboard-Test QML debugging is enabled. Only use this in a safe environment. [ 322.377565] audit: type=1701 audit(1632420060.672:3): auid=1000 uid=1000 gid=1001 ses=1 pid=884 comm="maliit-server" exe="/usr/bin/maliit-server" sig=6 res=1 [ 328.149124] audit: type=1701 audit(1632420066.444:4): auid=1000 uid=1000 gid=1001 ses=1 pid=888 comm="maliit-server" exe="/usr/bin/maliit-server" sig=6 res=1 [ 334.060028] audit: type=1701 audit(1632420072.352:5): auid=1000 uid=1000 gid=1001 ses=1 pid=890 comm="maliit-server" exe="/usr/bin/maliit-server" sig=6 res=1 ...

Why is maliit-server finished with sig=6?

Michael65589 avatar Sep 23 '21 18:09 Michael65589

When I start weston-terminal and click into the terminal nothing happens. Why is there no keyboard visible?

I don't know. It might be trying to use the wrong text input protocol. But I also have not been able to get maliit keyboard to come up under wayland on any compositor running on top of Xorg on my system. I would very much like it to though, because it would make the testing I need to do currently, much easier.

Why is maliit-server finished with sig=6?

I also don't know. Have you tried attaching to the process with gdb and doing whatever is causing it to happen, and getting a stack trace?

dobey avatar Sep 23 '21 18:09 dobey

@jpetersen How is it possible to show the maliit-keyboard when I use wayland with weston? Weston offers a terminal (weston-terminal) and I want to use a virtual keyboard to give input for that terminal. Weston uses the zwp_text_input_manager_v1 and zwp_input_method_v1. Maliit also speak zwp_input_method_v1. The connection between Maliit and Weston is the [input-method] key in the weston.ini. Weston starts maliit-keyboard but what happens when I open the weston-terminal and do a touch click into the terminal. When starts the maliit-server? Should maliit-server start at all? Is there a possibility to trace the input system (zwp_input_method_v1)? I want to monitor the dbus traffic between maliit-server and maliit-keyboard but the maliit-server never starts. Does the maliit-server only start on demand? I can see the maliit-keyboard in the process list but I can't see the maliit-server. Can maliit-server generate log files? I want to know why it breaks.

On the other hand I want to use maliit-keyboard with Qt applications. Does this run out of the box when QT_IM_MODULE is set to Maliit? Thanks

Michael65589 avatar Sep 24 '21 05:09 Michael65589

I set MALIIT_DEBUG=true in my environment. When I start my Qt application: ./Maliit-Keyboard-Test QML debugging is enabled. Only use this in a safe environment. Creating Maliit input context [ 6016.622837] audit: type=1701 audit(1632475329.964:15): auid=1000 uid=1000 gid=1001 ses=1 pid=2233 comm="maliit-server" exe="/usr/bin/maliit-server" sig=6 res=1 MInputContext in virtual void MInputContext::update(Qt::InputMethodQueries) MInputContext in virtual void MInputContext::update(Qt::InputMethodQueries) MInputContext in virtual void MInputContext::setFocusObject(QObject*) QQuickRootItem(0xaaaad8ea78f0) MInputContext in virtual void MInputContext::commit() MInputContext in virtual void MInputContext::update(Qt::InputMethodQueries) virtual void MInputContext::showInputPanel() MInputContext in virtual void MInputContext::setFocusObject(QObject*) QQuickTextInput(0xaaaad8eb1d60) MInputContext void MInputContext::updateInputMethodExtensions() [ 6022.985018] audit: type=1701 audit(1632475336.328:16): auid=1000 uid=1000 gid=1001 ses=1 pid=2236 comm="maliit-server" exe="/usr/bin/maliit-server" sig=6 res=1

And journalctl says: org.maliit.server[2233]: WARNING: Could not find the Qt platform plugin "xcb" in "" org.maliit.server[2233]: FATAL: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. org.maliit.server[2233]: Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland.

So it looks that maliit-server should start as root. Is there a way to start it as user?

Michael65589 avatar Sep 24 '21 09:09 Michael65589

When starts the maliit-server? Should maliit-server start at all?

If maliit-keyboard is being used, then no, maliit-server should not also be started.

Is there a possibility to trace the input system (zwp_input_method_v1)?

You can use the environment variable WAYLAND_DEBUG=1 to get protocol debugging output, I think

I want to monitor the dbus traffic between maliit-server and maliit-keyboard but the maliit-server never starts. Does the maliit-server only start on demand?

If you want to use the DBus protocol for maliit with maliit-server, then maliit-keyboard should not be run. Instead you need to have the correct input method plug-in loaded in the toolkit being used. As before, you can't use both at the same time.

dobey avatar Sep 24 '21 13:09 dobey

So it looks that maliit-server should start as root. Is there a way to start it as user?

It should not, unless you are logging into a graphical session as root. It should be run as the user if you are using maliit-server instead of maliit-keyboard.

dobey avatar Sep 24 '21 13:09 dobey

Hi dobey, thanks for reply. You wrote "If maliit-keyboard is being used, then no, maliit-server should not also be started." When I set maliit-keyboard in weston.ini the maliit-keyboard starts at boot time. If I open a Qt application and set QT_IM_MODULE=Maliit and click on a text-input field then the org.maliit.server.service in /usr/shar/dbus-1/services is starting. And inside the org.maliit.server.service is a Exec=/usr/bin/maliit-server. So everytime when I click on a text-input-field someone wants to start maliit-server. If I understand you in the right way there is no need of starting the maliit-server when maliit-keyboard is already running. But who overlay the keyboard on the screen? maliit-keyboard itself? How does it work? Is there a possibility to show the keyboard by sending a d-bus command?

Michael65589 avatar Sep 24 '21 14:09 Michael65589

QT_IM_MODULE=Maliit and click on a text-input field then the org.maliit.server.service in /usr/shar/dbus-1/services is starting.

Is this also running your app with QT_QPA_PLATFORM=wayland so that it runs under weston? Or is the app coming up externally under whatever your login session is?

But who overlay the keyboard on the screen? maliit-keyboard itself?

Yes. It should be using the Wayland protocol, as should any app running under weston.

Is there a possibility to show the keyboard by sending a d-bus command?

Yes, that's what maliit-server is for. You would run that instead of maliit-keyboard when starting weston.

dobey avatar Sep 24 '21 14:09 dobey

QT_IM_MODULE=Maliit is for a DBus based input method communication between application and virtual keyboard for X11. For Wayland you want to run your Qt application with an unset QT_IM_MODULE.

In this case the Wayland input method protocol is used for communication between application, compositor and virtual keyboard. DBus is not used at all in this case.

jpetersen avatar Sep 24 '21 14:09 jpetersen

Yes my app is running with QT_QPA_PLATFROM=wayland and yes it runs under weston.

Michael65589 avatar Sep 24 '21 14:09 Michael65589

@jpetersen: Ok, I did a unset QT_IM_MODULE and start my application. The lucky thing is I got no error messages. The sad thing is that nothing happen when I click into the text-input-field

Michael65589 avatar Sep 24 '21 14:09 Michael65589

I can only suggest using WAYLAND_DEBUG=1 and maybe grep for zwp_input_method or zwp_text_input

jpetersen avatar Sep 24 '21 14:09 jpetersen

Okay, I unset QT_IM_MODULE, maliit-keyboard is running. I set WAYLAND_DEBUG=1 and start my application. A lot of messages are print out. The only matches with zwp_input_method or zwp_text_input are:

[3932774.427] [email protected](21, "zwp_input_method_v1", 1) [3932774.452] [email protected](22, "zwp_text_input_manager_v1", 1)

[3933144.274] [email protected](21, "zwp_input_method_v1", 1) [3933144.311] [email protected](22, "zwp_text_input_manager_v1", 1)

When I click into my text-input-field a lot of messages are print out: [4154174.990] [email protected](35, wl_surface@16, 65.437500, 97.335938) [4154175.261] -> [email protected]_pool(new id wl_shm_pool@22, fd 18, 4096) [4154175.550] -> [email protected](8832) [4154175.654] -> [email protected](18624) [4154175.722] -> [email protected]_buffer(new id wl_buffer@28, 4032, 10, 16, 40, 0) [4154175.800] -> [email protected]_surface(new id wl_surface@33) [4154175.841] -> [email protected]_cursor(35, wl_surface@33, 1, 1) [4154175.890] -> [email protected]_buffer_scale(1) [4154175.912] -> [email protected](wl_buffer@28, 0, 0) [4154175.951] -> [email protected](0, 0, 10, 16) [4154175.996] -> [email protected]() [4154176.026] [email protected]() [4154176.072] [email protected](36) [4154176.098] -> [email protected](36) [4154176.121] [email protected](268315, 65.437500, 97.335938) [4154176.175] [email protected]() [4154176.647] [email protected](wl_output@12) [4154176.704] -> [email protected]_buffer_scale(1) [4154176.731] -> [email protected](wl_buffer@28, 0, 0) [4154176.772] -> [email protected](0, 0, 10, 16) [4154176.818] -> [email protected]() [4154224.844] [email protected](37, 268316, 272, 1) [4154224.936] [email protected]() [4154224.981] [email protected](38, 268365, 272, 0) [4154225.030] [email protected](39) [4154225.054] -> [email protected](39) [4154225.081] [email protected]() [4154234.421] -> [email protected](new id wl_callback@27) [4154234.664] -> [email protected]_acquire_fence(fd 17) [4154234.724] -> [email protected]_release(new id zwp_linux_buffer_release_v1@34) [4154234.771] [email protected]_release(fd 14) [4154234.828] [email protected](33) [4154234.856] -> [email protected]_tile_status(wl_buffer@24, 1, 0, 1, 0, 0) [4154234.930] -> [email protected](wl_buffer@24, 0, 0) [4154234.970] -> [email protected](0, 0, 646, 513) [4154235.016] -> [email protected]() [4154235.034] -> [email protected](new id wl_callback@29) [4154235.390] [email protected]_id(32) [4154235.427] [email protected]_id(29) [4154245.310] [email protected]_id(27) [4154245.359] [email protected](268382) [4154752.116] -> [email protected](new id wl_callback@27) [4154752.290] -> [email protected]_acquire_fence(fd 18) [4154752.337] -> [email protected]_release(new id zwp_linux_buffer_release_v1@23) [4154752.385] [email protected]_release(fd 14) [4154752.433] [email protected](39) [4154752.459] -> [email protected]_tile_status(wl_buffer@30, 1, 0, 1, 0, 0) [4154752.542] -> [email protected](wl_buffer@30, 0, 0) [4154752.583] -> [email protected](0, 0, 646, 513) [4154752.629] -> [email protected]() [4154752.649] -> [email protected](new id wl_callback@29) [4154752.961] [email protected]_id(34)

but no lines with zwp_input_method or zwp_text_input.

@jpetersen: Is it right that I do not need the d-bus support when I use wayland? Should I disable the d-bus activation option during build?

Thanks a lot

Michael65589 avatar Sep 24 '21 15:09 Michael65589

I think the issue is different supported protocol versions for compositor, apps and virtual keyboard: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/39#implementation-matrix

jpetersen avatar Sep 24 '21 15:09 jpetersen

I think the issue is different supported protocol versions for compositor, apps and virtual keyboard: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/39#implementation-matrix

I think that page is outdated. Also, Weston, kwin_wayland, and Qt seem to all be able to do text-input v1 and input-method v1, and both are supported by maliit-framework as well. And maliit-keyboard is clearly working via wayland protocol on manjaro-pm images with kwin_wayland. However, I'm unable to get maliit-keyboard to appear when running it under kwin_wayland, running in a window under an Xorg session, on my PC.

I still have no idea why.

dobey avatar Sep 24 '21 15:09 dobey

@jpetersen: You mean because of Qt only supports qt-text-input-method and weston doesn't it would not work, isn't it? After so much input from you alll is there any suggestion for my requirements from you? I want to use weston as compositor. Furthermore I want to use weston-terminal and my own qt-applications. And at least I want to have a virtual keyboard to control this applications and weston-terminal as well. I thought Maliit is a good choice but meanwhile I am not sure. What are my possibilities? Or should I use a Qt-compositor and write my own terminal application?

Michael65589 avatar Sep 24 '21 16:09 Michael65589

@dobey What do you use as virtual keyboard?

Are there no interests to get Maliit-Keyboard working on Wayland?

Michael65589 avatar Sep 28 '21 04:09 Michael65589

@dobey What do you use as virtual keyboard?

Are there no interests to get Maliit-Keyboard working on Wayland?

Mallit works on Wayland but Weston is using outdated protocols compared to other Wayland compositors.

jpetersen avatar Sep 28 '21 07:09 jpetersen

@jpetersen Thanks for reply. So I think it is useful to use Qt as compositor if 90% of all applications are Qt applications. What do you think? But if I use Qt as compositor I can use Maliit?

Michael65589 avatar Sep 28 '21 07:09 Michael65589

@dobey What do you use as virtual keyboard?

Are there no interests to get Maliit-Keyboard working on Wayland?

I don't use an OSK on my PC. On my pinephone I have Plasma Mobile which uses Maliit with kwin_wayland. It works fine there. However, I have not been able to get it working on my PC when trying to use kwin_wayland in a window for testing; even when trying to use the dbus protocol for maliit rather than Wayland.

Obviously there is interest in fixing these issues, but I have apparently no idea what's going wrong, or how to figure it out exactly.

dobey avatar Sep 28 '21 15:09 dobey