Ubuntu – Ls -1 /dev/{ashmem,binder} yields anticipated result for /dev/ashmem, but an error for /dev/binder

anboxkernelmodprobesecure-boot

Background

In another post, I reported that:

I'm running Ubuntu 20.04.1 with default kernel 5.4.0-42-generic (installed from Main) on a UEFI system. I want to load two kernel modules ("ashmem" and "binder") with Secure Boot enabled. At least for me, "binder" loads fine with Secure Boot enabled, but "ashmem" does not load with Secure Boot enabled. Both modules load with Secure Boot disabled.

To the above, I’ll add that I had enabled Secure Boot (and enrolled MOK) during the initial clean installation of Ubuntu 20.04. Even so, following the excellent suggestion provided by Rinzwind, I ran the following after the initial installation:

sudo kmodsign sha512 /var/lib/shim-signed/mok/MOK.priv /var/lib/shim-signed/mok/MOK.der /lib/modules/`uname -r`/kernel/drivers/staging/android/ashmem_linux.ko

And after running the above, I re-ran:

sudo modprobe ashmem_linux

sudo modprobe binder_linux

lsmod | grep -e ashmem_linux -e binder_linux

SUCCESS! Both “ashmem” and “binder” loaded! Thanks Rinzwind!!

What’s more, Anbox starts for me now with Secure Boot enabled, which was my end goal. 🙂

Error Message

Although both “ashmem” and “binder” now load, and although Anbox now starts (and seems to work properly) for me now with Secure Boot enabled, I still ran the following:

ls -1 /dev/{ashmem,binder}

And I obtained the following:

ls: cannot access '/dev/binder': No such file or directory
/dev/ashmem

Now, I’m still curious why I’m getting the above error ("cannot access '/dev/binder': No such file or directory") with regard to the “binder” module, and whether I should be concerned.

Questions

  1. Should /dev/binder be created upon loading the “binder” module? (And should the error concern me?)
  2. If /dev/binder should be created upon loading the “binder” module, how can I force /dev/binder to be created?
  3. And if /dev/binder should be created upon loading the “binder” module (that is, if I've discovered a bug), where on Launchpad should I report the error?

To reiterate, according to lsmod, both “ashmem” and “binder” load. Also, Anbox seems to be working properly for me now with Secure Boot enabled. I’m posting here to (a) satisfy my own curiosity, (b) document this for others, and (c) determine whether a bug report should be filed regarding binder (and where to file it, if warranted).

Best Answer

  • Reviewing the installation page for Anbox more closely, I noticed the following:

    In Ubuntu 19.10 the binder driver doesn't create /dev/binder when loaded. That is intentional. Instead it provides support for binderfs (see https://brauner.github.io/2019/01/09/android-binderfs.html) which is instead since PR anbox/anbox#1309

    Although the above doesn't specifically refer the situation for Ubuntu 20.04, I'm guessing that the same applies to it. With that in mind, here are proposed answers to my own questions:

    1. Nope, /dev/binder shouldn't be created upon loading the “binder” module. (And the error message shouldn't concern me.)
    2. There's no need (and probably no way) to force /dev/binder to be created.
    3. There's no need to report this error on Launchpad (or elsewhere).

    If anyone wants to provide an alternative (better) answer, please feel free to do so. I'll leave this question open for a few days, but will mark it as ANSWERED if I don't see any additional answers/comments within the next few days. :)