Tag Archives: CentOS

CentOS Error: Failed to set locale, defaulting to C

-bash: local: can only be used in a function
[root@VM-24-5-centos ~]# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
[root@VM-24-5-centos ~]# echo “export LC_ALL=en_US.UTF-8” >> /etc/profile
[root@VM-24-5-centos ~]# source /etc/profile
[root@VM-24-5-centos ~]#

Solution to Samba inaccessibility caused by CentOS turning on SELinux

SELinux is enabled by default when installing CentOS, so samba, FTP and other applications cannot access the corresponding directories. The solution is as follows:

Enable Samba user home directory permission

/usr/sbin/setsebool -P samba_enable_home_dirs=1

Turn on single shared directory (path) permission

chcon -t samba_share_t path

Open all shared directories

Read-only rights

/usr/sbin/setsebool -P samba_export_all_ro on

read-write permission

/usr/sbin/setsebool -P samba_export_all_rw on

Check whether a directory (path) has permission enabled

ls -ldZ path

[Solved] Error in installing RPM package in CentOS – no key

Because this machine is newly installed centos7 , NC – netcat is not installed by default, so an RPM package is downloaded. The installation error is as follows:

[cos@localhost Desktop]$ ls
[cos@localhost Desktop]$ rpm -ivh netcat-0.7.1-1.i386.rpm 
Warning: netcat-0.7.1-1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID b2d79fc1: NOKEY
Error: Dependency detection failed.
    libc.so.6 required by netcat-0.7.1-1.i386
    libc.so.6(GLIBC_2.0) is required by netcat-0.7.1-1.i386
    libc.so.6(GLIBC_2.1) required by netcat-0.7.1-1.i386
    libc.so.6(GLIBC_2.3) required by netcat-0.7.1-1.i386

The GPG key of CentOS was originally required

To   http://centos.ustc.edu.cn/centos/7/os/x86_64 /, download and import the corresponding GPG key to solve the problem( This machine is rpm-gpg-key-centos-7)

Then import with GPG command:

[cos@localhost Desktop]$ gpg --quiet --with-fingerprint ./RPM-GPG-KEY-CentOS-7 
gpg: A new configuration file '/home/cos/.gnupg/gpg.conf' has been created
gpg: Warning: The options in '/home/cos/.gnupg/gpg.conf' were not used during this run
pub  4096R/F4A80EB5 2014-06-23 CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>
Key Fingerprint = 6341 AB27 53D7 8A78 A7C2  7BB1 24C6 A8A7 F4A8 0EB5


Import the RPM package of netcat again to succeed:

[cos@localhost Desktop]$ rpm netcat-0.7.1-1.i386.rpm 
RPM Version 4.11.1
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely distributed under the terms of the GNU GPL

Usage: rpm [-aKfgpqVcdLilsiv?] [-a|--all] [-f|--file] [-g|--group]
        [-p|--package] [--pkgid] [--hdrid] [--triggeredby] [--whatrequires]
        [--whatprovides] [--nomanifest] [-c|--configfiles] [-d|--docfiles]
        [-L|--licensefiles] [--dump] [-l|--list] [--queryformat=QUERYFORMAT]
        [-s|--state] [--nofiledigest] [--nofiles] [--nodeps] [--noscript]
        [--allfiles] [--allmatches] [--badreloc] [-e|--erase <package>+]
        [--excludedocs] [--excludepath=<path>] [--force]
        [-F|--freshen <packagefile>+] [-h|--hash] [--ignorearch] [--ignoreos]
        [--ignoresize] [-i|--install] [--justdb] [--nodeps] [--nofiledigest]
        [--nocontexts] [--noorder] [--noscripts] [--notriggers]
        [--nocollections] [--oldpackage] [--percent] [--prefix=<dir>]
        [--relocate=<old>=<new>] [--replacefiles] [--replacepkgs] [--test]
        [-U|--upgrade <packagefile>+] [-D|--define “MACRO EXPR”]
        [--undefine=MACRO] [-E|--eval “EXPR”] [--macros=<FILE:…>]
        [--nodigest] [--nosignature] [--rcfile=<FILE:…>] [-r|--root ROOT]
        [--dbpath=DIRECTORY] [--querytags] [--showrc] [--quiet]
        [-v|--verbose] [--version] [-?|--help] [--usage] [--scripts]
        [--setperms] [--setugids] [--conflicts] [--obsoletes] [--provides]
        [--requires] [--info] [--changelog] [--xml] [--triggers] [--last]
        [--dupes] [--filesbypkg] [--fileclass] [--filecolor] [--fscontext]
        [--fileprovide] [--filerequire] [--filecaps]

