10

Condition: extraneous notifications and popups when phone connected to USB.
Differential conditions: power management failure with USB, network card management failure.
Support: notifications, popups and dmesg warnings occur mostly when the power state reaches maximum high, but become rather stable when power state percentage stays constant.

The file manager keeps opening when I have my phone connected to my laptop via USB (Figure 1 and 2). There are also popup icons in the left-hand-side bar (Figure 3). There are also frequent internet connection notifications on/off when tethering (Figure 4 and 5). The bad quality cable increases the frequency of those annoyances. All types of notifications can be many times per minute. Their rate increases when the battery reaches high power state, but stays stable when battery is fully charged.

  • I do wjandrea's proposal gsettings set org.gnome.desktop.media-handling automount-open false which solves automount-open issue, its dmesg | tail state here.

You see about 10-30 windows for the error (Figure 1 and 2) and the right-hand-side icon of the phone popping back-and-forth (Figure 3) when just keeping the device connected to the laptop

enter image description here

enter image description here

enter image description here

  • I do wjandrea's second proposal gsettings set org.gnome.desktop.media-handling automount false. However, the icon of Samsung phone starts to popup in the left-hand-side bar again and again. It occurs mostly when my laptop is fully charged so it can be a problem in the power-management. Its dmesg | tail state is here (See Figure 3 also), which occurred first time and mostly when my laptop reaches about its maximum battery state.

Subset of the second dmesg here

