Re: sudo 4.6.4 Aborted
On domingo, 14 de maio de 2017 21:20:01 PDT Martin Měřinský wrote: > sudo subsurface divelog.xml > [sudo] password for mermar: > QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime- > root' > No protocol specified > QXcbConnection: Could not connect to display :0 > Aborted (core dumped) Your X server refused the connection. Best solution: don't use sudo. In fact, don't run Subsurface as root. Why were you trying this? -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel Open Source Technology Center ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Sun, 2017-05-14 at 21:32 -0700, Thiago Macieira wrote: > On domingo, 14 de maio de 2017 21:20:01 PDT Martin Měřinský wrote: > > sudo subsurface divelog.xml > > [sudo] password for mermar: > > QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to > > '/tmp/runtime- > > root' > > No protocol specified > > QXcbConnection: Could not connect to display :0 > > Aborted (core dumped) > > Your X server refused the connection. New info: happens only with Wayland. Under X, it requests for -- allow_run_as_root and with this option it works. > Best solution: don't use sudo. In fact, don't run Subsurface as root. > > Why were you trying this? Because importing dives from DC doesn't work for me as a user. So for the short moment I run Subsurface as a root. I tried, what manual says, but it didn't work. sudo usermod -a -G dialout mermar sudo usermod -a -G uucp mermar subsurface divelog.2017-04-10.xml Insufficient privileges to open the device /dev/ttyUSB0 Suunto (HelO2) Logout & login. subsurface divelog.2017-04-10.xml Insufficient privileges to open the device /dev/ttyUSB0 Suunto (HelO2) [0.82] ERROR: Permission denied (13) [in serial_posix.c:177 (dc_serial_open)] [0.000139] ERROR: Failed to open the serial port. [in suunto_vyper2.c:101 (suunto_vyper2_device_open)] Martin M. ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Sun, May 14, 2017 at 09:32:45PM -0700, Thiago Macieira wrote: > On domingo, 14 de maio de 2017 21:20:01 PDT Martin Měřinský wrote: > > sudo subsurface divelog.xml > > [sudo] password for mermar: > > QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime- > > root' > > No protocol specified > > QXcbConnection: Could not connect to display :0 > > Aborted (core dumped) > > Your X server refused the connection. > > Best solution: don't use sudo. In fact, don't run Subsurface as root. > > Why were you trying this? Good question. But I'd like to point out that Subsurface shouldn't crash when it can't open the display. I'll fix that part :-) /D ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Sun, May 14, 2017 at 09:43:49PM -0700, Dirk Hohndel wrote: > On Sun, May 14, 2017 at 09:32:45PM -0700, Thiago Macieira wrote: > > On domingo, 14 de maio de 2017 21:20:01 PDT Martin Měřinský wrote: > > > sudo subsurface divelog.xml > > > [sudo] password for mermar: > > > QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime- > > > root' > > > No protocol specified > > > QXcbConnection: Could not connect to display :0 > > > Aborted (core dumped) > > > > Your X server refused the connection. > > > > Best solution: don't use sudo. In fact, don't run Subsurface as root. > > > > Why were you trying this? > > Good question. > > But I'd like to point out that Subsurface shouldn't crash when it can't > open the display. I'll fix that part :-) Ah, apparently this is a Qt bug that was declared not a bug at some point (you can find quite a few threads about this), and the way to work around it is to implement your own Logger class and exit() instead of abort() when you get a "Could not connect to display error". Not one of the more useful aspects of Qt, I'd like to add... /D ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Mon, May 15, 2017 at 06:43:36AM +0200, Martin Měřinský wrote: > > New info: happens only with Wayland. Under X, it requests for -- > allow_run_as_root and with this option it works. I was going to ask you about that as that's the error I get. I wonder why you don't get that under Wayland... but realistically, we should fix the reason you run as root in the first place. > Because importing dives from DC doesn't work for me as a user. So for > the short moment I run Subsurface as a root. > > I tried, what manual says, but it didn't work. > > sudo usermod -a -G dialout mermar > sudo usermod -a -G uucp mermar > > subsurface divelog.2017-04-10.xml > Insufficient privileges to open the device /dev/ttyUSB0 Suunto (HelO2) Can you send us the output of ls -l /dev/ttyUSB0 that should tell us why you aren't able to open it. /D ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On domingo, 14 de maio de 2017 21:52:56 PDT Dirk Hohndel wrote: > Ah, apparently this is a Qt bug that was declared not a bug at some point > (you can find quite a few threads about this), and the way to work around > it is to implement your own Logger class and exit() instead of abort() > when you get a "Could not connect to display error". > > Not one of the more useful aspects of Qt, I'd like to add... Unfortunately, exit() is often harmful in C++ programs, since the global & atexit destructors are run, but the stack hasn't been unwound so objects in the main() function continue to exist. This breaks a number of assumptions about the order in which things are destroyed (namely, that it is the opposite in which they were constructed). Using _exit() might help, but it may bring its own set of problems. At least it's closer to the qFatal call that is there now. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel Open Source Technology Center ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
> we should fix the reason you run as root in the first place. > > > Because importing dives from DC doesn't work for me as a user. So > > for > > the short moment I run Subsurface as a root. > > > > I tried, what manual says, but it didn't work. > > > > sudo usermod -a -G dialout mermar > > sudo usermod -a -G uucp mermar > > > > subsurface divelog.2017-04-10.xml > > Insufficient privileges to open the device /dev/ttyUSB0 Suunto > > (HelO2) > > Can you send us the output of > > ls -l /dev/ttyUSB0 crw-rw 1 root dialout 188, 0 kvě 15 08:21 /dev/ttyUSB0 ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On domingo, 14 de maio de 2017 23:22:55 PDT Martin Měřinský wrote: > > we should fix the reason you run as root in the first place. > > > > > Because importing dives from DC doesn't work for me as a user. So > > > for > > > the short moment I run Subsurface as a root. > > > > > > I tried, what manual says, but it didn't work. > > > > > > sudo usermod -a -G dialout mermar > > > sudo usermod -a -G uucp mermar > > > > > > subsurface divelog.2017-04-10.xml > > > Insufficient privileges to open the device /dev/ttyUSB0 Suunto > > > (HelO2) > > > > Can you send us the output of > > > > ls -l /dev/ttyUSB0 > > crw-rw 1 root dialout 188, 0 kvě 15 08:21 /dev/ttyUSB0 And did you log out and then back in after running the usermod command? Check that the "id" command shows dialout. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel Open Source Technology Center ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Sun, 2017-05-14 at 23:54 -0700, Thiago Macieira wrote: > On domingo, 14 de maio de 2017 23:22:55 PDT Martin Měřinský wrote: > > > we should fix the reason you run as root in the first place. > > > > > > > Because importing dives from DC doesn't work for me as a user. > > > > So > > > > for > > > > the short moment I run Subsurface as a root. > > > > > > > > I tried, what manual says, but it didn't work. > > > > > > > > sudo usermod -a -G dialout mermar > > > > sudo usermod -a -G uucp mermar > > > > > > > > subsurface divelog.2017-04-10.xml > > > > Insufficient privileges to open the device /dev/ttyUSB0 Suunto > > > > (HelO2) > > > > > > Can you send us the output of > > > > > > ls -l /dev/ttyUSB0 > > > > crw-rw 1 root dialout 188, 0 kvě 15 08:21 /dev/ttyUSB0 > > And did you log out and then back in after running the usermod > command? I did. > Check that the "id" command shows dialout. Seems OK. id mermar uid=1000(mermar) gid=1000(mermar) groups=1000(mermar),4(adm),10(uucp),20(dialout),24(cdrom),27(sudo),30(d ip),46(plugdev),118(lpadmin),128(sambashare) ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Mon, May 15, 2017 at 09:05:03AM +0200, Martin Měřinský wrote: > On Sun, 2017-05-14 at 23:54 -0700, Thiago Macieira wrote: > > On domingo, 14 de maio de 2017 23:22:55 PDT Martin Měřinský wrote: > > > > we should fix the reason you run as root in the first place. > > > > > > > > > Because importing dives from DC doesn't work for me as a user. > > > > > So > > > > > for > > > > > the short moment I run Subsurface as a root. > > > > > > > > > > I tried, what manual says, but it didn't work. > > > > > > > > > > sudo usermod -a -G dialout mermar > > > > > sudo usermod -a -G uucp mermar > > > > > > > > > > subsurface divelog.2017-04-10.xml > > > > > Insufficient privileges to open the device /dev/ttyUSB0 Suunto > > > > > (HelO2) > > > > > > > > Can you send us the output of > > > > > > > > ls -l /dev/ttyUSB0 > > > > > > crw-rw 1 root dialout 188, 0 kvě 15 08:21 /dev/ttyUSB0 > > > > And did you log out and then back in after running the usermod > > command? > > I did. > > > Check that the "id" command shows dialout. > > Seems OK. > > id mermar > uid=1000(mermar) gid=1000(mermar) > groups=1000(mermar),4(adm),10(uucp),20(dialout),24(cdrom),27(sudo),30(d > ip),46(plugdev),118(lpadmin),128(sambashare) So this user is allowed to read and write /dev/ttyUSB0 If you run Subsurface as this user, do you still get the error you described earlier? That seems somewhat unlikely /D ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Sun, May 14, 2017 at 10:01:34PM -0700, Thiago Macieira wrote: > On domingo, 14 de maio de 2017 21:52:56 PDT Dirk Hohndel wrote: > > Ah, apparently this is a Qt bug that was declared not a bug at some point > > (you can find quite a few threads about this), and the way to work around > > it is to implement your own Logger class and exit() instead of abort() > > when you get a "Could not connect to display error". > > > > Not one of the more useful aspects of Qt, I'd like to add... > > Unfortunately, exit() is often harmful in C++ programs, since the global & > atexit destructors are run, but the stack hasn't been unwound so objects in > the main() function continue to exist. This breaks a number of assumptions > about the order in which things are destroyed (namely, that it is the > opposite > in which they were constructed). > > Using _exit() might help, but it may bring its own set of problems. At least > it's closer to the qFatal call that is there now. I understand that. For us as a user of the library, though, having the app crash on something as trivial as not being able to connect to the display, that does seem a bit crude. /D ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On segunda-feira, 15 de maio de 2017 06:38:51 PDT Dirk Hohndel wrote: > I understand that. For us as a user of the library, though, having the app > crash on something as trivial as not being able to connect to the display, > that does seem a bit crude. I know. It's a side-effect of not using exceptions: we have no way of reporting that the connection failed, aside from aborting the application. Would a change to _exit help? -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel Open Source Technology Center ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
> On May 15, 2017, at 8:32 AM, Thiago Macieira wrote: > > On segunda-feira, 15 de maio de 2017 06:38:51 PDT Dirk Hohndel wrote: >> I understand that. For us as a user of the library, though, having the app >> crash on something as trivial as not being able to connect to the display, >> that does seem a bit crude. > > I know. It's a side-effect of not using exceptions: we have no way of > reporting that the connection failed, aside from aborting the application. > > Would a change to _exit help? The app reporting an error and calling _exit() (which means no "crash" message to the user) would be preferable in my view. /D ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On segunda-feira, 15 de maio de 2017 08:40:38 PDT Dirk Hohndel wrote: > > On May 15, 2017, at 8:32 AM, Thiago Macieira wrote: > > > > On segunda-feira, 15 de maio de 2017 06:38:51 PDT Dirk Hohndel wrote: > >> I understand that. For us as a user of the library, though, having the > >> app > >> crash on something as trivial as not being able to connect to the > >> display, > >> that does seem a bit crude. > > > > I know. It's a side-effect of not using exceptions: we have no way of > > reporting that the connection failed, aside from aborting the application. > > > > Would a change to _exit help? > > The app reporting an error and calling _exit() (which means no "crash" > message to the user) would be preferable in my view. I think I can justify that change. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel Open Source Technology Center ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: sudo 4.6.4 Aborted
On Mon, 2017-05-15 at 06:37 -0700, Dirk Hohndel wrote: > On Mon, May 15, 2017 at 09:05:03AM +0200, Martin Měřinský wrote: > > On Sun, 2017-05-14 at 23:54 -0700, Thiago Macieira wrote: > > > On domingo, 14 de maio de 2017 23:22:55 PDT Martin Měřinský > > > wrote: > > > > > we should fix the reason you run as root in the first place. > > > > > > > > > > > Because importing dives from DC doesn't work for me as a > > > > > > user. > > > > > > So > > > > > > for > > > > > > the short moment I run Subsurface as a root. > > > > > > > > > > > > I tried, what manual says, but it didn't work. > > > > > > > > > > > > sudo usermod -a -G dialout mermar > > > > > > sudo usermod -a -G uucp mermar > > > > > > > > > > > > subsurface divelog.2017-04-10.xml > > > > > > Insufficient privileges to open the device /dev/ttyUSB0 > > > > > > Suunto > > > > > > (HelO2) > > > > > > > > > > Can you send us the output of > > > > > > > > > > ls -l /dev/ttyUSB0 > > > > > > > > crw-rw 1 root dialout 188, 0 kvě 15 08:21 /dev/ttyUSB0 > > > > > > And did you log out and then back in after running the usermod > > > command? > > > > I did. > > > > > Check that the "id" command shows dialout. > > > > Seems OK. > > > > id mermar > > uid=1000(mermar) gid=1000(mermar) > > groups=1000(mermar),4(adm),10(uucp),20(dialout),24(cdrom),27(sudo), > > 30(d > > ip),46(plugdev),118(lpadmin),128(sambashare) > > So this user is allowed to read and write /dev/ttyUSB0 > > If you run Subsurface as this user, do you still get the error you > described earlier? That seems somewhat unlikely After restart, it works. Thank you :-) Wouldn't it be better, to add users to correct group automatically? Maybe during install. Somehow similar to Wireshark setup Linux for nonroot user. M. ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface