udev rules seem ignored; can not prevent modem manager from grabbing device












12















I am trying to prevent modem manager from running when I plug my cell phone into a USB port.



I have tried to add a custom rule with udev, but my custom rules seem ignored. I created a file /etc/udev/rules.d/99-mm-usb-device-blacklist.rules which contains



# LG Phone
ATTRS{idVendor}=="1004", ENV{ID_MM_DEVICE_IGNORE}="1"


And yet when I plug in the phone and check dmesg, this is what I get:



[ 1809.761940] usb 3-1: new high-speed USB device number 11 using xhci_hcd
[ 1809.778662] usb 3-1: New USB device found, idVendor=1004, idProduct=61fc
[ 1809.778670] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1809.778674] usb 3-1: Product: B Project USB Device
[ 1809.778677] usb 3-1: Manufacturer: LG Electronics. Inc
[ 1809.778680] usb 3-1: SerialNumber: XXXXXXXXXXXXXXXXX
[ 1809.779501] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 1809.779584] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 1809.780899] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, 6e:34:73:4f:68:4c
[ 1809.781454] scsi8 : usb-storage 3-1:1.5
[ 1809.807331] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816566] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816759] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready


I have also tried editing /lib/udev/rules.dev/77-mm-usb-device-blacklist.rules but this did not work either. What am I missing? What would be a helpful step in debugging this?



Update:
Running udevadm info --export-db shows the udev rule is being updated. The relevant output is:



P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
N: bus/usb/002/012
E: BUSNUM=002
E: DEVNAME=/dev/bus/usb/002/012
E: DEVNUM=012
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MM_DEVICE_IGNORE=1
E: ID_MODEL=B_Project_USB_Device
E: ID_MODEL_ENC=Bx20Projectx20USBx20Device
E: ID_MODEL_ID=61fc
E: ID_REVISION=0216
E: ID_SERIAL=LG_Electronics._Inc_B_Project_USB_Device_XXXXXXXXXXXXX
E: ID_SERIAL_SHORT=XXXXXXXXXXXX
E: ID_USB_INTERFACES=:020201:0a0000:ffffff:020600:080650:
E: ID_VENDOR=LG_Electronics._Inc
E: ID_VENDOR_ENC=LGx20Electronics.x20Inc
E: ID_VENDOR_ID=1004
E: MAJOR=189
E: MINOR=139
E: PRODUCT=1004/61fc/216
E: SUBSYSTEM=usb
E: TYPE=239/2/1
E: UDEV_LOG=7
E: USEC_INITIALIZED=5987581808


So modem manager should be ignoring the device. And yet my computer keeps trying to initialize a network connect through my phone whenever I plug it to the USB port. Is there another program that udev is launching?










share|improve this question




















  • 1





    Did you run ModemManager --debug to check what it was doing with the device in question? I'm also slightly surprised to not see ID_MM_CANDIDATE=1 in that entry -- perhaps this is a separate codepath scanning devices in ModemManager which doesn't respect that attribute?

    – kiko
    Nov 17 '18 at 19:24













  • @kiko, I have the same issue as the question author. ID_MM_CANDIDATE does not appear in the USB device output, but there is a separate entry in the database output for the TTY device, and this has both ID_MM_CANDIDATE=1 and ID_MM_DEVICE_IGNORE=1. Modem Manager debug logs show that it is indeed probing the device.

    – Ian Mackinnon
    Feb 19 at 9:23
















12















I am trying to prevent modem manager from running when I plug my cell phone into a USB port.



I have tried to add a custom rule with udev, but my custom rules seem ignored. I created a file /etc/udev/rules.d/99-mm-usb-device-blacklist.rules which contains



# LG Phone
ATTRS{idVendor}=="1004", ENV{ID_MM_DEVICE_IGNORE}="1"


And yet when I plug in the phone and check dmesg, this is what I get:



[ 1809.761940] usb 3-1: new high-speed USB device number 11 using xhci_hcd
[ 1809.778662] usb 3-1: New USB device found, idVendor=1004, idProduct=61fc
[ 1809.778670] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1809.778674] usb 3-1: Product: B Project USB Device
[ 1809.778677] usb 3-1: Manufacturer: LG Electronics. Inc
[ 1809.778680] usb 3-1: SerialNumber: XXXXXXXXXXXXXXXXX
[ 1809.779501] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 1809.779584] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 1809.780899] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, 6e:34:73:4f:68:4c
[ 1809.781454] scsi8 : usb-storage 3-1:1.5
[ 1809.807331] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816566] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816759] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready


I have also tried editing /lib/udev/rules.dev/77-mm-usb-device-blacklist.rules but this did not work either. What am I missing? What would be a helpful step in debugging this?



Update:
Running udevadm info --export-db shows the udev rule is being updated. The relevant output is:



P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
N: bus/usb/002/012
E: BUSNUM=002
E: DEVNAME=/dev/bus/usb/002/012
E: DEVNUM=012
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MM_DEVICE_IGNORE=1
E: ID_MODEL=B_Project_USB_Device
E: ID_MODEL_ENC=Bx20Projectx20USBx20Device
E: ID_MODEL_ID=61fc
E: ID_REVISION=0216
E: ID_SERIAL=LG_Electronics._Inc_B_Project_USB_Device_XXXXXXXXXXXXX
E: ID_SERIAL_SHORT=XXXXXXXXXXXX
E: ID_USB_INTERFACES=:020201:0a0000:ffffff:020600:080650:
E: ID_VENDOR=LG_Electronics._Inc
E: ID_VENDOR_ENC=LGx20Electronics.x20Inc
E: ID_VENDOR_ID=1004
E: MAJOR=189
E: MINOR=139
E: PRODUCT=1004/61fc/216
E: SUBSYSTEM=usb
E: TYPE=239/2/1
E: UDEV_LOG=7
E: USEC_INITIALIZED=5987581808


So modem manager should be ignoring the device. And yet my computer keeps trying to initialize a network connect through my phone whenever I plug it to the USB port. Is there another program that udev is launching?










share|improve this question




















  • 1





    Did you run ModemManager --debug to check what it was doing with the device in question? I'm also slightly surprised to not see ID_MM_CANDIDATE=1 in that entry -- perhaps this is a separate codepath scanning devices in ModemManager which doesn't respect that attribute?

    – kiko
    Nov 17 '18 at 19:24













  • @kiko, I have the same issue as the question author. ID_MM_CANDIDATE does not appear in the USB device output, but there is a separate entry in the database output for the TTY device, and this has both ID_MM_CANDIDATE=1 and ID_MM_DEVICE_IGNORE=1. Modem Manager debug logs show that it is indeed probing the device.

    – Ian Mackinnon
    Feb 19 at 9:23














12












12








12


3






I am trying to prevent modem manager from running when I plug my cell phone into a USB port.



I have tried to add a custom rule with udev, but my custom rules seem ignored. I created a file /etc/udev/rules.d/99-mm-usb-device-blacklist.rules which contains



# LG Phone
ATTRS{idVendor}=="1004", ENV{ID_MM_DEVICE_IGNORE}="1"


And yet when I plug in the phone and check dmesg, this is what I get:



[ 1809.761940] usb 3-1: new high-speed USB device number 11 using xhci_hcd
[ 1809.778662] usb 3-1: New USB device found, idVendor=1004, idProduct=61fc
[ 1809.778670] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1809.778674] usb 3-1: Product: B Project USB Device
[ 1809.778677] usb 3-1: Manufacturer: LG Electronics. Inc
[ 1809.778680] usb 3-1: SerialNumber: XXXXXXXXXXXXXXXXX
[ 1809.779501] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 1809.779584] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 1809.780899] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, 6e:34:73:4f:68:4c
[ 1809.781454] scsi8 : usb-storage 3-1:1.5
[ 1809.807331] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816566] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816759] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready


I have also tried editing /lib/udev/rules.dev/77-mm-usb-device-blacklist.rules but this did not work either. What am I missing? What would be a helpful step in debugging this?



Update:
Running udevadm info --export-db shows the udev rule is being updated. The relevant output is:



P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
N: bus/usb/002/012
E: BUSNUM=002
E: DEVNAME=/dev/bus/usb/002/012
E: DEVNUM=012
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MM_DEVICE_IGNORE=1
E: ID_MODEL=B_Project_USB_Device
E: ID_MODEL_ENC=Bx20Projectx20USBx20Device
E: ID_MODEL_ID=61fc
E: ID_REVISION=0216
E: ID_SERIAL=LG_Electronics._Inc_B_Project_USB_Device_XXXXXXXXXXXXX
E: ID_SERIAL_SHORT=XXXXXXXXXXXX
E: ID_USB_INTERFACES=:020201:0a0000:ffffff:020600:080650:
E: ID_VENDOR=LG_Electronics._Inc
E: ID_VENDOR_ENC=LGx20Electronics.x20Inc
E: ID_VENDOR_ID=1004
E: MAJOR=189
E: MINOR=139
E: PRODUCT=1004/61fc/216
E: SUBSYSTEM=usb
E: TYPE=239/2/1
E: UDEV_LOG=7
E: USEC_INITIALIZED=5987581808


So modem manager should be ignoring the device. And yet my computer keeps trying to initialize a network connect through my phone whenever I plug it to the USB port. Is there another program that udev is launching?










share|improve this question
















I am trying to prevent modem manager from running when I plug my cell phone into a USB port.



I have tried to add a custom rule with udev, but my custom rules seem ignored. I created a file /etc/udev/rules.d/99-mm-usb-device-blacklist.rules which contains



# LG Phone
ATTRS{idVendor}=="1004", ENV{ID_MM_DEVICE_IGNORE}="1"


And yet when I plug in the phone and check dmesg, this is what I get:



[ 1809.761940] usb 3-1: new high-speed USB device number 11 using xhci_hcd
[ 1809.778662] usb 3-1: New USB device found, idVendor=1004, idProduct=61fc
[ 1809.778670] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1809.778674] usb 3-1: Product: B Project USB Device
[ 1809.778677] usb 3-1: Manufacturer: LG Electronics. Inc
[ 1809.778680] usb 3-1: SerialNumber: XXXXXXXXXXXXXXXXX
[ 1809.779501] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 1809.779584] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 1809.780899] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, 6e:34:73:4f:68:4c
[ 1809.781454] scsi8 : usb-storage 3-1:1.5
[ 1809.807331] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816566] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 1809.816759] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready


I have also tried editing /lib/udev/rules.dev/77-mm-usb-device-blacklist.rules but this did not work either. What am I missing? What would be a helpful step in debugging this?



Update:
Running udevadm info --export-db shows the udev rule is being updated. The relevant output is:



P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
N: bus/usb/002/012
E: BUSNUM=002
E: DEVNAME=/dev/bus/usb/002/012
E: DEVNUM=012
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MM_DEVICE_IGNORE=1
E: ID_MODEL=B_Project_USB_Device
E: ID_MODEL_ENC=Bx20Projectx20USBx20Device
E: ID_MODEL_ID=61fc
E: ID_REVISION=0216
E: ID_SERIAL=LG_Electronics._Inc_B_Project_USB_Device_XXXXXXXXXXXXX
E: ID_SERIAL_SHORT=XXXXXXXXXXXX
E: ID_USB_INTERFACES=:020201:0a0000:ffffff:020600:080650:
E: ID_VENDOR=LG_Electronics._Inc
E: ID_VENDOR_ENC=LGx20Electronics.x20Inc
E: ID_VENDOR_ID=1004
E: MAJOR=189
E: MINOR=139
E: PRODUCT=1004/61fc/216
E: SUBSYSTEM=usb
E: TYPE=239/2/1
E: UDEV_LOG=7
E: USEC_INITIALIZED=5987581808


So modem manager should be ignoring the device. And yet my computer keeps trying to initialize a network connect through my phone whenever I plug it to the USB port. Is there another program that udev is launching?







usb network-manager udev






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 '14 at 18:40







superdesk

















asked Jan 3 '14 at 3:37









superdesksuperdesk

641614




