Category Archives: Linux

[Solved] UnicodeEncodeError: ‘ascii‘ codec can‘t encode characters in position 3-9: ordinal not in range(128)

linux django UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 36-45: ordinal not in range(128)
error:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 36-45: ordinal not in range(128)

Solution:

vi ~/.bashrc
export LC_ALL=C.UTF-8
source ~/.bashrc

[Solved] Go use zoom to connect DM database and start reporting error in Linux

Golang, beego framework uses worm to connect DM database, and starts to report invalid memory address or nil point dereference under Linux

GOPATH=/home/wt207/go-space #gosetup
/home/wt207/go/bin/go build -o /tmp/___1go_build_main_go -gcflags all=-N -l /home/wt207/go-space/insight-client/main.go #gosetup
/home/wt207/GoLand-2021.1.3/plugins/go/lib/dlv/linux/dlv --listen=0.0.0.0:40223 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /tmp/___1go_build_main_go --
API server listening at: [::]:40223
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd34e4e]

goroutine 1 [running]:
gitee.com/chunanyong/dm.(*Properties).GetTrimString(0x0, 0x158d9c9, 0xc, 0x0, 0x0, 0x0, 0x0)
        /home/wt207/go-space/pkg/mod/gitee.com/chunanyong/[email protected]/zv.go:80 +0x6e
gitee.com/chunanyong/dm.(*DmConnector).mergeConfigs(0xc000034600, 0x15b2b55, 0x28, 0x0, 0x0)
        /home/wt207/go-space/pkg/mod/gitee.com/chunanyong/[email protected]/n.go:767 +0x274
gitee.com/chunanyong/dm.(*DmDriver).openConnector(0xc00015ce80, 0x15b2b55, 0x28, 0x0, 0x0, 0x0)
        /home/wt207/go-space/pkg/mod/gitee.com/chunanyong/[email protected]/p.go:79 +0x105
gitee.com/chunanyong/dm.(*DmDriver).OpenConnector(0xc00015ce80, 0x15b2b55, 0x28, 0x0, 0x0, 0x0, 0x0)
        /home/wt207/go-space/pkg/mod/gitee.com/chunanyong/[email protected]/p.go:63 +0x6d
database/sql.Open(0x157561c, 0x2, 0x15b2b55, 0x28, 0x0, 0x0, 0x0)
        /home/wt207/go/src/database/sql/sql.go:771 +0x1cb
gitee.com/chunanyong/zorm.newDataSource(0xc00007fb00, 0x0, 0x0, 0x0)
        /home/wt207/go-space/pkg/mod/gitee.com/chunanyong/[email protected]/dataSource.go:59 +0xdc
gitee.com/chunanyong/zorm.NewDBDao(0xc00007fb00, 0x0, 0x0, 0x0)
        /home/wt207/go-space/pkg/mod/gitee.com/chunanyong/[email protected]/DBDao.go:70 +0x6b
main.main()
        /home/wt207/go-space/insight-client/main.go:54 +0x91

Debugger finished with the exit code 0

The database connection configuration is as follows:

func main() {
	//Custom zorm log output
	//zorm.LogCallDepth = 4 //level of logging calls
	//zorm.FuncLogError = myFuncLogError //function to record exception logs
	//FuncLogPanic = myFuncLogPanic //logging panic log, default use ZormErrorLog implementation
	//FuncPrintSQL = myFuncPrintSQL // function to print sql

	//custom log output format, reassign FuncPrintSQL function
	//SetFlags(log.LstdFlags)
	//zorm.FuncPrintSQL = zorm.

	//dbDaoConfig database configuration. Here is just a simulation, production should be reading configuration configuration file, construct DataSourceConfig
	dbDaoConfig := zorm.DataSourceConfig{
		//DSN database connection string
		DSN: "dm://GO207:[email protected]:5236",
		//DSN: ". /db/test.db",
		//database driver name: mysql,postgres,oci8,sqlserver,sqlite3,dm,kingbase,aci and DBType correspond, handle databases with multiple drivers
		DriverName: "dm",
		// Database type (dialect judgment basis): mysql,postgresql,oracle,mssql,sqlite,dm,kingbase,shentong and DriverName correspond, processing database has more than one driver
		DBType: "dm",
		//MaxOpenConns Maximum number of database connections Default 50
		MaxOpenConns: 50,
		MaxIdleConns: 50, //MaxIdleConns: 50, //MaxIdleConns: 50
		MaxIdleConns: 50,
		//ConnMaxLifetimeSecond connection lifetime seconds. Default is 600 (10 minutes) after the connection is destroyed and rebuilt. MySQL default wait_timeout 28800 seconds (8 hours)
		ConnMaxLifetimeSecond: 600,
		//will use FuncPrintSQL to record SQL.
		PrintSQL: true,
		//DefaultTxOptions default configuration of transaction isolation level, default is nil
		//DefaultTxOptions: nil,
		//TxOptions{Isolation: sql.LevelDefault},
	}

	// Create dbDao according to dbDaoConfig, a database is executed only once, the first database to be executed is defaultDao, the subsequent zorm.xxx method, the default is used is defaultDao
	var err error
	dbDao, err = zorm.NewDBDao(&dbDaoConfig)
	// Mark the test as failed
	if err ! = nil {
		fmt.Println("dm database connection failed:", err)
	} else {
		fmt.Println("dm database connection successful")
	}

	beego.Run()
}

