raspberry pi's linux agent unable to connect cumulocity platform - linux

I am trying to connect my cumulocity-rpi-agent to cumulocity so that I can have two options either accept or cancel. But right now I am unable to to see accpet option for my device.
1) wget http://resources.cumulocity.com/examples/cumulocity-rpi-agent-latest.deb
2) sudo dpkg -i cumulocity-rpi-agent-latest.deb
I have executed these commands
then i have hit dpkg --list list command and cumulocity-rpi-agent now visible in result.
But my problem begins after above steps and can't proceed to next (When agent is installed, you should update the configuration file which is usually located at "./cfg/cumulocity-config.properties" and fill the host property value. Open Cumulocity in a web browser and go to the "Registration" page. Enter the serial number that you wrote down in the previous step and click "Register Device".)
I cant find ./cfg/cumulocity-config.properties these directory and file after installation
I refereed and followed https://www.cumulocity.com/guides/devices/raspberry-pi/ this link
I hit the sudo rebbot to get the accept button on cumulocity platform to accept device

I found this file on /usr/share/cumulocity-rpi-agent/cfg on this location

Related

Serial port unavaliable arduino

Trying to upload a code to arduino, but whether in the Arduino IDE or Arduino Create, both return this erro while uploading. Running on Linux Tara(mint 19 cinnamon).
./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -logger humantags -fqbn arduino:avr:mega:cpu=atmega2560 -build-cache /tmp -build-path /tmp/716441957/build -verbose -libraries /tmp/716441957/custom -libraries /tmp/716441957/pinned /tmp/716441957/sketch_oct8a
Sketch uses 8280 bytes (3%) of program storage space. Maximum is 253952 bytes.
Global variables use 443 bytes (5%) of dynamic memory, leaving 7749 bytes for local variables. Maximum is 8192 bytes.
Programming with: Serial
Flashing with command:/home/jesus/.arduino-create/arduino/avrdude/6.3.0-arduino9/bin/avrdude -C/home/jesus/.arduino-create/arduino/avrdude/6.3.0-arduino9/etc/avrdude.conf -q -q -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino-create-agent734074237/sketch_oct8a.hex:i
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
1#
First, check the port in your IDE. In Arduino tools->port
If the port is hidden or you can not move the cursor over this then run this commands in your terminal.If everything ok then skips this and follow the second part.
sudo apt-get install librxtx-java -y
sudo usermod -aG dialout $USER
sudo apt-get install gnome-system-tools
2#
After this again check the first method. If it is not working then run this commands
ls -l /dev/ttyACM*
sudo usermod -a -G dialout <username>
You probably have another program running which is already using this port.
You should close most other programs like putty or another serial monitor app.
Otherwise, try to reconnect the Arduino to the PC.
I know that these ideas below come from using a Teensy, but they may help you.
Sometimes there are the ACM* ports listed in the Arduino IDE. Try looking at the ser ports. I know when I am running my Teensy, sometimes I have them switched and need to select the correct one.
Also, from my experience with the Teensy, you might need to add a udev rule to allow permissions to access the port from non-root user. Here is the link that shows the udev file.
There is no direct way to solve this issue. In addition to it, you are not using an IDE. I will list the things you need to check, I am sure this will solve your problem.
I am not good at Linux environment so I will refer to applications names as window, you go the corresponding application in Linux.
Go to linux device manager and see for your arduino board. It should have proper naming like "arduino uno at port 3", then use the correct port in your command. If this name does not come properly then it means Driver is not available in your machine. So, go to step2.
Find the driver online and install it in your system, I am not sure about the support of linux with arduino, once it is done please repeat step1.
So, I conclude in short that you do not have the proper driver (which is strongly believe) or pointing the wrong port. I am not an expert with the udev rules, but it is definitely an issue you can experience with these kinds of micro-controllers.

How to solve apt-get command not found

Hi i am a new with ubuntu and linux,I'm working on baxter robot i have couple problems ..
As i follow the guide steps i have a command that i need to edit a gedit file and write my pc's hostname & ip_address :
gedit baxter.sh
i did it couple times and when i make the ssh connection when i write :
. baxter.sh
i get a not :
EXITING - Please edit this file, modifying the 'baxter_hostname' variable to reflect Baxter's current hostname.
after that i get error on rosrun,apt-get,rosnode commands
sudo: apt-get command not found
it worked ones when i changed baxter.sh ip address and hostname for first time and that time i didnt get that note, i dont know if that relevant just for more information .
thnx for help
To fix
EXITING - Please edit this file, modifying the 'baxter_hostname' variable to reflect Baxter's current hostname.
The first step is to make sure you set the baxter hostname. Per the baxter sdk guide:
Baxter's hostname is defaulted as the robot's serial number. The serial number can be located on the back of the robot, next to the power button.
Alternatively, you can find your robot's hostname by plugging a USB keyboard into the back of Baxter and pressing Ctrl+Alt+F3.
You can edit this by opening the file in your terminal (via gedit) or you can navigate to the file using your file browser and change it in a text editor.
To fix
sudo: apt-get command not found
Checkout some of the documentation on the baxter.sh script.

Can you help me access Mac SMB share from Ubuntu using smbclient? (NT_STATUS_ACCESS_DENIED error)

I've been working on a file server product that uses smbcilent to transfer files between client computers and the server. It's been working great so far with our LAMP (Ubuntu) server and Windows machines.
I'm currently trying to expand the setup to include Mac's, but am having trouble with the server accessing the share on the Mac.
Here's my command and error (bracketed descriptions replace private info):
# smbclient //10.101.0.7/[share-file] -U [username]%[password] -c ls
WARNING: The "syslog" option is deprecated
NTLMSSP packet check failed due to short signature (0 bytes)!
NTLMSSP NTLM2 packet check failed due to invalid signature!
session setup failed: NT_STATUS_ACCESS_DENIED
Things I've tried:
✓ Accessing share using a Windows machine to ensure the share is setup properly - check! Works fine there.
✓ Invoking -S off or --signing=off in the command - no change.
✓ Just looking at the shares first using smbclient -L 10.101.0.7 -U [username]%[password] - same error.
✓ Googling for an answer - check! Several people with similar problems, but no working solutions so far.
The most promising thing I've see so far involves compiling smbclient 4.4 from sources and running that with no authentication (-U ""%""), but that seems like a temporary solution based on a bug rather than a solid plan that will work for a long time. (But I'll try that next if I can't find any better ideas...)
Thanks for reading and trying to help!
Try adding --option="ntlmssp_client:force_old_spnego = yes" to the smbclient command as suggested on the samba-technical mailing list.
For me, this now lists shares on a Mac OSX server:
smbclient -U$user%$password -L $mac_host --option="ntlmssp_client:force_old_spnego = yes"
For mounting, you may need to add the nounix,sec=ntlmssp options as in
sudo mount -t cifs //$mac_host/$share $mountpoint -o nounix,sec=ntlmssp,username=$user,password=$password
On recent versions of MacOS (e.g. Monterey) it is necessary to do several configuration steps to enable smb access from Linux:
Open System Preferences.
Select Sharing.
Select File Sharing.
Ensure that the directory is listed in Shared Folders.
Right-click/two-finger click on the share directory.
Click on Advanced Options
Ensure Only allow SMB encrypted connections is checked.
Click OK
Click on Options
Click on the checkbox for Share files and folders using SMB.
Under Windows File Sharing ensure the appropriate user is checked.
Type the user's password in the 'Authenticate' dialog bo and press 'OK'.
Click 'Done'.
You should now be able to connect from Linux to the MacOS share using the commands given by #mivk.

How to reply to a USSD menu using Linux command line tools?

