Repository navigation
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
qFlipper is unable to connect to the Flipper Zero on Linux (Fedora 36) showing a "Permission Denied" error even though all the perimissions/udev rules are set correctly.
To Reproduce
Steps to reproduce the behavior:
- Download qFlipper version 1.2.2
- Install the udev rules
./qFlipper-x86_64-1.2.2.AppImage rules installas described in the UI - Start qFlipper (gui mode)
- Connect the Flipper and wait
Expected behavior
Flipper should connect without issues
Actual behavior
"Permission Denied" occurs
Additional troubleshooting
- I tried updating the Firmware via Bluetooth but the latest Firmware ("Release") didn't fix the issue.
- I tried restarting the Flipper zero multiple times and it didn't work
- Omitting all Hubs (connecting directly to the PC) didn't work
- Testing with picocom
picocom /dev/ttyACM0showed the Flipper Zero serial cli. Therefor a permission error is unlikely otherwise picocom should also fail. - Giving my user the
dialoutrole and logging in again. - I checked the issue tracker and found that this issue is usually related to missing udev rules, so I made sure they are installed and even ran the
sudo udevadm control --reload-rules && sudo udevadm triggermanually again to make sure they are loaded. - I disabled Bluetooth on the Flipper Zero (Point 1. in the "How to fix")
The report must also include at least one of the following:

LOG:
488 [APP] qFlipper version 1.2.2 commit ba67025d 2022-12-08T13:31:11
488 [APP] OS info: Fedora Linux 36 (KDE Plasma) 36 6.0.12-200.fc36.x86_64 Qt 5.15.2
502 [REG] Detected new device: VID_0x483:PID_0x5740
615 [DBG] Trying serial port at /dev/ttyACM0
615 [DBG] Trying serial port at /dev/ttyS0
615 [UPD] Fetched update information from https://update.flipperzero.one/firmware/directory.json
616 [UPD] Fetched update information from https://update.flipperzero.one/qFlipper/directory.json
648 [DBG] Trying serial port at /dev/ttyACM0
648 [DBG] Trying serial port at /dev/ttyS0
<Omitted because the same 2 lines ("Trying serial port") are repeated 99 times in the log>
3964 [DBG] Trying serial port at /dev/ttyACM0
3964 [DBG] Trying serial port at /dev/ttyS0
3981 [REG] Device initialization failed: Failed to find a suitable serial port
Reacted by Chiara Marcial Martínez
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
gsurkov commentedon Jan 4, 2023
Judging by the log, it's still some sort of a weird permission issue (the port
/dev/ttyACM0has an empty serial number).Please try running the development version and post the log here again.
The development version has an improved permission checking and error reporting, so it might help narrow down the problem.
VoidField101 commentedon Jan 4, 2023
I'm getting the same error
PS: Putting the Device into DFU / Recovery mode does actually work and let's me connect. Normal mode doesn't.
Also checked the permissions on the
/dev/ttyACM0devicefile. Owned byroot, Group:dialoutwith a ACL set to allow read & write from any logged in user, just like the udev file is configured.gsurkov commentedon Jan 4, 2023
Was worth a try. It does also look weird to me that it tries to open
/dev/ttyS0, but that might be nothing.Just for the completeness' sake, please give me the output of
lsusb -d483:5740 -v(run it as a normal user while Flipper is connected and is NOT in dfu mode). Especially please pay attention to any errors.I'll set up a test environment to see if it will be possible to reproduce this problem.
VoidField101 commentedon Jan 4, 2023
Here is the full lsusb output:
I also did a bit more debugging. The
QSerialPortInfodoesn't seem to carry theserialNumber()as you mentioned (just an empty string) but it does carry somevendorIdentifier()andproductIdentifier()(VID: 0x1022, PID: 0x129C) which don't match the USB device.However doing a manual check in the
sysfilesytem (without sudo):I'm not sure, looks like a QT bug as it don't read the correct serial information.
gsurkov commentedon Jan 4, 2023
Thanks for providing the info, the lsusb output is looking perfectly healthy.
I was also starting to think about Qt being the culprit here, but the only version I can think of is that its version supplied inside the AppImage is somehow incompatible with Fedora 36 kernel or other system software (no idea how, though).
These might be the numbers for the
/dev/ttyS0port.qFlipper detects Flippers first using the libusb hotplug events (where it reads the device's serial number), then it uses Qt to get a list of ports and find the corresponding one using the serial number it had read earlier. During the second stage, all
QSerialPortInfos are therefore checked for a match. The question is - why doesn't Qt load the serial number for the Flipper's port.If you are able to compile qFlipper from sources (or install a pre-built version which links to the system libraries), you might try doing so and see if it works then. If it does, it certainly looks like a compatibility issue.
gsurkov commentedon Jan 4, 2023
UPD:
I ran a Fedora 36 KDE LiveCD (which should be close enough to your OS, based on the OS info from the log) and was not able to reproduce this issue. The port could be opened and found without problems, as well as its serial number. So it might not be a compatibility issue, after all.
VoidField101 commentedon Jan 4, 2023
That's the way I found the issue with the serial port information being completely wrong. I ran the project in QT Creator and added a few extra debug lines in the SerialFinder to output all the SerialPortInfo for every port.
Since
ttyS0is a internal serial port on the mainboard it has no vendor or product information attached (both read as 0)By hardcoding the check that
/dev/ttyACM0is correct (checking for systemLocation rather than the serialNumber) I got it to connect but it's obviously not a good solution.VoidField101 commentedon Jan 4, 2023
I was able to pinpoint the issue to the
systemd-udev-250.9-1.fc36.x86_64package in Fedora.To be exact it provides a file
/usr/lib/udev/rules.d/60-serial.ruleswhich contains the following line (Line 6):So it seems to override the Vendor and Model ID when the pci subsystem is involved which it is because the USB controller is connected to PCI.
Commenting this line out and reloading the udev rules fixed the issue, however this is only a temporary solution since this file is managed by the package and will be overwritten by an update. I'll try and figure something out using a separate udev rule.
gsurkov commentedon Jan 4, 2023
Fantastic detective work!
If I remember correctly, rule files from
/etc/udev/rules.dtake precedence over those situated in/usr/lib/udev/rules.d, so you may place the edited version of the file there.VoidField101 commentedon Jan 4, 2023
My current working fix includes a override for all the values in a file called
99-flipperzero.rulesand in the
42-flipperzero.rulesI just added aTAG+="flipperzero". This seems to work and override all the PCI values with the USB values again.justafren commentedon Jan 5, 2023
I came across this same issue this evening and your current working fix worked a treat. Thank you for saving me hours of debugging @VoidField101. I appreciate you big dawg
gsurkov commentedon Jan 6, 2023
@theshrewformallyknownasdrew is it an issue caused by a package update or was it always there?
justafren commentedon Jan 6, 2023
First time install of qflipper. Fedora 36 and qflipper 1.2.2.
cofuente commentedon Aug 19, 2023
I believe I have a similar problem but I'm running 64 bit Ubuntu 22.04.3 LTS. If creating a rules file is a solution, can we get more details on what exactly to put on the file?