[    5.788819] wl: module license 'MIXED/Proprietary' taints kernel.
[    5.788820] Disabling lock debugging due to kernel taint
[    5.789154] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card1/input8
[    5.797453] wl: module verification failed: signature and/or required key missing - tainting kernel
[    5.812002] input: HDA Intel HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/sound/card0/input9
[    5.812092] input: HDA Intel HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/sound/card0/input10
[    5.812165] input: HDA Intel HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/sound/card0/input11
[    5.981764] intel_rapl: Found RAPL domain package
[    5.981769] intel_rapl: Found RAPL domain core
[    5.981771] intel_rapl: Found RAPL domain uncore
[    5.981772] intel_rapl: Found RAPL domain dram
[    6.024117] wlan0: Broadcom BCM43a0 802.11 Hybrid Wireless Controller 6.30.223.248 (r487574)
[    6.030416] applesmc: key=561 fan=1 temp=33 index=33 acc=0 lux=2 kbd=1
[    6.050130] wl 0000:03:00.0 wlp3s0: renamed from wlan0
[    6.242168] Non-volatile memory driver v1.3
[    6.428191] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[    6.862799] input: bcm5974 as /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.2/input/input12
[    6.862926] usbcore: registered new interface driver bcm5974
[    7.053663] fuse init (API version 7.24)
[    7.329118] Bluetooth: Core ver 2.21
[    7.329540] NET: Registered protocol family 31
[    7.329543] Bluetooth: HCI device and connection manager initialized
[    7.329548] Bluetooth: HCI socket layer initialized
[    7.329551] Bluetooth: L2CAP socket layer initialized
[    7.329558] Bluetooth: SCO socket layer initialized
[    7.350445] usbcore: registered new interface driver btusb
[    7.355183] Bluetooth: hci0: BCM: chip id 73 build 0932
[    7.356184] Bluetooth: hci0: BCM: product 05ac:828f
[    7.372192] Bluetooth: hci0: BCM20702B0 Generic USB Class 1 @ 20 MHz
[    7.391321] usb 1-3.1: USB disconnect, device number 5
[    7.634631] usb 1-3.2: USB disconnect, device number 6
[    8.363517] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    8.363521] Bluetooth: BNEP filters: protocol multicast
[    8.363525] Bluetooth: BNEP socket layer initialized
[    8.377953] Bluetooth: RFCOMM TTY layer initialized
[    8.377960] Bluetooth: RFCOMM socket layer initialized
[    8.377965] Bluetooth: RFCOMM ver 1.11
[   78.943062] usb 1-1: USB disconnect, device number 2
[   79.308530] usb 1-1: new high-speed USB device number 8 using xhci_hcd
[   79.437071] usb 1-1: New USB device found, idVendor=04e8, idProduct=6863
[   79.437079] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   79.437083] usb 1-1: Product: SAMSUNG_Android
[   79.437086] usb 1-1: Manufacturer: SAMSUNG
[   79.437089] usb 1-1: SerialNumber: d068730a
[   79.978452] usbcore: registered new interface driver cdc_ether
[   79.981649] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-1, RNDIS device, 02:57:00:57:38:37
[   79.981726] usbcore: registered new interface driver rndis_host
[   79.983854] rndis_host 1-1:1.0 enp0s20u1: renamed from usb0
[   80.011403] IPv6: ADDRCONF(NETDEV_UP): enp0s20u1: link is not ready
[ 1290.235637] usb 1-1: USB disconnect, device number 8
[ 1290.235777] rndis_host 1-1:1.0 enp0s20u1: unregister 'rndis_host' usb-0000:00:14.0-1, RNDIS device
[ 1290.591107] usb 1-1: new high-speed USB device number 9 using xhci_hcd
[ 1290.719964] usb 1-1: New USB device found, idVendor=04e8, idProduct=6863
[ 1290.719973] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1290.719977] usb 1-1: Product: SAMSUNG_Android
[ 1290.719981] usb 1-1: Manufacturer: SAMSUNG
[ 1290.719984] usb 1-1: SerialNumber: d068730a
[ 1290.722251] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-1, RNDIS device, 02:57:00:57:38:37
[ 1291.255806] rndis_host 1-1:1.0 enp0s20u1: renamed from usb0
[ 1291.277892] IPv6: ADDRCONF(NETDEV_UP): enp0s20u1: link is not ready
[ 1870.316573] usb 1-1: USB disconnect, device number 9
[ 1870.316687] rndis_host 1-1:1.0 enp0s20u1: unregister 'rndis_host' usb-0000:00:14.0-1, RNDIS device
[ 1871.735777] usb 1-1: new high-speed USB device number 10 using xhci_hcd
[ 1871.865681] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 1871.865687] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1871.865690] usb 1-1: Product: SAMSUNG_Android
[ 1871.865692] usb 1-1: Manufacturer: SAMSUNG
[ 1871.865694] usb 1-1: SerialNumber: d068730a
[ 2265.887618] usb 1-1: USB disconnect, device number 10
[ 2268.395967] usb 1-1: new high-speed USB device number 11 using xhci_hcd
[ 2268.524992] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 2268.524998] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2268.525001] usb 1-1: Product: SAMSUNG_Android
[ 2268.525003] usb 1-1: Manufacturer: SAMSUNG
[ 2268.525005] usb 1-1: SerialNumber: d068730a
[ 2389.754208] usb 1-1: USB disconnect, device number 11
[ 2451.283233] usb 1-1: new high-speed USB device number 12 using xhci_hcd
[ 2451.412713] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 2451.412719] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2451.412722] usb 1-1: Product: SAMSUNG_Android
[ 2451.412725] usb 1-1: Manufacturer: SAMSUNG
[ 2451.412727] usb 1-1: SerialNumber: d068730a
[ 4253.278282] usb 1-1: USB disconnect, device number 12
[ 4254.096939] usb 1-1: new high-speed USB device number 13 using xhci_hcd
[ 4259.392860] usb 1-1: new high-speed USB device number 14 using xhci_hcd
[ 4259.522162] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4259.522167] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4259.522170] usb 1-1: Product: SAMSUNG_Android
[ 4259.522173] usb 1-1: Manufacturer: SAMSUNG
[ 4259.522175] usb 1-1: SerialNumber: d068730a
[ 4259.731917] usb 1-1: USB disconnect, device number 14
[ 4260.068777] usb 1-1: new high-speed USB device number 15 using xhci_hcd
[ 4260.200384] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4260.200389] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4260.200392] usb 1-1: Product: SAMSUNG_Android
[ 4260.200395] usb 1-1: Manufacturer: SAMSUNG
[ 4260.200397] usb 1-1: SerialNumber: d068730a
[ 4487.825779] usb 1-1: USB disconnect, device number 15
[ 4488.457511] usb 1-1: new high-speed USB device number 16 using xhci_hcd
[ 4488.643676] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4488.643682] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4488.643685] usb 1-1: Product: SAMSUNG_Android
[ 4488.643687] usb 1-1: Manufacturer: SAMSUNG
[ 4488.643689] usb 1-1: SerialNumber: d068730a
[ 4507.592538] usb 1-1: USB disconnect, device number 16
[ 4507.929239] usb 1-1: new high-speed USB device number 17 using xhci_hcd
[ 4508.115547] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4508.115553] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4508.115556] usb 1-1: Product: SAMSUNG_Android
[ 4508.115558] usb 1-1: Manufacturer: SAMSUNG
[ 4508.115560] usb 1-1: SerialNumber: d068730a

