Bug 217438 - kernelshark: QLocalSocket::connectToServer: Connection refused
Summary: kernelshark: QLocalSocket::connectToServer: Connection refused
Status: NEW
Alias: None
Product: Tools
Classification: Unclassified
Component: Trace-cmd/Kernelshark (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: Default virtual assignee for Trace-cmd and kernelshark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-12 23:28 UTC by Vitaly Chikunov
Modified: 2023-05-17 17:44 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Vitaly Chikunov 2023-05-12 23:28:33 UTC
In ALT we have `TMPDIR` set for all users (including root) to `/tmp/.private/$USER`, this is intended to improve security as these dirs are completely isolated (by o-rwx permissions) for each user.

As a consequence `KSCapture` socket is created in user's dir (such as `/tmp/.private/vt/KSCapture`) and `pkexec`'d `kshark-record` tries to connect to `/tmp/.private/root/KSCapture` which does not exist, and this causes Capture error:
```
QLocalSocket::connectToServer: Connection refused
(maybe KernelShark GUI is not open)
```

I wonder what is best solution would be to solve this problem (and not extremely familiar with `QLocalSocket` either). Do you have any suggestions?

Previously I was changing these calls:

  src/KsCaptureDialog.cpp:624:    socket->connectToServer("KSCapture", QIODevice::WriteOnly);
  src/KsMainWindow.cpp:1523:      _captureLocalServer.listen("KSCapture");

to use "/tmp/KSCapture", since `/tmp` is expected there anyway.
Comment 1 Yordan Karadzhov 2023-05-17 17:44:13 UTC
Hi Vitaly,

This sounds to me more like a very user-specific corner-case. Note that the Capture dialog is meant to be more like a simplistic introduction tool for new users. If you want to do something more advanced you betere user directly trace-cmd and later open the file in kernelshark.

cheers,
Y.

Note You need to log in before you can comment on or make changes to this bug.