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

I use vscode with Arduino extension on Ubuntu 22.04.1 LTS which had worked well until now.
If I'm trying to upload I'm getting the error:
avrdude: ser_open(): can't open device "/dev/ttyACM0: Permission denied"
When trying to upload a sketch to an Arduino Micro.
Then I tried it with the Arduino IDE 1.8.19 which produces the same error.
I have added my user to the dialout group even though it had worked before without that (and I restarted after that).
If I change chmod of /dev/ttyACM0 that does not help at all.
If I do:
~ $ ls -al /dev/ttyACM0
crw-rw----+ 1 root dialout 166, 0 Sep 14 00:15 /dev/ttyACM0
~ $ id
uid=1000(magraina) gid=1000(magraina) groups=1000(magraina),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),134(lxd),135(sambashare)
I was able to run avrdude manually with sudo
So I have now setup a rule under:
/etc/udev/rules.d named 50-myusb.rules
With:
SUBSYSTEM=="usb", MODE="0666", GROUP="dialout"
Now I'm able to run avrdude in the terminal to upload my sketch manually without sudo, but I'm still unable to run it through vscode or the Arduino IDE.
What else can I do?

It's more like a workaround but it's a solution that works for me.
Now the Arduino IDE in Version 2.0 has been released.
I downloaded it and run it.
With that version I'm now able to to upload a sketch as usual.
But sadly I could not find a solution for vscode as the Arduino extension only supports the old version for now.
Even though vscode runs avrdude from the same path as the new version of the Arduino IDE does.
It seems to me like, as if vscode has different user rights and I don't know how to change that.

sudo chmod a+rw /dev/ttyUSB0 or /dev/ttyACM0 which port used see Tools

Related

Linux add printers via terminal using lpadmin command

I use cups to add printer to my Linux machine it is easy to add via localhost:631 on the browser but i wanna add it using terminal alone there is a command to do that lpadmin -p printername -v device_uri -m everywhere when I run this command uli get a error
"lpadmin:Printer drivers are deprecated and will stop working in a future version of cups
lpadmin : unable to copy ppd files"
Is there any other way I could add printer with correct driver on Linux machine using terminal only?

can't open vscode editor on linux after ssh-remote from windows

I've been using vscode locally on a linux machine successfully.
Last night, I installed ssh-remote and connected to this linux machine from a windows machine. Everything appeared to be working fine from windows.
I just sat down at the linux machine this morning and could not open any of the files shown in the left pane (double clicking did nothing). I tried right clicking and selecting "open to the side". This caused a blank screen to open to the side.
Thinking maybe this was due to my windows laptop still being open at home, etc, I closed vscode on the linux machine and navigated to a random text file in my home directory using Nautilus (ubuntu file manager), right-clicked open in vscode, and it started vscode with no open files, no open folders, etc.
Finally, I restarted my linux machine, logged in, and tried the most direct, reproducible test I could think of, which still just started vscode with a blank screen (no editor):
(base) me#pc:~$ ls -l .bashrc && code .bashrc
-rw-r--r-- 1 me me 4279 May 6 13:09 .bashrc
<then vscode GUI opens, displaying no editors>
The following "worked" as in now I can open and edit stuff, but all my extensions have to be reinstalled:
sudo dpkg --purge code
rm -fr ~/.config/Code
rm -fr ~/.vscode
sudo apt install ~/Downloads/code_1.57.0-1623259737_amd64.deb
Note, last night when accessing from windows, I enabled settings-sync. No idea if that screwed things up, but in the past I've used mac laptops to connect this way (the Microsoft ssh-remote extension with settings sync turned on at both ends) and never had a single problem.

Not able to Open serial device, while running binary in Cygwin

-i have created binary in Cygwin, and try to run that binary.
-in such way, I'm trying to Open serial device, but not able to open that serial device getting Error No such file or directory.
-I have use Same binary and run it on my other system and it is working fine.
Note- I have installed same Cygwin packages on both the system.
can anyone guide me, what should I have to do to prevent this issue.

android studio doesn't detect my device on my ubuntu laptop

I am trying to run an app from Android Studio on my Ubuntu laptop.
I have enabled USB debugging, but it is still not working.
When I press run in Android Studio, it does not detect my device (LG G3 Lollipop).
I could not find any help :(
First of all,
Open terminal and do following:
Do lsusb command to check your device is indeed connected.
Do adb devices to check if your device is connected then it is detected as in adb mode.
2.a. if the above command is not found, do sudo apt-get install android-tools-adb and then check if it is listed.
Secondly, post results of step 1 and 2 with your question to help us in finding a correct solution.
Troubleshooting:
Make sure adb mode in enabled.
Make sure you have opted for Allow option when prompted for in your device upon connecting to your ubuntu system.
This one is from some past LG users, Try connecting your device in PTP mode rather than MTP mode, it surprisingly works.
If it atill doesn't work, (most likely your case), try googling. I landed upon this page by pressing I'M FEELING LUCKY, you should try to feel lucky once in a while.
Source for step number 3 and 4
follow the steps as mentioned upon page:
Create a file: /etc/udev/rules.d/70-android.rules.
Write: SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666" to the file.
Assign proper permission via sudo chmod a+rx /etc/udev/rules.d/70-android.rules
Reboot the system and restart udev.
As a second step of troubleshooting (make sure you again repeated troubleshooting from step1 in case you failed at this step)
Again, the process:
Create a file: /etc/udev/rules.d/51-android.rules.
Write: SUBSYSTEM=="usb", ATTR{idProduct}=="1004", MODE="0666" to the file.
Assign proper permission via sudo chmod a+rx /etc/udev/rules.d/70-android.rules
Reboot the system and restart udev.
Make sure you have adb installed in your ubuntu system.
If not then type -
sudo apt-get install adb
Provide your system password and press 'Y' asked during installation process.
Then disconnect your device through USB and then reconnect it.
You will have to grant permission for debugging which prompts on your device just after reconnecting.
I faced the same issue but it was my mistake. I didn't turn on the " USB DEBUGGING MODE ".
Settings > Developer Option > Enable USB Debugging Mode.
Try to revoke USB debugging authorizations and then connect your device, it should show permission prompt for authorization.
go to
settings -> developer options -> revoke USB debugging authorizations.
I tried restarting adb using root priviledges and it worked for me. Use these commands in the terminal:
sudo adb kill-server
sudo adb start-server
Hope it works for you too...
For my situation with Ubuntu 16.04, with my device properly connected via USB, confirmed by lsusb
The solution is let the Studio aware of the Android/Sdk folder by defining
export ANDROID_HOME=<the Android/Sdk folder>
in ~/.bashrc
(I have installed the SDK at a custom location)
Then start a new shell, from there re-start the studio, then it works.
I solved with this: https://stackoverflow.com/a/37109216/5081063
If the problem is only on Android Studio and not in your OS you can solve with that.
So first check if adb recognize any devices with:
$ adb devices
If yes, open Android Studio and follow these steps:
Go to Run > Edit Configurations...
Under Deployment Target Options select Show Device Chooser Dialog from the drop-down-list
if you are doing it first time in Ubuntu Linux, then Use sudo apt-get install to install the adb package. This gives you a community-maintained default set of udev rules for all Android devices.
or, use
sudo adb kill-server
sudo adb start-server
and check using
sudo adb devices
you can also check uncheck the usb debugging option, in your developer option in the phone.
follow this link for more info.
Run apps on a hardware device
Enable USB Debugging from Settings->Developer Options
Enable Developer Mode by clicking on build number several times
My device appeared as unrecognized and when I ran adb devices fom android-tools directory it said: adb not a command. Strange. So what I did is installed adb tools additionally and then run adb devices:
sudo apt-get install android-tools-adb
89LY0810Y unauthorized
Then I saw the dialog on my device and selected: Always authorize.
Please make sure your device is in debug mode.
If you have tried many terminal commands to connect your physical device to android studio in ubuntu and you failed to connect try this :- Connect your device and change your USB preference(device notification) to PTP,android studio will detect your device.see this image
I had the same problem, as I had enabled the USB Debugger but it was my first try so I didn't know what to expect. If you answer "yes" to "use as storage device," you will set it to mtp, if you answer no, after that you will have the option to connect on debug mode and it will appear.
I was using a Samsung A31 and Debian
After trying a lot of different solutions, I notice that the problem was my cable, so I changed it and now it works.
Thanks to RazorHail Answer.

Installing software while running bootable usb

I am new to Linux so I have created a bootable usb drive with Linux Mint on it so that I can play around with it for a while before deciding if I want to install Linux on my harddrive.
I have created the pendrive with persistence so that I should have the ability to install software on it. However I can't seem to install anything.
I have downloaded the graphical linux postgresql installation file, given it execution permissions and then get the following error when I try to run it:
There has been an error
Error changing ownership of
/tmp/postgresql_installer_120403f9ba/lib/postgresql to root
I also downloaded the 7zip tar file, extracted it and tried to run the install.sh file. But nothing happens. Im just trying to see if I can get anything to install.
Im guessing either there's something with permissions that im not doing correctly, or it has something to do with the fact that im running linux from a usb drive.
As mentioned, im brand new to linux.
I have figured out what was required. I was trying to double click the install file from the GUI which wasn't working. I had to run it using sudo from the command line. Looks good now.

Resources