reason

The reason is to get the system default DM_ Svc.conf configuration file failed. According to the error prompt of the console, we can find the following method to get the DM of different systems_ SVC. Conf configuration file.

if filePath == "" {
    switch runtime.GOOS {
        case "windows":
	    filePath = os.Getenv("SystemRoot") + "\\system32\\dm_svc.conf"
        case "linux":
	    filePath = "/etc/dm_svc.conf"
        default:
	    return
    }
}

According to the default file path of windows system, find DM_ Open the SVC. Conf configuration file and find the following

TIME_ZONE=(480)
LANGUAGE=(cn)

Solution

Creating DM in /etc path of Linux virtual machine_ SVC. Conf configuration file, the content of which is similar to the OS. Getenv ("systemroot") + "\ \ system32 \ \ DM of windows_ SVC. Conf " DM under Path_ SVC. Conf configuration file can be consistent

[Solved] Ubuntu20.04 Error: “Failed to install the following Android SDK packages as some licences have not..“error

After installing Android studio under Ubuntu, importing the project and building, the following error appears:

The problem is that licenses are not matched well

There are only two steps to solving the problem:

1. Open file – & gt; Settings

After the settings interface appears, enter appearance – & gt; System Settings -> Android SDK -> SDK Tools

Download Android SDK command line tools (latest) in SDK tools interface

2. After downloading, CMD line tools will be installed in the SDK directory ~/Android/SDK by default. If your directory is different, you need to modify it accordingly

Execute on the command line

yes | sudo ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --licenses

The problem is solved. Build can run normally

Note: 1. In some articles, you can directly run the sdkmanager under ~/Android/SDK/tools/bin /, which will report an error

 java.lang.NoClassDefFoundError

The reason is that Ubuntu 20.04 installs OpenSDK 11 by default, which will conflict with the JRE that comes with Android Studio.
Uninstalling OpenSDK 11 and installing a lower version of JavaSDK is more troublesome.

[Solved] Git Error: OpenSSL SSL_read: Connection was reset, errno 10054和Failed to connect to github.com port 443

Question 1: OpenSSL_ read: Connection was reset, errno 10054

When using git to upload your own project, an error will be reported:

Cause of the problem

openssl ssl_ Read: connection reset, errno 10054

This is the SSL certificate of the server that has not been signed by a third party, so an error is reported.

This error is most likely caused by network instability and connection timeout. If you try again, you will still report an error.

Problem solving methods

Method 1

First, check whether the IP corresponding to the domain name of GitHub in the host file of Disk C is correct. If not, query the correct IP https://www.ipaddress.com/

If there is no problem with the IP address, upload it several times.

Method 2

If method one doesn’t work, modify the settings and remove SSL verification
Enter git bash here

Input

git config --global http.sslVerify "false"

At this point, the GIT operation can be executed again

if prompted:

fatal: not in a git directory

Then do it first

git init

Re input:

git config http.sslVerify "false"

Q2: failed to connect to github.com port 443: timed out

When using git push - U origin main to upload an item, another injury occurred:

Cause of the problem

Network problems or agency problems

Problem solving methods

It is found that there is no problem with the network, and the GitHub can be accessed normally,

reference material: https://blog.csdn.net/hustsselbj/article/details/46842191?utm_ medium=distribute.pc_ relevant_ t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase& depth_ 1-utm_ source=distribute.pc_ relevant_ t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

It is the problem of agency

Uncheck proxy server and use automatic detection settings

And then git push - U origin main , it’s successful.

Yum source error: [errno 14] HTTP Error 404 – not found

Trying other mirrors.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/



 One of the configured repositories failed (onlyoffice repo),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=onlyoffice ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable onlyoffice
        or
            subscription-manager repos --disable=onlyoffice

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=onlyoffice.skip_if_unavailable=true

failure: repodata/repomd.xml from onlyoffice: [Errno 256] No more mirrors to try.
http://download.onlyoffice.com/repo/centos/noarch/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

Reason: there is a problem with the yum source address. Either check the yum source or replace it with a new one.