If you encounter this problem, follow the above methods and hope to solve your problem note: select the corresponding system version and GPG key file

[Solved] SELinux intercepts vsftpd for CentOS (without shutting down SELinux)

Vsftpd is an FTP server program, and SELinux is the firewall component of CentOS. Since vsftpd is intercepted by SELinux by default, the following FTP problems are encountered:

226 transfer done (but failed to open directory)

550 failed to change directory

550 create directory operation failed

553 Could not create file.

Or simply after sending the list command, the server does not respond and disconnects after timeout (500 oops: vsftpd: chroot)

In case of such a problem, usually vsftpd does not have sufficient permissions, which is likely to be blocked by SELinux. The popular solution on the network is to turn off SELinux directly, which will cause other security problems, so there are other better ways

To determine if this is the problem, we need to try to turn off SELinux to see if it is the cause

setenforce 0 #Temporarily put SELinux into Permissive mode

Try again after running. If FTP can get the directory, upload and download, it is proved that SELinux is the cause

Solution: we can run getsebool – a | grep ftpd to determine the view permissions

getsebool -a | grep ftp

#The following is the displayed permissions, off is off permissions, on is open permissions, has been set, not set when all is off
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> on
ftpd_full_access --> on
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> on

Among them, FTP_ home_ Dir and allow_ ftpd_ full_ Access must be on to enable vsftpd to access the FTP root directory and transfer files

Run the following command:

setsebool -P ftp_home_dir 1
setsebool -P allow_ftpd_full_access 1

Note that these two commands usually take more than ten seconds to run

After running, we will resume SELinux and enter the forcing mode

setenforce 1 #Entering Enforcing Mode

If there is no accident, we can access the FTP directory, and vsftpd can upload and download files normally

But if this problem has not been solved, it may be that the directory attribute of FTP access is not enough. It is recommended to use Chmod – R 777 path to set the read-write property of the path to 777, and then try again, which can usually solve the problem

Solve the problem of / dev / root does not exist when installing CentOS on U disk

There’s something wrong with centos7. Make a record

First of all, although the U disk can’t install CentOS 7, and it always reports script timeout, it can still enter the command prompt


Switch to the dev directory

#cd /dev


You will see your U disk, usually the second hard disk, such as sdbx

OK, then remember this. For example, if you see that it is/dev/sdb4, now reboot, enter the Startup menu option, and press e to enter edit mode,

In the menu, vmlinuz initrd = initrd. Imginst. Stage2 = HD:

LABEL=CentOS\x207\x20x86_ 64 rd.live.check


Change to: vmlinuz initrd = initrd.img inst.stage2=



Then according to the following instructions, press the shortcut key (Ctrl + x) to restart and install.

[Solved] Centos Install MYSQL Error: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

When installing MySQL in CentOS, an error is reported when executing the command mysqld — initialize/lib/LD Linux. So. 2: bad elf interpreter: no such file or directory

This is because a 32-bit program is installed in a 64 bit system

Install glibc.i686:

yum install glibc.i686

After executing the glibc.i686 installation command, we continue to execute mysqld — initialize and find that the system still reports an error:

error while loading shared libraries: libz.so.1:

cannot open shared object file: No such file or directory

This is because the zlib.i686 component is missing in the system. Let’s continue to install zlib.i686:

yum install zlib.i686 --setopt=protected_multilib=false <!--The setpot parameter handles multiple library coexistence conflicts-->

At this point, if you continue to execute mysqld — initialize, the package still lacks i686 components. Later, the blogger continued to install various missing components, and found that this is not the way to do it. It is estimated that there are hundreds of such components missing. I don’t know when the installation will end. Later, I continued to search for methods on the Internet, Finally, we found a way to install all the components needed by 32-bit programs

yum install xulrunner.i686  <!--ia32-libs.i686 //is ubuntu series, and after 13.10 ubuntu also seems to have no this-->

CentOS prompt – bash: Make: command not found solution

How did “people you might know” find you on social software>>>

Generally, the – bash: Make: command not found prompt appears because the mini installation is used when installing the system. The system does not install common commands such as make and VIM, so you can directly install them using yum

yum -y install gcc automake autoconf libtool make

Centos Systemctl Error getting authority: Error initializing authority: Error calling StartServ…


[root@iZbp1he0bdge2g92l9fjnxZ ~]# systemctl  restart  zabbix-agent
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)
Failed to restart zabbix-agent.service: Connection timed out
See system logs and 'systemctl status zabbix-agent.service' for details.

When installing the service using centos 7.4 an error was reported.

Error reported when starting zabbix.

Centos using Systemctl reports Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)

Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)


ps -ef |grep polkit

 pyum reinstall polkit


[Solved] CentOS Install Oracle19c Error: /lib//libclntsh.so: file format not recognized; treating as linker script

Environment: centos7.6 oracle19c

To install an Oracle 19C server on Linux, I have not touched the Linux command for a long time. I have almost forgotten about it. After experiencing the problem of no permission (I have permission to view the file attributes, and finally reset the MKDIR path), xdpyinfo and so on, when I finally entered the graphical interface, I had a crash problem

Graphical installation, in the pre check after the install step to report the error dialog box: figure no error, the content is as follows

makefile ‘/oracle/product/10.2.0/db_ 1/rdbms/lib/ins_ Target ‘libasmclntsh19.ohso libasmperl19.ohso client’ of RDBMS. MK ‘_ Error in sharedlib ‘. Please refer to ‘/ TMP/installactions2021-02-04_ 03-36-27PM/installActions2021-02-04_ 03-36-27PM.log’

Then I went to check the error file and found the following:

/usr/bin/ld:/u01/app/oracle/product/19.2.0/db_ 1/lib//libclntsh.so: file format not recognized; treating as linker script

/usr/bin/ld:/u01/app/oracle/product/19.2.0/db_ 1/lib//libclntsh.so:1: syntax error

lib// libclntsh.so How can there be two libclntsh.so//

solution process:

Baidu first, as like as two peas, someone and I have the same problem, the same mistake. Please click the link to set up 1 according to his method. There’s only one environment. His method 2 doesn’t work

Take a look at the actual error. Go to lib and find the libclntsh.so file. It exists, and it’s under lib /. How can there be one more /?View the. Bash of Oracle users_ profile,ORACLE_ HOME,LIB_ Path and other configuration items, no problem, no more writing after lib/

Bing international, there are some foreigners who have encountered this problem in Oracle support. Can we solve this problem?I’m glad to go in and disappointed to come out. The answer is to support the account. It’s a real pit

Let’s take a look at the online installation tutorials (some of the tutorials are pitiful, there are obvious errors, copy and paste if you don’t write them well…), check one by one, I suddenly find a problem, in the tutorial, unzip command is used to unzip, and I unzip the 19C zip package under windows, and then copy the unzip content to CentOS machine with winscp, sure enough, I put the zip package on CentOS, unzip it, and then install it. Finally, this shit problem is gone… Who would have thought

Summary: in the future, things in Linux must be decompressed on Linux