641614








  • 1





    Did you run ModemManager --debug to check what it was doing with the device in question? I'm also slightly surprised to not see ID_MM_CANDIDATE=1 in that entry -- perhaps this is a separate codepath scanning devices in ModemManager which doesn't respect that attribute?

    – kiko
    Nov 17 '18 at 19:24













  • @kiko, I have the same issue as the question author. ID_MM_CANDIDATE does not appear in the USB device output, but there is a separate entry in the database output for the TTY device, and this has both ID_MM_CANDIDATE=1 and ID_MM_DEVICE_IGNORE=1. Modem Manager debug logs show that it is indeed probing the device.

    – Ian Mackinnon
    Feb 19 at 9:23














  • 1





    Did you run ModemManager --debug to check what it was doing with the device in question? I'm also slightly surprised to not see ID_MM_CANDIDATE=1 in that entry -- perhaps this is a separate codepath scanning devices in ModemManager which doesn't respect that attribute?

    – kiko
    Nov 17 '18 at 19:24













  • @kiko, I have the same issue as the question author. ID_MM_CANDIDATE does not appear in the USB device output, but there is a separate entry in the database output for the TTY device, and this has both ID_MM_CANDIDATE=1 and ID_MM_DEVICE_IGNORE=1. Modem Manager debug logs show that it is indeed probing the device.

    – Ian Mackinnon
    Feb 19 at 9:23








1




1





Did you run ModemManager --debug to check what it was doing with the device in question? I'm also slightly surprised to not see ID_MM_CANDIDATE=1 in that entry -- perhaps this is a separate codepath scanning devices in ModemManager which doesn't respect that attribute?

– kiko
Nov 17 '18 at 19:24







Did you run ModemManager --debug to check what it was doing with the device in question? I'm also slightly surprised to not see ID_MM_CANDIDATE=1 in that entry -- perhaps this is a separate codepath scanning devices in ModemManager which doesn't respect that attribute?

– kiko
Nov 17 '18 at 19:24















@kiko, I have the same issue as the question author. ID_MM_CANDIDATE does not appear in the USB device output, but there is a separate entry in the database output for the TTY device, and this has both ID_MM_CANDIDATE=1 and ID_MM_DEVICE_IGNORE=1. Modem Manager debug logs show that it is indeed probing the device.

– Ian Mackinnon
Feb 19 at 9:23





@kiko, I have the same issue as the question author. ID_MM_CANDIDATE does not appear in the USB device output, but there is a separate entry in the database output for the TTY device, and this has both ID_MM_CANDIDATE=1 and ID_MM_DEVICE_IGNORE=1. Modem Manager debug logs show that it is indeed probing the device.

– Ian Mackinnon
Feb 19 at 9:23










3 Answers
3






active

oldest

votes


















6














While there may be a way to do this with udev, I found a much simpler working solution at this AskUbuntu question.



To summarize, you can tell Network Manager not to manage certain devices by adding a line to its .conf file.



First, find your cell phone's mac address. Run dmesg from the terminal after you plug it in; one of the print outs should have the mac. The line for me was:



[ 4691.112016] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, de:1a:28:c7:db:e6


Next, open /etc/NetworkManager/NetworkManager.conf with super user privledges, and add a your phone's mac as an unmanaged device. This is my NetworkManager.conf; I added the last two lines.