enter image description here

enter image description here

Other proposals

  • Sneetsher. It works the first day. I will let you know how it works in the next week.

    > sudo -i 
    > sed 's/LABEL="libmtp_usb_rules"/LABEL="libmtp_usb_rules"\n\n#Masi, ignore my phone\nATTR{idVendor}=="04e8", ATTR{idProduct}=="6863", GOTO="libmtp_rules_end"/g' /lib/udev/rules.d/69-libmtp.rules | sudo tee /etc/udev/rules.d/69-libmtp.rules \
    udevadm control --reload-rules
    
    # TODO for long time monitoring
    

Phone: Samsung Galaxy S4 gt-i9506 with Temasek's unofficial ROM of CyanogenMod 13 with sufficient patches
Ubuntu versions: 16.04
Linux kernel: 4.4 and 4.6
Linux kernel options: wl
Bash: 4.3.42(1)-release (x86_64-pc-linux-gnu)
Laptop: mid-2013 Macbook Air
USB: two USB3 ports (up to 5 Gbps) (here official specs)
Network card drivers: non-free broadcom-sta-dkms (see here)
VPN in phone: NordVPN US udp server
VPN in laptop when wifi connection with router-firewall: NordVPN EE udp server

  • Support 1: negative change in the power state (-1%) is associated with notifications.
  • Support 2: unstable internet connection uses significant amount of power (\Delta P = 1%).
  • Support 3: VPN protected internet connection decreases significantly the amount of notifications.
  • 2
    Just in case you haven't already done this (& also because I'm curious as to whether this has any effect on the behaviour) if you do System Settings->Details->Removable Media and tick the Never prompt or start programs on media insertion does that alter the 'Files' opening with the temperamental cable? It's something I usually do because I hate when I insert a many-partitioned USB or external HD and get several Files instances opening up all at once. – pHeLiOn Jun 7 '16 at 20:06
  • @pHeLiOn Yes, I think it is the same thing as wjandrea's answer. – Léo Léopold Hertz 준영 Jun 7 '16 at 22:05
  • @Masi It is a different dconf setting, org.gnome.desktop.media-handling autorun-never, but it does the same thing because it overrides org.gnome.desktop.media-handling automount-open. – wjandrea Jun 8 '16 at 20:51
  • @Masi, Do you have only USB3 ports? – user.dz Jun 15 '16 at 20:50
  • 1
    @Sneetsher Yes: Two USB 3 ports (up to 5 Gbps). Here specs support.apple.com/kb/SP678?locale=en_US – Léo Léopold Hertz 준영 Jun 15 '16 at 20:52
3

dconf is the place to check in this situation.

dconf is a low-level configuration system and settings management. Its main purpose is to provide a back-end to GSettings and KSettings on platforms that don't already have configuration storage systems. It depends on GLib. It is part of GNOME 3 and is a replacement for GConf. ~Wikipedia

For this you need to install dconf editor as follows:

sudo apt-get update
sudo apt-get install dconf-tools

To open dconf editor,

Press Alt + F2

or

go to Application > System Tools > dconf editor

Now in dconf editor, in sidebar

org > gnome > desktop > media-handling