I want to obtain information about the account balance of a SIM card I have installed in a mobile broadband modem in my computer. For my mobile network operator, this works using the USSD code 100#.
I found that gammu can send that USSD code using gammu getussd '100#'. In response, gammu shows me this USSD menu:
Press Ctrl+C to break...
USSD received
Status : Action needed
Service reply : "Reply with your option:
1.Account Balance
2.Buy a Data Plan
3.Top Up Now
No response in specified timeout. Probably phone not connected.
How can select an option from that menu (like, 1)?
It seems to me that ModemManager (and its command line client interface mmcli) is currently the most sophisticated, highest-quality solution for interacting with USSD and USSD menus under Linux.
Installation (under Debian / Ubuntu Linux):
sudo apt-get install modemmanager modem-manager-gui
Usage (following the manpage):
Listing your modems: mmcli -L. This will show a modem device path like /org/freedesktop/ModemManager1/Modem/12 and you can use the number at its end to specify the modem to use after the -m option in the following commands.
Showing attributes of your modem: mmcli -m 12.
Enabling the modem (needed before using it for USSD): mmcli -m 12 -e
Starting a USSD session. For example, for Ncell this command shows the main USSD menu: mmcli -m 12 --3gpp-ussd-initiate="*100#"
Responding to a USSD menu. After the session is started, you may use a command like this to respond, here using option 1: mmcli -m 12 --3gpp-ussd-respond="1"
Canceling the USSD session on the given modem: mmcli -m 12 --3gpp-ussd-cancel.
Obtaining the status of all USSD sessions (of all available modems): mmcli --3gpp-ussd-status.
With most hardware, this should work properly and immediately as described.
(With my hardware however, I could not use mmcli so far due to a bug. All USSD related commands in mmcli would reply error: modem not unlocked yet, and mmcli -m 12 | grep " lock" would show that the sim-pin2 lock is enabled. But it is not (means I could not get past this by disabling the lock). And even if it would be enabled, that lock would not limit USSD usage (it's rather just meant for limiting outgoing calls to certain numbers). So, I'll have to remove this overzealous test condition from here, compile it myself and test again … .)
The Linux command line tool gsm-ussd has support for USSD sessions that will allow you to answer to USSD menus. For detailed installation and configuration instructions see here. The version 0.4 Debian package offered there for installation is the latest dev branch version.
However, the support for this is not yet stable [source]. At least for me, it does not work. With different hardware and / or mobile network operators, you might have more luck.
The way it is meant to be used is like this (using Ncell as example):
$ gsm-ussd -m /dev/ttyUSB1 "*100#"
USSD session open, to cancel use "gsm-ussd -c".
1 Account
2 Services operations
3 Offices information
4 How to call Call Center
5 Change password
Note:
Back:* Top:#
To reply and select an option, you would send something like:
$ gsm-ussd -m /dev/ttyUSB1 "1"
To end the session and return back to normal single-command USSD mode, you would execute gsm-ussd -c. More complete documentation is here.
I found that I can successfully navigate USSD menus with AT commands directly. Given my system's issues with the otherwise preferable mmcli solution (see my other answer for details), this is so far the only working solution to navigate USSD for me.
How to get this to work:
(1) Install an AT terminal. I chose atinout to communicate with the modem via AT commands. You can also use any other AT terminal software like putty, minicom etc.. To install atinout:
sudo apt-get install ruby-ronn;
git clone git://git.code.sf.net/p/atinout/code atinout;
cd atinout;
make;
sudo checkinstall make install;
(2) If you use ModemManager (which is the default under Ubuntu Linux), you might have to disable it first to allow atinout to access your modem:
sudo stop modemmanager;
(3) Now, to receive and reply to an USSD menu, you would use a command like this:
atinout - /dev/ttyUSB1 - < <(echo "AT+CUSD=1,\"100#\",15") && sleep 4 && \
atinout - /dev/ttyUSB1 - < <(echo "AT") && \
\
atinout - /dev/ttyUSB1 - < <(echo "AT+CUSD=1,\"1\",15") && sleep 4 && \
atinout - /dev/ttyUSB1 - < <(echo "AT");
This assumes your modem is at /dev/ttyUSB1 and the code to receive the USSD menu is 100#. Adapt to your situation.
Explanation: The command sends 100# to the network to receive the USSD menu, and then 1 to choose the first option. Spreading one USSD menu session over multiple atinout calls like this does not break the session if you don't exceed the timeouts (which are usually >20s).
Troubleshooting: If the above all-in-one command does not work, try executing the individual parts manually, repeating those that fail. If something fails repeatedly ("resource busy" etc.), your modem might be in a strange state. Reset it, or just let the computer go through a suspend / resume cycle.
It's currently not possible with Gammu command line, but you can use simple Python script using python-gammu: https://github.com/gammu/python-gammu/blob/master/examples/service_numbers.py
The answer from the link below worked great for me.
You can add the modemmanager PPA and update your apt. There's a bug mentioned in the link for some usb modems, but that has been fixed with the update
sudo add-apt-repository ppa:aleksander-m/modemmanager-xenial<br>
sudo apt-get update
Then follow this: https://stackoverflow.com/a/31864567/6161579
Thanks #tanius

Configure Raspberry Pi as WIFI Access Point / Hotspot / File Server

So I have a Raspberry PI set up as an access point and I can connect to it as if it was a router to share an internet connection.
just like explained here: http://www.instructables.com/id/How-to-make-a-WiFi-Access-Point-out-of-a-Raspberry/
Now all I want this for is just so I can access files from the RPi and transfer them to other devices.
The question is how can I (after a device connected the RPi via WiFi) access files from the RPi?
You can install any number of server applications to share files, like FTP or HTTP. If you want to share files with computers running Microsoft Windows® the best bet would probably be SAMBA. To do this from the command line, try the following steps:
sudo apt-get install samba samba-common-bin
and then after it's installed you need to edit the configuration:
sudo nano /etc/samba/smb.conf
Uncomment the line that says # security = user by removing the # from the beginning of the line. You also need to find where it says read only = yes in the [homes] section and change it to read only = no. Press [CTRL]+X to exit nano and press y to save.
Then restart the SAMBA service with the new configuration:
sudo service samba restart
Finally, you have to add a password for each user. for the default user pi just enter:
sudo smbpasswd -a pi
Repeat the above command for each user you wish to add.
You should now be able to access your Pi's files from your Windows computer by navigating to it just like any other shared folder: \\raspberrypi\pi or in my case I have to use the IP address because of my network setup \\192.168.0.209\pi

Resources