Run avrdude on Ubuntu without root

A quick tip for Ubuntu users:

As installed by the avrdude package on Ubuntu, avrdude needs root priveledges to work properly with the Adafruit USBTinyISP AVR programmer.  This gets annoying pretty fast because to program an AVR you need to run avrdude (or make) with sudo every time or log in as root (not recommended).  Without sudo, avrdude will return an error:

avrdude: error: usbtiny_transmit: error sending control message: Operation not permitted
avrdude: initialization failed, rc=-1
 Double check connections and try again, or use -F to override
 this check.
avrdude: error: usbtiny_transmit: error sending control message: Operation not permitted
avrdude done.  Thank you.

LadyAda points out in her avrdude tutorial that there is a way around this behavior by setting up some udev rules for the USBTinyISP.  However, I found that the rules given in her tutorial did not work with my stock Ubuntu 9.10 installation.  The problem arises because the user Ubuntu creates on install is not part of the “users” group.

The fix:

Create a file called 10-usbtinyisp.rules in directory /etc/udev/rules.d

 SUBSYSTEM=="usb", SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0c9f", GROUP="adm", MODE="0666"

Then execute:

 sudo restart udev

That’s it.  Unplug and replug in the USB cable to your USBTinyISP programmer.  Now avrdude should be able to access the USBTinyISP without root privileges.

If your account is part of another group, just change the GROUP= flag to that group instead.  New users in Ubuntu are assigned to a group named after their username by default, so that is another option (ie. GROUP=”yourusername”).  Interestingly, new users are not assigned to the “users” group, for reasons that escape me (and no doubt some of our more Linux-savvy readers can enlighten us about).

4 thoughts on “Run avrdude on Ubuntu without root”

  1. Thanks for the straightforward fix!

    One minor remark. Shouldn’t this be the way to restart the udev daemon?
    sudo /etc/init.d/udev restart

    Cheers,
    Bart.

    1. Yeah, not a good idea in general. The udev rule takes a few more keystrokes to implement but doesn’t create the same possible security hole.

Leave a Reply

Your email address will not be published. Required fields are marked *