Category Archives: Linux

Runtimeerror: CUDA error: out of memory [How to Solve]

Specific environment:

Untubu:16.04

pytorch :1.5.0

CUDA:10.0

When I was running code using pytorch, I encountered the following error:

RuntimeError: CUDA error:out of memory

I tried to look at many methods on the Internet, but there was no solution. Then I thought that I had run a similar code before, and there seemed to be such a line of code:

Then I try to add the following two lines of code to my code:

import torch.backends.cudnn as cudnn
cudnn.benchmark = True

Fortunately, my code is working properly. Of course, this may be one of the n methods. Everyone is likely to modify their own code according to the specific situation of their own code.

How to Solve Linux Kernel Compile Error

Linux Kernel Compile Error 1:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make[1]: *** [scripts/Makefile.host:9: scripts/kconfig/lexer.lex.c] Error 127
make: *** [Makefile:568: menuconfig] Error 2
Solution: Install the lexical parser flex, and the syntactic parser bison, respectively.
apt install flex
apt install bison

 

Linux Kernel Compile Error 2:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
Report an error: include/generated/timeconst.h' failed

Solution:
sudo apt-get install bc

Vmware-ubuntu 16.04 Start Virtual Machine Error [How to Solve]

1. VMware cannot start the virtual machine. The error message includes: another program has locked part of the file, and the process cannot access it   Cannot open disk “… \ XX. Vmdk” or a snapshot disk it depends on.

reason:

Probably the last time the virtual machine was shut down abnormally, VMware didn’t have time to open the lock.

Solution:

①   Delete the “XX.Vmdk.Lck” file in the same location as the disk file “XX.Vmdk” given in the error message (XX indicates the same name)

②   ifconfig -a   Only lo, no IP address, and only lo is written in the rules file.

1.   sudo lshw -C network   View the network card information, mainly the name of the logical network card, such as “ens33”.

2.   Local: this computer – Management – service and application – service, running all VMware related programs, including “volume shadow copy”.

3.    sudo dhclient ens33   Get the IP dynamically. Ens33 is the name you saw in step 1.

4.   You may need to restart.

③   Password required for immovable lock screen

1.   System Settings – Brightness & Lock   Set it yourself.

2.    Passwd – D username. Delete user password

Ubuntu darknet Error: Cannot load image“/home/…/1380.jpg” STB Reason: can’t fopen

Yolo3 training prompts that pictures cannot be loaded. I carefully compared the previous training sets, and found that the previous picture format was “.JPG”, the training format was “.JPEG”, and the error path was also “.JPG”. I tried to change the picture format to “.JPG” and found that I could successfully train.

Batch change suffix:

Execute in the directory where the picture is located

rename  's/\.jpeg/.jpg/' *.jpeg

CentOS 7: How to Solve Mysqlclient Install Error

centos7 install mysqlclient error problem
1.Install pip3 install mysqlclient error:

ERROR: Command errored out with exit status 1: command: /data/env/pyweb/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-noasaa4g/mysqlclient/setup.py'"'"'; file='"'"'/tmp/pip-install-noasaa4g/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-noasaa4g/mysqlclient/pip-egg-info cwd: /tmp/pip-install-noasaa4g/mysqlclient/ Complete output (12 lines): /bin/sh: mysql_config: command not found /bin/sh: mariadb_config: command not found /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-noasaa4g/mysqlclient/setup.py", line 16, in <module> metadata, options = get_config() File "/tmp/pip-install-noasaa4g/mysqlclient/setup_posix.py", line 61, in get_config libs = mysql_config("libs") File "/tmp/pip-install-noasaa4g/mysqlclient/setup_posix.py", line 29, in mysql_config raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_config not found ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

2. Analysis and solution: Check the error message:
mysql_config not found
Make sure the problem is with the mysql_config dependency package, add a soft link
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config found that it still doesn’t work, need to install mysql-devel first

yum install mysql-devel

Then install mysqlclient

pip3 install mysqlclient

[Solved] connecting to database ODBC under redhat8 (CentOS) reported SSL error: 141a318a

The environment is RedHat 8, including CentOS 8.

Whether Python or PHP, calling ODBC to connect to SQL server will report this error:

SSL Provider: [error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small]

The specific reason is that the security level is improved by default in radhat 8 system, the use of tls1.0 tls1.1 SSH2 is disabled, and 1024 bit DH key is not allowed.

Solution:

It is not recommended to reduce the default security level of RedHat 8. If your business is old or the database version is low, you have to downgrade it as root:

update-crypto-policies --set LEGACY

Centos7 Restart NIC error: Job for network.service failed because the control process exited with error code

centos7 Reboot NIC Report Error: Job for network.service failed because the control process exited with error code

[root@mina0 hadoop]# systemctl restart network

Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

[root@mina0 hadoop]# journalctl -xe

10月 26 17:15:57 mina0 network[3308]: Loopback interface being opened: [ OK]

Oct 26 17:15:57 mina0 NetworkManager[679]: <info> [1509009357.3386] audit: op="connec

Oct 26 17:15:57 mina0 network[3308]: opening interface ens33: error: failed to activate connection: No suita

Oct 26 17:15:57 mina0 network[3308]: [failed]

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 polkitd[680]: Unregistered Authentication Agent for unix-process

10月 26 17:15:57 mina0 systemd[1]: network.service: control process exited, code=exited

10月 26 17:15:57 mina0 systemd[1]: Failed to start LSB: Bring up/down networking.

-- Subject: Unit network.service has failed

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit network.service has failed.

--

-- The result is failed.

10月 26 17:15:57 mina0 systemd[1]: Unit network.service entered failed state.

10月 26 17:15:57 mina0 systemd[1]: network.service failed.

Solution:

# systemctl stop NetworkManager

# systemctl disable NetworkManager

Then: restart the network card:

# systemctl restart network

# ifconfig

Virtual machine error: Job for network.service failed because the control process exited with error code

1. Error:
today, I turned on the virtual machine to start a big data cluster. Because I didn’t turn on the machine for some time, I found that I couldn’t connect to the Internet after turning on the machine. After ifconfig, I didn’t even have an IP address:

2. Solution:
there are many opinions on the Internet. Most of them are to reconfigure the static IP of VI/etc/sysconfig/network scripts/ifcfg-ens33. In fact, the network card does not work. Finally, only one method works:

3 directives:

3. Reason:
on CentOS system, there are two network management tools, NetworkManager and network. Both configurations can cause conflicts. Generally, we use network to configure static IP. It may be that the shutdown (for some reason) causes the automatic configuration of NetworkManager, resulting in a conflict, so it’s good to disable it.

Temporary shutdown
systemctl stop NetworkManager
permanent shutdown
systemctl disable NetworkManager
Restart
systemctl restart network

ubuntu 20.04 “rosrun tf view_frames” [How to Solve]

ubuntu20.04 ROS noetic

Run in terminal

$ rosrun tf view_frames

report errors

1 Listening to /tf for 5.0 seconds
2 Done Listening
3 b'dot - graphviz version 2.42.3 (0)\n'
4 Traceback (most recent call last):
5   File "/opt/ros/melodic/lib/tf/view_frames", line 119, in <module>
6     generate(dot_graph)
7   File "/opt/ros/melodic/lib/tf/view_frames", line 89, in generate
8     m = r.search(vstr)
9 TypeError: cannot use a string pattern on a bytes-like object

Solution:

Run in terminal

1 sudo vim /opt/ros/noetic/lib/tf/view_frames

Then modify the code in the VIM edit that opens

1 m = r.search(vstr.decode('utf-8'))