USB 3 NVMe SSD dongle doesn't flip

Bug #1878921 reported by Cedric Rochefolle
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
usb-modeswitch-data (Ubuntu)
In Progress
High
Unassigned

Bug Description

I have a AM8180 AMicro adapter. It is an adapter for an M.2 SSD NVMe disk to USB 3. It works fine on Windows, but on Ubuntu, when I plug it in, the drive shows for a second then disappears. If I try to do fdisk or gparted, it seems to lock something and I can't shutdown the laptop (it is stuck on the Disk Management Unmounting step.

My info:
1) Release:
Description: Ubuntu 20.04 LTS
Release: 20.04

2) Package version:
usb-modeswitch:
  Installed: 2.5.2+repack0-2ubuntu3
  Candidate: 2.5.2+repack0-2ubuntu3
  Version table:
 *** 2.5.2+repack0-2ubuntu3 500
        500 http://th.archive.ubuntu.com/ubuntu focal/main amd64 Packages

3) What I expect to happen:
I expect the drive to stay mounted

4) What happened instead:
The disk is mounted then immediately unmount. Before I create the partitions in Windows, nothing mounted but the disk briefly appeared in the Disk Manager.

Attached is my (filtered) syslog when I plug to the USB-C (notice the message advising to tell the developers about the model. Maybe it's just vendor info missing).

I have modified 2 flags in /etc/usb_modeswitch.conf:
- DisableSwitching=0 changed to 1
- #SetStorageDelay=4 changed to un-commented
then restarted. That didn't help.

Tags: patch
Revision history for this message
Cedric Rochefolle (jscdroiddev) wrote :
Revision history for this message
Josua Dietze (digidietze) wrote :

That USB ID is in fact in the 'data base' of usb_modeswitch. It was originally used for the Philips PicoPix 1020 Projector.

That's what you get when the same USB ID is used for multiple unrelated devices ...

The clean solution would be to use additional USB attributes to try and tell the projector apart from your storage adapter. I'll look around to see if I can find a detailed lsusb output.

However:
Enabling the global switch "DisableSwitching" *should* have solved the problem for you. If it didn't then there might be a problem with the Ubuntu fork of the usb_modeswitch_dispatcher.

Changed in usb-modeswitch (Ubuntu):
status: New → Confirmed
Revision history for this message
Josua Dietze (digidietze) wrote :

I have found a detailed lsusb listing for the Pico Pix 1120. Now we need to compare it to the listing of your device *before* the mode switch.

Cedric, could you post such a listing svp?

You can disable usb_modeswitch the hard way by renaming usb_modeswitch_dispatcher. It usually sits in /usr/sbin but you want to check if that is correct for Ubuntu as well.

Then run "sudo mv /usr/sbin/usb_modeswitch_dispatcher /usr/sbin/usb_modeswitch_dispatcher.off"

Now insert your adapter and then run "sudo lsusb -v -d 1de1:1101". Attach the output as a text file here please.

Revision history for this message
Cedric Rochefolle (jscdroiddev) wrote :

Thank you for looking at this. I have used the config file to disable the device then connected the adapter. Somehow it worked. Maybe I did something wrong before.
Attaching the output, which shows a "Generic Display Device (Mass storage mode)" product.

Revision history for this message
Josua Dietze (digidietze) wrote :

Thanks for the lsusb output!
It enabled me to provide a solution.

usb_modeswitch can check for additional attributes beside the USB ID, precisely *because* of those IDs being re-used for different devices. The original idea was to have one ID for each device model or at least for one series of devices which are behaving alike. Manufacturers are messing this up occasionally though.

Fortunately, the previous devices with the ID 1de1:1101 have a specific entry for the attribute "iManufacturer". It's "actions" for the Pico Pix and "action" for the picture frame.

Your device has "AMicro". So for the solution of the problem, the only thing that needs to be done is RENAMING usb_modeswitch's configuration file named "1de1:1101" to "1de1:1101:uMa=action".
This will make usb_modeswitch work for the previous devices but ignore your device.

So this is all the maintainers of the "usb-modeswitch-data" package have to do:
In /usr/share/usb_modeswitch unpack the file "configPack.tar.gz". Rename the file "1de1:1101" as described. Repack the file.

I will do the same upstream, but since Ubuntu seems to be a bit slow with incorporating updated packages of usb-modeswitch-data, maintainers may want to patch the currently used version.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "solution.txt" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Cedric Rochefolle (jscdroiddev) wrote :

That worked, thank you.
I reset to 0 the DisableSwitching configuration /etc/usb_modeswitch.conf
Then I unpack, renamed re-packed the configPack.tar.gz
I inserted the device and it works fine.
Should I submit a request to the "usb-modeswitch-data" package maintainer or did you mention you will do it?

Revision history for this message
Josua Dietze (digidietze) wrote :

Well, I suppose the maintainers are following this bug report, or at least they should.

Upstream has confirmed the bug and provided a solution.

Revision history for this message
Sebastien Bacher (seb128) wrote :

> Upstream has confirmed the bug and provided a solution.

Could you provide the reference to the upstream discussion? is that a bug report or commit?

Revision history for this message
Josua Dietze (digidietze) wrote :

I was unclear, sorry.

I'm referring to this very bug report. Upstream is me :-)

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Josua, thanks for carring/helping triaging and debugging issues there. I've a question for you, you wrote

> Ubuntu seems to be a bit slow with incorporating updated packages of usb-modeswitch-data

Could you give some details about that? The package comes from Debian but I checked now and we seem to have the current version? Or our tracking system needs to be updated since it points to https://www.draisberghof.de/usb_modeswitch/ which has 'Download the usb-modeswitch-data package (2019-11-28, md5: e8fce7eb949cbe16c61fb71bade4cc17).' in the download section. Is there newer releases available?

Changed in usb-modeswitch (Ubuntu):
importance: Undecided → High
status: Confirmed → In Progress
Revision history for this message
Josua Dietze (digidietze) wrote :

@Sebastian, I am happy to correct myself in that Ubuntu is obviously NOT generally slow in picking up the latest update of the data package. You do have the current version now.

I was rather referring to earlier LTS releases. I'm not even sure if that's still the case with recent LTS versions.

Fact is that the data package is usually easy to update, having had no incompatibilities with earlier ones for several years now. Much easier than backporting stuff in the kernel.

However, even as I'm preparing an update right now, it may take a while until it's in the Debian repository. So I'd suggest to make the little change in the Ubuntu package preemptively.

It's totally up to the maintainers though.

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Josua, you are right that updates might lack behind, especially for stable Ubuntu series where we don't get updates synced from Debian. We currently don't have someone actively watching usb-modeswitch stack but I'm going to try to deal with issues and updates when I noticed that work needed.

The data package does sound like something we should keep updated in the LTS.

Is there a public Vcs upstream? I wanted to check if things like bug #1823540 are maybe resolved there but I'm failing to navigate my way around the website to find the code location

Revision history for this message
Josua Dietze (digidietze) wrote :

Unfortunately, no VCS. However, there is a little helper link that can be monitored and which is up to date, including download link and MD5:

https://draisberghof.de/usb_modeswitch/usb-modeswitch-versions.xml

Regarding bug #1823540, that's a case with an issue similar to this one.
05c6:1000 is a *very* generic USB ID, and so is the "Qualcomm" entry in the "iManufacturer" attribute. Both are used in countless devices.

We have to be quite careful not to break things for users of existing devices. I will have a look.

Revision history for this message
Josua Dietze (digidietze) wrote :

@Sebastien, I just checked and the entry "05c6:1000:uMa=Qualcomm" suggested in bug #1823540 was indeed added to the last (current) data package release.

So it was checked alright. The bug can probably be closed as fixed.

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Josua, thanks

@Cedric, could you revert your local changes and try if the updated package build from https://launchpad.net/~ubuntu-desktop/+archive/ubuntu/ppa/+build/19329176 fixes the issue for you?

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Cedric, any chance you would try the ppa build?

Revision history for this message
Cedric Rochefolle (jscdroiddev) wrote :

Going to trying now. Will update shortly.

Revision history for this message
Cedric Rochefolle (jscdroiddev) wrote :

So it seems to be working, however there are some errors in the logs. Not sure they are critical.
Also I have 2 similar services, which could be the reason:
usb_modeswitch@1-4.service and usb_modeswitch@2-4.service

Revision history for this message
Sebastien Bacher (seb128) wrote :

did you get the error before the updated pacakge? why do you mean by having similar services?

Revision history for this message
Cedric Rochefolle (jscdroiddev) wrote :

I don't recall seeing that error before. The 2 services I'm referring to are the systemd services:
- usb_modeswitch@1-4.service
- and usb_modeswitch@2-4.service

I only realized that as I was trying to debug the error seen in the attached log.txt in my previous post

affects: usb-modeswitch (Ubuntu) → usb-modeswitch-data (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.