Tag Archives: raspberry pie

[Solved] win32diskimager Error: An error occured when attempting to XXX, Error 5: Access is Denied

Problem Description:

today, you need to format the SD card as FAT32, and then write an img file to it. Use the card reader to connect the SD card to the host, and then use win32discriminator software to write an error to the specified drive letter: an error occurred when attempting to XXX, error 5: access is denied.

Problem-solving:

1) Download SD memory card formatter (official website)
2) select overwirte format to format
3) use win32diskimager to write again. Success!

I think some people on the Internet say that the card reader is broken. Change a card reader. You can try this method first. If not, replace the card reader.

[Solved] Error in OpenSSL when compiling code locally for raspberry pie

Error in OpenSSL when compiling code locally for raspberry pie

Error content

/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_keylog_callback@OPENSSL_1_1_1'
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_post_handshake_auth@OPENSSL_1_1_1'
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_ciphersuites@OPENSSL_1_1_1'

Raspberry pie still reports an error when querying the OpenSSL version number locally

openssl version

Error content:

openssl: /usr/lib/arm-linux-gnueabihf/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by openssl)
openssl: /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1: version `OPENSSL_1_1_1' not found (required by openssl)

Problem source:

After inquiry, it is mainly LD_LIBRARY_environment variable path is not specified, so OpenSSL is using the old system OpenSSL library

Solution:

Temporary solution: the terminal enters the following command to temporarily add the environment variables of OpenSSL library, but this method can only ensure that the current terminal is valid. If a new terminal is opened, an error will still be reported

export LD_LIBRARY_PATH=/usr/local/lib

Permanent solution: modify the. Bashrc hidden file in the working directory, taking raspberry pie as an example

vi /home/pi/.bashrc 
export LD_LIBRARY_PATH=/usr/local/lib 
source .bashrc 
sudo reboot 

You can also enter the following command

echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc 

After completing the above series of operations, you can enter the following commands to check whether it is normal

pi@raspberrypi:~ $ openssl
OpenSSL> version
OpenSSL 1.1.1l  24 Aug 2021
OpenSSL> q

Finally, the problem is solved and the compiled code is an error

Solution of apt unable to update in the docker container of raspberry pie

Today, apt failed to update when building the image with dockerfile on raspberry pie

...
 ---> Running in 05393fa6f242
Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
  At least one invalid signature was encountered.
Err:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
  At least one invalid signature was encountered.
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [101 kB]
Err:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
  At least one invalid signature was encountered.
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
Err:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
  At least one invalid signature was encountered.
Reading package lists...
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-security InRelease' is not signed.
...

The solution is:
in http://ftp.debian.org/debian/pool/main/libs/libseccomp/ Download the latest version of libseccomp2. The current version is libseccomp2_ 2.5.1-1_ Armhf. DEB
install on raspberry pie

>>> sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb

“20999;” 21448;”

[br] https://askubuntu.com/a/1264921/685786
https://stackoverflow.com/a/64463211/7151777

[Solved] Raspberry Pi Error: AttributeError: module ‘serial‘ has no attribute ‘Serial‘

Solution: you only need to install pyserial instead of serial. If serial has been installed, you can uninstall it.
—————————————————-
solution: open pychar on your computer and find that it can run. PIP list shows that only pyserial is installed, After importing serial, click in to see the specific method. It is found that the init.py of the serial on the computer is different from that on the raspberry pie
the raspberry pie on the computer is basically empty. You can run it after uninstalling the serial discovery program
I don’t know why all bloggers on Baidu search need to install serial and pyserial

How to set fixed IP address for Raspberry Pie

Recently, we need to realize the communication between three raspberry pie terminals in an Internet composed of two switches

Because raspberry pie has a gigabit network port, we need to match the IP addresses of three raspberry pies in the same network segment. So we need to change the address.

Unlike the computer version of Ubuntu system, raspberry pie is not easy to implement interface settings. Under Ubuntu, you just need to click the network icon, and then edit the wired link in the edit link at the bottom.

The method of configuring IP address for raspberry pie is as follows:

1. Now the terminal input ifconfig to view the local cable link interface

You can see that there is a wired connection port of enxb827bb3ef8a on the top, which is the name of the wired gateway. Or you can see it through the following of hwaddr

Remember the name

2. Terminal input:

sudo nano /etc/network/interfaces

Then a black interface (network configuration file) will be opened, which may display the following contents:

Then add the following:

auto lo
iface lo inet loopback
auto enxb827bb3ef8a  //It is the name of the previous view
iface enxb827bb3ef8a inet static
address 192.168.1.2    //IP address
netmask 255.255.255.0    //NetMask
gateway 192.168.1.1     //Gateway

Then press Ctrl + O to save, press enter to confirm, and press Ctrl + X to exit

Finally, use the sudo reboot command to restart

Several ways to check the IP address of raspberry pie

Method 1: get raspberry pie IP through ARP scan

Environment: computer and raspberry pie link in the same network; ARP protocol is a data link layer protocol, responsible for the conversion of IP address and MAC address.

ARP scan tool can scan all IP addresses of LAN;

To install ARP scan:

mac os
brew install arp-scanUbuntu
sudo apt-get arp-scan

Scan Ethernet IP address:

arp-scan --interface en0 --localnet 

Here, en0 is the device name of the network card, which can be obtained by ifconfig command. When there are multiple network cards, be careful not to write them wrongly;
when there are multiple network cards, en0 is the device name of the network card

The MAC address of raspberry pie usually starts with B8, so I matched B8. My implementation results are shown in the figure

Raspberry pie view IP address (command ifconfig) and exit Ping

1.1 raspberry pie view IP address with the following command:

ifconfig

The results are as follows

 

Note: Raspberry pie uses the command ifconfig to view the IP address, while the windows CMD command ipconfig to view the IP address.

 

1.2 the raspberry pie will continue to loop after the IP address is specified. If you want to exit the Ping loop, press the keyboard assembly: Ctrl + Z.

 

 

Reference content:

http://www.cnblogs.com/ma6174/archive/2013/09/29/3345278.html (Reference: View raspberry pie address command ifconfig)

Raspberry pie upgrade to Python 3.7.3

Install dependency packages

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev   
sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm 
sudo apt-get install -y libncurses5-dev  libncursesw5-dev xz-utils tk-dev

Find the corresponding version from the Python web page and click to download it.

sudo wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz

Third, extract the

sudo tar -zxvf Python-3.7.3.tgz

Unzip it and enter the generated directory python-3.7.3

cd Python-3.7.3

Install and compile Python

sudo ./configure && sudo make && sudo make install

6. After installation, create/modify the existing soft connection.
create soft connection (first time)

sudo ln -f /usr/local/bin/python3.7 /usr/bin/python
sudo ln -f /usr/local/bin/pip3.7 /usr/bin/pip

Modify the soft connection (more than once)

sudo ln -sf /usr/local/bin/python3.7 /usr/bin/python
sudo ln -sf /usr/local/bin/pip3.7 /usr/bin/pip

Seven, print version test

python3 -V
pip3 -V


success

Raspberry Pi USB drive-free camera error libv4l2: error setting pixformat: Device or resource busy, etc.

The article directories
Learn to record the causes of errors and their solutions

Learning record
I have searched many times on the Internet before, but I haven’t found a solution yet. Suddenly, I came up with a solution.
error

libv4l2: error setting pixformat: Device or resource busy
VIDEOIO ERROR: libv4l unable to ioctl S_FMT
libv4l2: error setting pixformat: Device or resource busy
libv4l1: error setting pixformat: Device or resource busy
VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT

What you see: Sometimes the camera doesn’t work, so you have to plug it in.
Reasons and solutions
I didn’t know why there was such an error. Recently, I read some relevant books and found that I was missing a key line of code.

int main( int argc, const char** argv )
{

	VideoCapture cap; 
	cap.open(0);
    if(!cap.isOpened())
        return -1;
        
    while(1)
    {
        Mat frame;
        cap >> frame; 
        imshow("Video", frame);
        if(waitKey(30) >= 0) 
        	break;
    }
    cap.release();
	return 0;
}

Where, the key sentence cap.release(); is used to release the cap of the camera.
will cause the above error if it is not released.

Compiling the pi_kernel source code appears: fatal error: openssl/opensslv.h: No such file or directory

The make error message appears in the Raspberry PI source code project
Build environment: Ubuntu14.04 32-bit system

scripts/sign-file.c:25:30: fatal error: openssl/opensslv.h: No such file or directory
 #include <openssl/opensslv.h>
                              ^
compilation terminated.
make[1]: *** [scripts/sign-file] Error 1
make: *** [scripts] Error 2

solution

$ sudo apt-get install libssl-dev

After the installation is complete, re-execute the make command.


development diary raspberries pie module driven 190401