The following is Baidu’s search result (error): Yum source file has a problem, not index cache. Clear cache is useless; So the way down here is a little bit big. Either view the yum source file, or change it to the yum source file on a normal machine</ mark>

This error is caused by a problem with the yum repository and can be solved by using the following two commands.
`yum clean all` # Clear the index cache of all yum commands
`rpm --rebuilddb` # The command to rebuild the RPM database

Solution 1: find the error report: http://download.onlyoffice.com/repo/centos/noarch/ Repair or delete the yum source file
solution 2: copy a Yum source from another normal Yum machine
verification method: Yum makecache verify whether the yum index cache can be generated normally, and remember to clear all the index caches first Yum clean all to verify

[Solved] Warning: detected “cgroupfs“ as the Docker cgroup driver. The recommended driver is “systemd“.

[root@localhost u01]#  kubeadm init –image-repository registry.aliyuncs.com/google_containers –kubernetes-version v1.21.2 –pod-network-cidr=192.168.0.0/16 –ignore-preflight-errors=NumCPU
[init] Using Kubernetes version: v1.21.2
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected “cgroupfs” as the Docker cgroup driver. The recommended driver is “systemd”. Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using ‘kubeadm config images pull’
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR ImagePull]: failed to pull image registry.aliyuncs.com/google_containers/coredns:v1.8.0: output: Error response from daemon: manifest for registry.aliyuncs.com/google_containers/coredns:v1.8.0 not found: manifest unknown: manifest unknown
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `–ignore-preflight-errors=…`
To see the stack trace of this error execute with –v=5 or higher
#Solved
cat <<EOF> /etc/docker/daemon.json
{
“exec-opts”: [“native.cgroupdriver=systemd”]
}
EOF
#restart docker
systemctl restart docker
[root@localhost u01]# kubeadm init –image-repository registry.aliyuncs.com/google_containers –kubernetes-version v1.21.2 –pod-network-cidr=192.168.0.0/16 –ignore-preflight-errors=NumCPU
[init] Using Kubernetes version: v1.21.2
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using ‘kubeadm config images pull’
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR ImagePull]: failed to pull image registry.aliyuncs.com/google_containers/coredns:v1.8.0: output: Error response from daemon: manifest for registry.aliyuncs.com/google_containers/coredns:v1.8.0 not found: manifest unknown: manifest unknown
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `–ignore-preflight-errors=…`
To see the stack trace of this error execute with –v=5 or higher
[root@localhost u01]#

Git error when switching branches: Your local changes to the following files would be overwritten by checkout

Problem:

reason:
the branch is switched between the staging area and the local warehouse before the changed file is submitted.

Solution: execute the following commands in turn

git add filename (with suffix) # commit the changed file to the staging area
git commit -m "Changed files" filename (with suffix) # Commit the changed files to the local repository

[Solved] Denseflow Install Error: fatal error: opencv2/cudaarithm.hpp: No such file or directory

Installing denseflow compiles with the following error./home/m/src/denseflow/src/denseflow_gpu.cpp:2:10: fatal error: opencv2/cudaarithm.hpp: No such file or directory
#include “opencv2/cudaarithm.hpp”
where the keywords are
/home/m/src/denseflow/src/denseflow_gpu.cpp
cudaarithm.hpp
The solution is as follows.
1、Find the path where cudaarithm.hpp is located

sudo find/-name "cudaarithm.hpp"

A path similar to:

/home/m/src/opencv_contrib/modules/cudaarithm/include/opencv2/cudaarithm.hpp
/home/m/include/opencv4/opencv2/cudaarithm.hpp
............
..............

Then fill the absolute path into denseflow_ Gpu.cpp replaces relative path

#You have to fill in the absolute paths, and our paths may be different, you have to follow your own
sudo vim /home/m/src/denseflow/src/denseflow_gpu.cpp

Before replacing
#include “opencv2/cudaarithm.hpp”
After replacement
#include “/home/m/include/opencv4/opencv2/cudaarithm.hpp”
Compile again, the problem is solved.

arm-eabi-gcc: command not found [How to Solve]

Scene

Busybox compiling arm architecture on Ubuntu

Operation

    1. install the cross compiler tool</ ol>
sudo apt-get install gcc-arm-linux-gnueabi
      1. modify the configuration file and use the cross compile tool </ OL>
make defconfig
vim .config
# Modify
...
-# CONFIG_STATIC is not set
+CONFIG_STATIC=y
....
-CONFIG_CROSS_COMPILER_PREFIX=""
+CONFIG_CROSS_COMPILER_PREFIX="arm-linux-gnueabi-"
...
        1. compiling busybox of arm architecture
make android_defconfig

reference resources

https://github.com/yongce/AndroidDevNotes/blob/master/notes/tools/0006-busybox-android.asc