I am working with a 4gb RaspberryPI4 and it's running a USB3 Flir Blackfly. Out of the box, the setting of usbcore.usbfs_memory_mb @ 16 isn't enough to get a stream from the camera. Increasing the value to 1024 manually in /sys/module/usbcore/parameters/usbfs_memory_mb works as expected but does not persist over power cycles/reboots.

I found some information about setting the value by updating GRUB_CMDLINE_LINUX_DEFAULT=" ... usbcore.usbfs_memory_mb=XXXX" in grub default, but the device isn't booting from grub. This led me to look for /boot/cmdline.txt which doesn't exist in the firmware currently on the device. Not a huge deal, I was able to find btcmd.txt which looks to do the same thing.

After adding either of the following to btcmd.txt;

  • usbcore.usbfs_memory_mb=1024
  • setenv bootargs "usbcore.usbfs_memory_mb=1024"

Neither one worked.

I do not want to have to convert the install to grub, and I would like to avoid having to write a start script that updates /sys/module/usbcore/parameters/usbfs_memory_mb when the desktop boots.

Is there something I'm missing here or is there another place to persistently set this value?

  • If using the kernel command line doesn't work, the next easiest way would be to do it via systemd in rc.local or some simple custom service.
    – goldilocks
    Nov 26, 2019 at 14:34
  • Adding usbcore.usbfs_memory_mb=1024 to /boot/firmware/cmdline.txt on an 18.04 instance does work, took a couple reboots for it to hook for some reason. On 19 i've had zero luck with trying to set this value at boot, either through scripting or rc.local, totally possible i'm the broken part of the equation here. Dec 11, 2019 at 20:16

1 Answer 1


You need to edit rc.local which runs commands on boot. Test and confirmed working on my pi4:

sudo nano /etc/rc.local to open rc.local

Then add the following above the comment line about IP's:

sudo sh -c 'echo 1024 > /sys/module/usbcore/parameters/usbfs_memory_mb' & (the ampersand is important!)

CTRL+X and Y to save. sudo reboot to test, then confirm with cat /sys/module/usbcore/parameters/usbfs_memory_mb which should print 1024

  • 1
    Also ubuntu uses systemd to mange services. So you should never suggest to use /etc/rc.local anymore. Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it.
    – Ingo
    Jul 3, 2020 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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