Uncheck the automount-open option.

Following is the screen-shot of dconf-editor in 16.04:

dconf-editor in 16.04

  • 1
    this has the side effect of making ubuntu not automount any filesystem , its a sledgehammer to crack a nut as they say – Amias Jun 7 '16 at 15:31
  • 1
    @Masi The command you're looking for is gsettings set org.gnome.desktop.media-handling automount-open false. In my experience with dconf, a colon indicates a mapping, like with keyboard options. – wjandrea Jun 7 '16 at 20:57
  • 1
    @amiaschanner I just tried it and it actually does automount. What is disabled is the automatic opening of the drive. – wjandrea Jun 7 '16 at 21:00
  • @Masi I have attached a screen-shot of dconf-editor in 16.04, working similar to that of 14.04. – Dhaval Simaria Jun 11 '16 at 8:55
2
+50

CLI version of @Dhaval-Simaria's answer:

gsettings set org.gnome.desktop.media-handling automount-open false

Note that Ubuntu comes with gsettings; it does not need to be installed.


Edit for updated info: Since the error messages are reporting a failure to mount, try disabling automount:

gsettings set org.gnome.desktop.media-handling automount false
  • 4
    dconf-editor is a graphical frontend of gsettings. You don't need it, but it's often useful. – wjandrea Jun 7 '16 at 22:06
  • @wjandrea appreciate for showing the other (probably easier) side of the solution. – Dhaval Simaria Jun 8 '16 at 5:44
  • 1
    @Masi Ah, your initial question wasn't very clear, so I assumed the notifications you mentioned were the popup nautilus windows. I have edited my answer to account for the new info. – wjandrea Jun 14 '16 at 22:45
  • Both of these commands are not sufficient. I started to get the icon of the left-hand-side bar appear again and again after 10 hours use of the laptop. – Léo Léopold Hertz 준영 Jun 15 '16 at 13:37
  • @Masi why do you keep deleting your comments? It makes this thread hard to read for future readers when you do that. – wjandrea Jun 15 '16 at 17:35
1

If you run Xubuntu this is really easy because it has a configuration panel to select automount behaviour. Just go to Settings > Hardware > Removable Drives and Media, then untick the relevant options:

enter image description here

1

Note: All command below need root power, so switch to root shell first using sudo -i or sudo su. If you want to run directly with sudo <cmd>, see When using sudo with redirection, I get 'permission denied'.

  • Set udev rule for libmtpto ignore your phone model:

    sed 's/LABEL="libmtp_usb_rules"/LABEL="libmtp_usb_rules"\n\n#Masi, ignore my phone\nATTR{idVendor}=="04e8", ATTR{idProduct}=="6863", GOTO="libmtp_rules_end"/g' /lib/udev/rules.d/69-libmtp.rules > /etc/udev/rules.d/69-libmtp.rules; \
    udevadm control --reload-rules
    

    To roll back:

    rm /etc/udev/rules.d/69-libmtp.rules
    
  • For all USB nodes

    echo "DRIVERS==\"usb\", RUN+=\"/bin/sh -c 'echo 1 > /sys%p/remove'\" > /etc/udev/rules.d/99-usb-fallen-leaves.rules; \
    udevadm control --reload-rules
    

    To roll back:

    rm /etc/udev/rules.d/99-usb-fallen-leaves.rules
    

    +Reboot

  • Here another method that do not require reboot.

    1. Generate the unbind & bind scripts using this one:

      As script usb-ctrl-gen.sh

      #!/bin/sh
      
      c=$(pwd)
      
      for o in "unbind" "bind"
      do
      
        cd $c
      
        echo Generate usb-$o.sh... 
      
        echo "#!/bin/sh\n" > usb-$o.sh
        chmod +x usb-$o.sh
        for d in /sys/bus/pci/drivers/[uex]hci* ; do cd $d; find $d -type l -iname "0000*" -printf 'echo "%f" > ' -exec echo $d/$o \;;  done >> usb-$o.sh
      
      done
      
      echo Done
      

      Or one line:

      c=$(pwd); for o in "unbind" "bind"; do echo Generate usb-$o.sh...; echo "#\!/bin/sh\n" > usb-$o.sh; chmod +x usb-$o.sh; for d in /sys/bus/pci/drivers/[uex]hci*; do cd $d; find $d -type l -iname "0000*" -printf 'echo "%f" > ' -exec echo $d/$o \;;  done >> usb-$o.sh; cd $c; done; echo Done
      

      Example of output:

      usb-unbind.sh

      #!/bin/sh 
      
      echo "0000:00:1a.0" > /sys/bus/pci/drivers/ehci-pci/unbind
      echo "0000:00:1d.0" > /sys/bus/pci/drivers/ehci-pci/unbind
      echo "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/unbind
      

      usb-bind.sh

      #!/bin/sh
      
      echo "0000:00:1a.0" > /sys/bus/pci/drivers/ehci-pci/bind
      echo "0000:00:1d.0" > /sys/bus/pci/drivers/ehci-pci/bind
      echo "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/bind
      
    2. Add usb-unbind.sh to /etc/profile to run on boot. Use usb-bind.sh to enable USB controller whenever needed.

      echo $(pwd)/usb-unbind.sh > /etc/profile.d/usb-unbind-hook.sh
      

    To role back:

    rm /etc/profile.d/usb-unbind-hook.sh
    

    Reference: How do you reset a USB device from the command line?

  • 1
    How can you make a rule that ignores all phones and all USB devices? I just want to start them explicitly in the laptop when I need to. Better have nothing at all. I do not want to have just one phone because I have many of them and many other devices too. This is not just about one device. – Léo Léopold Hertz 준영 Jun 14 '16 at 13:42
  • 1
    @Masi update answer. – user.dz Jun 14 '16 at 16:48