[main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=mac:de:1a:28:c7:db:e6





share|improve this answer

































    3














    Modem Manager can be configured to use different filter policies, and the udev tags such as ID_MM_DEVICE_IGNORE have no effect under the strict filter policy.



    You can determine which policy Modem Manager is using on your system by viewing its status:



    > sudo systemctl status ModemManager
    ● ModemManager.service - Modem Manager
    Loaded: loaded (/lib/systemd/system/ModemManager.service...
    Active: active (running) since ...
    ...
    CGroup: /system.slice/ModemManager.service
    └─644 /usr/sbin/ModemManager --filter-policy=strict


    This also shows that the relevant service file is /lib/systemd/system/ModemManager.service. We can edit this file in different ways to disable probing of a particular device.



    To use a different policy which will refer to the udev blacklist rules we can change the command in the service:



    ExecStart=/usr/sbin/ModemManager --filter-policy=default


    Options are default (just use the blacklist rules) or paranoid (like strict but also use the blacklist rules). The documentation mentions this is not recommended as support for blacklist rules may be obsoleted in the future.



    Another option is to filter a class of devices using one of several TTY-specific environment variables. This can be achieved by appending a line to the [Service] section of the service file. For example, to prohibit probing of ACM TTY devices:



    [Service]
    ...
    Environment="MM_FILTER_RULE_TTY_ACM_INTERFACE=0"


    After changing the service file, reload the systemctl configuration and restart ModemManager:



    sudo systemctl daemon-reload
    sudo systemctl restart ModemManager




    For debugging purposes it may be useful to watch modem manager logs when connecting your device. To enable debug logging, run:



    sudo mmcli -G DEBUG;


    To watch the filter log messages, run:



    journalctl -f | grep "ModemManager.*[filter]"


    Now when you connect your device you should see lines like:



    # Device allowed with strict filter policy
    [filter] (tty/...): port allowed:...

    # Device filtered with default filter policy and udev tags
    [filter] (tty/...): port filtered: device is blacklisted

    # Device filtered with strict filter policy and environment variables
    [filter] (tty/...) port filtered: forbidden


    To return ModemManager logging to its prior state, run:



    sudo mmcli -G ERROR





    share|improve this answer































      0














      (just for sake of science, since you have already solved your issue...)



      udev reads/executes its rules in the alphabetical order[1].

      This could mean that your settings should be overwritten be NetworkManager, that's your rule is useless.



      If you rename your rule from 99- to 99999- does this change help you?





      [1] https://unix.stackexchange.com/questions/204979/why-do-the-rules-in-udev-rules-d-have-numbers-in-front-of-them






      share|improve this answer
























      • I had this problem 5 years ago, and no longer have any of the hardware which I experienced the issue with. I seem to recall messing with the filenames, but can't recall the exact circumstances.

        – superdesk
        Feb 26 at 14:27











      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f399263%2fudev-rules-seem-ignored-can-not-prevent-modem-manager-from-grabbing-device%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6














      While there may be a way to do this with udev, I found a much simpler working solution at this AskUbuntu question.



      To summarize, you can tell Network Manager not to manage certain devices by adding a line to its .conf file.



      First, find your cell phone's mac address. Run dmesg from the terminal after you plug it in; one of the print outs should have the mac. The line for me was:



      [ 4691.112016] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, de:1a:28:c7:db:e6


      Next, open /etc/NetworkManager/NetworkManager.conf with super user privledges, and add a your phone's mac as an unmanaged device. This is my NetworkManager.conf; I added the last two lines.



      [main]
      plugins=ifupdown,keyfile
      dns=dnsmasq

      [ifupdown]
      managed=false

      [keyfile]
      unmanaged-devices=mac:de:1a:28:c7:db:e6





      share|improve this answer






























        6














        While there may be a way to do this with udev, I found a much simpler working solution at this AskUbuntu question.



        To summarize, you can tell Network Manager not to manage certain devices by adding a line to its .conf file.



        First, find your cell phone's mac address. Run dmesg from the terminal after you plug it in; one of the print outs should have the mac. The line for me was:



        [ 4691.112016] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, de:1a:28:c7:db:e6


        Next, open /etc/NetworkManager/NetworkManager.conf with super user privledges, and add a your phone's mac as an unmanaged device. This is my NetworkManager.conf; I added the last two lines.



        [main]
        plugins=ifupdown,keyfile
        dns=dnsmasq

        [ifupdown]
        managed=false

        [keyfile]
        unmanaged-devices=mac:de:1a:28:c7:db:e6





        share|improve this answer




























          6












          6








          6







          While there may be a way to do this with udev, I found a much simpler working solution at this AskUbuntu question.



          To summarize, you can tell Network Manager not to manage certain devices by adding a line to its .conf file.



          First, find your cell phone's mac address. Run dmesg from the terminal after you plug it in; one of the print outs should have the mac. The line for me was:



          [ 4691.112016] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, de:1a:28:c7:db:e6


          Next, open /etc/NetworkManager/NetworkManager.conf with super user privledges, and add a your phone's mac as an unmanaged device. This is my NetworkManager.conf; I added the last two lines.



          [main]
          plugins=ifupdown,keyfile
          dns=dnsmasq

          [ifupdown]
          managed=false

          [keyfile]
          unmanaged-devices=mac:de:1a:28:c7:db:e6





          share|improve this answer















          While there may be a way to do this with udev, I found a much simpler working solution at this AskUbuntu question.



          To summarize, you can tell Network Manager not to manage certain devices by adding a line to its .conf file.



          First, find your cell phone's mac address. Run dmesg from the terminal after you plug it in; one of the print outs should have the mac. The line for me was:



          [ 4691.112016] cdc_ether 3-1:1.3 usb0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, de:1a:28:c7:db:e6


          Next, open /etc/NetworkManager/NetworkManager.conf with super user privledges, and add a your phone's mac as an unmanaged device. This is my NetworkManager.conf; I added the last two lines.



          [main]
          plugins=ifupdown,keyfile
          dns=dnsmasq

          [ifupdown]
          managed=false

          [keyfile]
          unmanaged-devices=mac:de:1a:28:c7:db:e6






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 13 '17 at 12:24









          Community

          1




          1










          answered Jan 6 '14 at 16:25









          superdesksuperdesk

          641614




          641614

























              3














              Modem Manager can be configured to use different filter policies, and the udev tags such as ID_MM_DEVICE_IGNORE have no effect under the strict filter policy.



              You can determine which policy Modem Manager is using on your system by viewing its status:



              > sudo systemctl status ModemManager
              ● ModemManager.service - Modem Manager
              Loaded: loaded (/lib/systemd/system/ModemManager.service...
              Active: active (running) since ...
              ...
              CGroup: /system.slice/ModemManager.service
              └─644 /usr/sbin/ModemManager --filter-policy=strict


              This also shows that the relevant service file is /lib/systemd/system/ModemManager.service. We can edit this file in different ways to disable probing of a particular device.



              To use a different policy which will refer to the udev blacklist rules we can change the command in the service:



              ExecStart=/usr/sbin/ModemManager --filter-policy=default


              Options are default (just use the blacklist rules) or paranoid (like strict but also use the blacklist rules). The documentation mentions this is not recommended as support for blacklist rules may be obsoleted in the future.



              Another option is to filter a class of devices using one of several TTY-specific environment variables. This can be achieved by appending a line to the [Service] section of the service file. For example, to prohibit probing of ACM TTY devices:



              [Service]
              ...
              Environment="MM_FILTER_RULE_TTY_ACM_INTERFACE=0"


              After changing the service file, reload the systemctl configuration and restart ModemManager:



              sudo systemctl daemon-reload
              sudo systemctl restart ModemManager




              For debugging purposes it may be useful to watch modem manager logs when connecting your device. To enable debug logging, run:



              sudo mmcli -G DEBUG;


              To watch the filter log messages, run:



              journalctl -f | grep "ModemManager.*[filter]"


              Now when you connect your device you should see lines like:



              # Device allowed with strict filter policy
              [filter] (tty/...): port allowed:...

              # Device filtered with default filter policy and udev tags
              [filter] (tty/...): port filtered: device is blacklisted

              # Device filtered with strict filter policy and environment variables
              [filter] (tty/...) port filtered: forbidden


              To return ModemManager logging to its prior state, run:



              sudo mmcli -G ERROR





              share|improve this answer




























                3














                Modem Manager can be configured to use different filter policies, and the udev tags such as ID_MM_DEVICE_IGNORE have no effect under the strict filter policy.



                You can determine which policy Modem Manager is using on your system by viewing its status:



                > sudo systemctl status ModemManager
                ● ModemManager.service - Modem Manager
                Loaded: loaded (/lib/systemd/system/ModemManager.service...
                Active: active (running) since ...
                ...
                CGroup: /system.slice/ModemManager.service
                └─644 /usr/sbin/ModemManager --filter-policy=strict


                This also shows that the relevant service file is /lib/systemd/system/ModemManager.service. We can edit this file in different ways to disable probing of a particular device.



                To use a different policy which will refer to the udev blacklist rules we can change the command in the service:



                ExecStart=/usr/sbin/ModemManager --filter-policy=default


                Options are default (just use the blacklist rules) or paranoid (like strict but also use the blacklist rules). The documentation mentions this is not recommended as support for blacklist rules may be obsoleted in the future.



                Another option is to filter a class of devices using one of several TTY-specific environment variables. This can be achieved by appending a line to the [Service] section of the service file. For example, to prohibit probing of ACM TTY devices:



                [Service]
                ...
                Environment="MM_FILTER_RULE_TTY_ACM_INTERFACE=0"


                After changing the service file, reload the systemctl configuration and restart ModemManager:



                sudo systemctl daemon-reload
                sudo systemctl restart ModemManager




                For debugging purposes it may be useful to watch modem manager logs when connecting your device. To enable debug logging, run:



                sudo mmcli -G DEBUG;


                To watch the filter log messages, run:



                journalctl -f | grep "ModemManager.*[filter]"


                Now when you connect your device you should see lines like:



                # Device allowed with strict filter policy
                [filter] (tty/...): port allowed:...

                # Device filtered with default filter policy and udev tags
                [filter] (tty/...): port filtered: device is blacklisted

                # Device filtered with strict filter policy and environment variables
                [filter] (tty/...) port filtered: forbidden


                To return ModemManager logging to its prior state, run:



                sudo mmcli -G ERROR





                share|improve this answer


























                  3












                  3








                  3







                  Modem Manager can be configured to use different filter policies, and the udev tags such as ID_MM_DEVICE_IGNORE have no effect under the strict filter policy.



                  You can determine which policy Modem Manager is using on your system by viewing its status:



                  > sudo systemctl status ModemManager
                  ● ModemManager.service - Modem Manager
                  Loaded: loaded (/lib/systemd/system/ModemManager.service...
                  Active: active (running) since ...
                  ...
                  CGroup: /system.slice/ModemManager.service
                  └─644 /usr/sbin/ModemManager --filter-policy=strict


                  This also shows that the relevant service file is /lib/systemd/system/ModemManager.service. We can edit this file in different ways to disable probing of a particular device.



                  To use a different policy which will refer to the udev blacklist rules we can change the command in the service:



                  ExecStart=/usr/sbin/ModemManager --filter-policy=default


                  Options are default (just use the blacklist rules) or paranoid (like strict but also use the blacklist rules). The documentation mentions this is not recommended as support for blacklist rules may be obsoleted in the future.



                  Another option is to filter a class of devices using one of several TTY-specific environment variables. This can be achieved by appending a line to the [Service] section of the service file. For example, to prohibit probing of ACM TTY devices:



                  [Service]
                  ...
                  Environment="MM_FILTER_RULE_TTY_ACM_INTERFACE=0"


                  After changing the service file, reload the systemctl configuration and restart ModemManager:



                  sudo systemctl daemon-reload
                  sudo systemctl restart ModemManager




                  For debugging purposes it may be useful to watch modem manager logs when connecting your device. To enable debug logging, run:



                  sudo mmcli -G DEBUG;


                  To watch the filter log messages, run:



                  journalctl -f | grep "ModemManager.*[filter]"


                  Now when you connect your device you should see lines like:



                  # Device allowed with strict filter policy
                  [filter] (tty/...): port allowed:...

                  # Device filtered with default filter policy and udev tags
                  [filter] (tty/...): port filtered: device is blacklisted

                  # Device filtered with strict filter policy and environment variables
                  [filter] (tty/...) port filtered: forbidden


                  To return ModemManager logging to its prior state, run:



                  sudo mmcli -G ERROR





                  share|improve this answer













                  Modem Manager can be configured to use different filter policies, and the udev tags such as ID_MM_DEVICE_IGNORE have no effect under the strict filter policy.



                  You can determine which policy Modem Manager is using on your system by viewing its status:



                  > sudo systemctl status ModemManager
                  ● ModemManager.service - Modem Manager
                  Loaded: loaded (/lib/systemd/system/ModemManager.service...
                  Active: active (running) since ...
                  ...
                  CGroup: /system.slice/ModemManager.service
                  └─644 /usr/sbin/ModemManager --filter-policy=strict


                  This also shows that the relevant service file is /lib/systemd/system/ModemManager.service. We can edit this file in different ways to disable probing of a particular device.



                  To use a different policy which will refer to the udev blacklist rules we can change the command in the service:



                  ExecStart=/usr/sbin/ModemManager --filter-policy=default


                  Options are default (just use the blacklist rules) or paranoid (like strict but also use the blacklist rules). The documentation mentions this is not recommended as support for blacklist rules may be obsoleted in the future.



                  Another option is to filter a class of devices using one of several TTY-specific environment variables. This can be achieved by appending a line to the [Service] section of the service file. For example, to prohibit probing of ACM TTY devices:



                  [Service]
                  ...
                  Environment="MM_FILTER_RULE_TTY_ACM_INTERFACE=0"


                  After changing the service file, reload the systemctl configuration and restart ModemManager:



                  sudo systemctl daemon-reload
                  sudo systemctl restart ModemManager




                  For debugging purposes it may be useful to watch modem manager logs when connecting your device. To enable debug logging, run:



                  sudo mmcli -G DEBUG;


                  To watch the filter log messages, run:



                  journalctl -f | grep "ModemManager.*[filter]"


                  Now when you connect your device you should see lines like:



                  # Device allowed with strict filter policy
                  [filter] (tty/...): port allowed:...

                  # Device filtered with default filter policy and udev tags
                  [filter] (tty/...): port filtered: device is blacklisted

                  # Device filtered with strict filter policy and environment variables
                  [filter] (tty/...) port filtered: forbidden


                  To return ModemManager logging to its prior state, run:



                  sudo mmcli -G ERROR






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 19 at 11:32









                  Ian MackinnonIan Mackinnon

                  62221436




                  62221436























                      0














                      (just for sake of science, since you have already solved your issue...)



                      udev reads/executes its rules in the alphabetical order[1].

                      This could mean that your settings should be overwritten be NetworkManager, that's your rule is useless.



                      If you rename your rule from 99- to 99999- does this change help you?





                      [1] https://unix.stackexchange.com/questions/204979/why-do-the-rules-in-udev-rules-d-have-numbers-in-front-of-them






                      share|improve this answer
























                      • I had this problem 5 years ago, and no longer have any of the hardware which I experienced the issue with. I seem to recall messing with the filenames, but can't recall the exact circumstances.

                        – superdesk
                        Feb 26 at 14:27
















                      0














                      (just for sake of science, since you have already solved your issue...)



                      udev reads/executes its rules in the alphabetical order[1].

                      This could mean that your settings should be overwritten be NetworkManager, that's your rule is useless.



                      If you rename your rule from 99- to 99999- does this change help you?





                      [1] https://unix.stackexchange.com/questions/204979/why-do-the-rules-in-udev-rules-d-have-numbers-in-front-of-them






                      share|improve this answer
























                      • I had this problem 5 years ago, and no longer have any of the hardware which I experienced the issue with. I seem to recall messing with the filenames, but can't recall the exact circumstances.

                        – superdesk
                        Feb 26 at 14:27














                      0












                      0








                      0







                      (just for sake of science, since you have already solved your issue...)



                      udev reads/executes its rules in the alphabetical order[1].

                      This could mean that your settings should be overwritten be NetworkManager, that's your rule is useless.



                      If you rename your rule from 99- to 99999- does this change help you?





                      [1] https://unix.stackexchange.com/questions/204979/why-do-the-rules-in-udev-rules-d-have-numbers-in-front-of-them






                      share|improve this answer













                      (just for sake of science, since you have already solved your issue...)



                      udev reads/executes its rules in the alphabetical order[1].

                      This could mean that your settings should be overwritten be NetworkManager, that's your rule is useless.



                      If you rename your rule from 99- to 99999- does this change help you?





                      [1] https://unix.stackexchange.com/questions/204979/why-do-the-rules-in-udev-rules-d-have-numbers-in-front-of-them







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 24 at 10:31









                      mattia.b89mattia.b89

                      545210




                      545210













                      • I had this problem 5 years ago, and no longer have any of the hardware which I experienced the issue with. I seem to recall messing with the filenames, but can't recall the exact circumstances.

                        – superdesk
                        Feb 26 at 14:27



















                      • I had this problem 5 years ago, and no longer have any of the hardware which I experienced the issue with. I seem to recall messing with the filenames, but can't recall the exact circumstances.

                        – superdesk
                        Feb 26 at 14:27

















                      I had this problem 5 years ago, and no longer have any of the hardware which I experienced the issue with. I seem to recall messing with the filenames, but can't recall the exact circumstances.

                      – superdesk
                      Feb 26 at 14:27





                      I had this problem 5 years ago, and no longer have any of the hardware which I experienced the issue with. I seem to recall messing with the filenames, but can't recall the exact circumstances.

                      – superdesk
                      Feb 26 at 14:27


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f399263%2fudev-rules-seem-ignored-can-not-prevent-modem-manager-from-grabbing-device%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                      Mangá

                      Eduardo VII do Reino Unido