[lxc-users] Any experiences with modemmanager in unprivilegied container ?

0 views
Skip to first unread message

Nicolas FOURNIL

unread,
Sep 4, 2020, 1:40:18 PM9/4/20
to lxc-...@lists.linuxcontainers.org
Hello

I'm trying dealing with modemmanager and unprivilived container... what I have done :
- creating /dev/ttyACM0
- creation /dev/cdc-wdm0
- sysfs entry to host /sys for this USB device

To get the correct udev flags (ID_MM_DEVICE_PROCESS=1 & ID_MM_CANDIDATE=1) ...if there's better you're welcome!) :
udevadm test /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/usbmisc/cdc-wdm0
udevadm test /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.2/tty/ttyACM0

Then I had a start of locating modem ... but It failed when trying to attach mbim interface (wwan0 to cdc-wdm0) :

ModemManager[374]: <debug> [1599237879.432413] Modem (Sierra) '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2' completely disposed
ModemManager[374]: <warn>  [1599237879.432446] Couldn't create modem for device '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2': Failed to find a net port in the MBIM modem

To my investigations, there's an entry in /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-2/1-2\:1.0/net/wwan0 who is linked by /sys/class/net/wwan0 -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/net/wwan0/ and this is what modem manager is seeking.

And I haven't found how to import this network interface (wwan0 is like an ethernet device) directly inside the container without broke this link (yes tried to simply attach wwan0 to container of course... and is totaly ignore because not udev flagged and not "real" wwan0 but macvlan...)

Thanks for your help

Nicolas F.



Nicolas FOURNIL

unread,
Sep 7, 2020, 9:38:29 AM9/7/20
to lxc-...@lists.linuxcontainers.org
I think I get all working with this setup :
in lxc config :

  raw.lxc: |-
    lxc.mount.entry=/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/net/wwan0 sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/net/wwan0 none bind,optional,create=dir
devices:
  cdc-wdm0:
    gid: "20"
    mode: "0666"
    path: /dev/cdc-wdm0
    source: /dev/cdc-wdm0
    type: unix-char
  ttyACM0:
    gid: "20"
    mode: "0666"
    path: /dev/ttyACM0
    source: /dev/ttyACM0
    type: unix-char
  usb_modem:
    gid: "0"
    productid: a001
    type: usb
    uid: "0"
    vendorid: "1199"
  wwan0:
    name: wwan0
    nictype: physical
    parent: wwan0
    type: nic

then in container (for each reboot):
create :
/var/lib/cloud/scripts/per-boot/LTE_udev_helper.sh

#!/bin/bash
service ModemManager stop

udevadm test /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/usbmisc/cdc-wdm0
udevadm test /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.2/tty/ttyACM0
udevadm test /sys/class/net/wwan0
sleep 1
service ModemManager start

Off course you had to adapte the usb path with your environement, maybe a special hook in usb dev ?!

and it seems ok (detection is a little slow)... I'm starting my tests on this setup (LTE Connect OK, SMS Ok).

Regards

Nicolas F.
Reply all
Reply to author
Forward
0 new messages