1

You should look into udev rules. With them you can block one device without affecting any other USB devices. You can define your own udev rules by creating a file in /etc/udev/rules.d/, e.g. /etc/udev/rules.d/51-block-phone-mount.rules

Now find the idVendor and idProduct of the device. Those are good to use since they are mostly unique to the product, so you can use them to identify the device in the udev rule.

List your USB devices using lsusb and get something like this:

Bus 002 Device 002: ID 8087:8002 Intel Corp.  
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub  
Bus 001 Device 002: ID 8087:800a Intel Corp.  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  
Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub  
Bus 004 Device 002: ID 0424:2660 Standard Microsystems Corp.  
Bus 004 Device 003: ID 03f0:0024 Hewlett-Packard KU-0316 Keyboard  
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The relevant part is the Bus and the Device, e.g. Bus 004 and Device 003. With sudo lsusb -vs 004:003 | grep -E 'idProduct|idVendor' you will get the necessary information, e.g.:

idVendor           0x03f0 Hewlett-Packard  
idProduct          0x0024 KU-0316 Keyboard

This means your /etc/udev/rules.d/51-block-phone-mount.rules would need the following inserted:

#Phone automount block  
SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0024", ATTR{authorized}="0"

You can try it instantly with just replugging the phone and checking if it works.

0

I have a similar issue with a one plus one that has a slightly iffy usb socket , this makes it fire up a nautilus window every 5 mins or so.

The most effective way i found to prevent this was to make udev ignore it completely by matching the usb vendor and model id then setting the device to unauthorized mode. This way you specifically prevent this device from triggering anything further upstream such as automounting without affecting anything else.

how to do the udev blacklist https://projectgus.com/2014/09/blacklisting-a-single-usb-device-from-linux/

a guide for samsung phones http://blog.vacs.fr/vacs/blogs/post.html?post=2010/12/24/How-to-repair-the-USB-not-detected-problem-on-Android-Samsung-phones

  • 1
    Can you please provide a summary about your answer, not link-only answer. I do not understand how your answer differs in practice, from setting media-handling to not automount-open. The link seems to have some phone-side solution. It may be the case that there are two problems in my problem. I do use Samsung phone (Galaxy S4 gt-i9506), – Léo Léopold Hertz 준영 Jun 7 '16 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.