Uploading/Arduino gets an error : permission denied on Ubuntu 16.04

I have faced this problem for a long time ago and I solved it on Ubuntu 14.04 but I don't know why my solution doesn't work right now on Ubuntu 16.04

The Error:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

I'm using the same solution from The guide , by searching for solution on Stack sites and more ...

Here what I've done :

ls -l /dev/ttyACM*

from the result : The owner is root and the group with access is dialout

Then I applied:

sudo usermod -a -G dialout UserName

sudo chmod a+rw /dev/ttyACM0

Finally logged out and logged in .

Sompe people said they've solved it by removing modemmanager so I have tried that as well :

sudo apt-get remove modemmanager

But after all , the problem hasn't solved yet

Note: Arduino Uno with Ubuntu 16.04

Any suggestion ??

Please do this:

  • File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
  • Sketch > Upload
  • After the upload fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
  • Paste the error messages in a reply here USING CODE TAGS (</> button on the forum toolbar).
Arduino: 1.8.5 (Linux), Board: "Arduino/Genuino Uno"

/snap/arduino-mhall119/5/arduino-builder -dump-prefs -logger=machine -hardware /snap/arduino-mhall119/5/hardware -tools /snap/arduino-mhall119/5/tools-builder -tools /snap/arduino-mhall119/5/hardware/tools/avr -built-in-libraries /snap/arduino-mhall119/5/libraries -libraries /home/moh/snap/arduino-mhall119/5/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path /tmp/arduino_build_685695 -warnings=none -build-cache /tmp/arduino_cache_406982 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/snap/arduino-mhall119/5/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/snap/arduino-mhall119/5/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/snap/arduino-mhall119/5/hardware/tools/avr -verbose /home/moh/snap/arduino-mhall119/5/Arduino/sketch_jan09a/sketch_jan09a.ino
/snap/arduino-mhall119/5/arduino-builder -compile -logger=machine -hardware /snap/arduino-mhall119/5/hardware -tools /snap/arduino-mhall119/5/tools-builder -tools /snap/arduino-mhall119/5/hardware/tools/avr -built-in-libraries /snap/arduino-mhall119/5/libraries -libraries /home/moh/snap/arduino-mhall119/5/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path /tmp/arduino_build_685695 -warnings=none -build-cache /tmp/arduino_cache_406982 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/snap/arduino-mhall119/5/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/snap/arduino-mhall119/5/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/snap/arduino-mhall119/5/hardware/tools/avr -verbose /home/moh/snap/arduino-mhall119/5/Arduino/sketch_jan09a/sketch_jan09a.ino
Using board 'uno' from platform in folder: /snap/arduino-mhall119/5/hardware/arduino/avr
Using core 'arduino' from platform in folder: /snap/arduino-mhall119/5/hardware/arduino/avr
Detecting libraries used...
"/snap/arduino-mhall119/5/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/snap/arduino-mhall119/5/hardware/arduino/avr/cores/arduino" "-I/snap/arduino-mhall119/5/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_685695/sketch/sketch_jan09a.ino.cpp" -o "/dev/null"
Generating function prototypes...
"/snap/arduino-mhall119/5/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/snap/arduino-mhall119/5/hardware/arduino/avr/cores/arduino" "-I/snap/arduino-mhall119/5/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_685695/sketch/sketch_jan09a.ino.cpp" -o "/tmp/arduino_build_685695/preproc/ctags_target_for_gcc_minus_e.cpp"
"/snap/arduino-mhall119/5/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_685695/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/snap/arduino-mhall119/5/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/snap/arduino-mhall119/5/hardware/arduino/avr/cores/arduino" "-I/snap/arduino-mhall119/5/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_685695/sketch/sketch_jan09a.ino.cpp" -o "/tmp/arduino_build_685695/sketch/sketch_jan09a.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core
Linking everything together...
"/snap/arduino-mhall119/5/hardware/tools/avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p  -o "/tmp/arduino_build_685695/sketch_jan09a.ino.elf" "/tmp/arduino_build_685695/sketch/sketch_jan09a.ino.cpp.o" "/tmp/arduino_build_685695/../arduino_cache_406982/core/core_arduino_avr_uno_5ae566d2b74f299eedfb0fc6b9173d06.a" "-L/tmp/arduino_build_685695" -lm
"/snap/arduino-mhall119/5/hardware/tools/avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0  "/tmp/arduino_build_685695/sketch_jan09a.ino.elf" "/tmp/arduino_build_685695/sketch_jan09a.ino.eep"
"/snap/arduino-mhall119/5/hardware/tools/avr/bin/avr-objcopy" -O ihex -R .eeprom  "/tmp/arduino_build_685695/sketch_jan09a.ino.elf" "/tmp/arduino_build_685695/sketch_jan09a.ino.hex"
Sketch uses 928 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
/snap/arduino-mhall119/5/hardware/tools/avr/bin/avrdude -C/snap/arduino-mhall119/5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino_build_685695/sketch_jan09a.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/snap/arduino-mhall119/5/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/moh/snap/arduino-mhall119/5/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This error has been reported to be caused by the use of the unofficial "mhall119" Snap package of the Arduino IDE. Please uninstall that package and then install the official Arduino IDE, downloaded from:

Actually I've downloaded it from the official site , then I got this problem ,while I'm searching for solution some places mention that remove it and re-install it from another way , so I have downloaded it again from Ubuntu software

whatever , I'll try to remove it again , and I'll let you know

Thank you for response