EzDevInfo.com

centos6 interview questions

Top centos6 frequently asked interview questions

ipmitool - can't find /dev/ipmi0 or /dev/ipmidev/0

Based on a previous question, I installed ipmitool (yum install ipmitool).

Even after a reboot, though, i get the following error when trying to run ipmitool power status:

Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
Unable to get Chassis Power Status

Is this an OS/hardware issue (CentOS 6.3 x64 on a hosted machine in a remote datacenter - unsure on hardware vendor)? Or have I missed something more elemental in installing ipmitool?


Source: (StackOverflow)

How do I upgrade to the latest PHP version in CentOS with yum?

I found some blog posts about this, but it's rather lack of descriptions on possible side effects.

I could really use some detailed on these steps:

  1. How to add a repo that provides PHP 5.4 into yum
  2. Can this seamlessly replaces the current PHP version in CentOS?
  3. How can I switch back to the official repo when it supports PHP 5.4? (current 5.3.3 in my system)
  4. Will there be any potential to break PHP modules I currently using?

Note

People successfully upgraded with the same method on newer versions, and suggest removing specific versions in the question. While it is good to pin down versions in case newer versions actually breaks something, I'd like keep the latest succeed version suggested by the community as a note.

Feel free to update this if you have successfully upgraded on other versions.

  • PHP versions: 5.4, 5.5, 5.6
  • CentOS version: 5, 6

Source: (StackOverflow)

Advertisements

How do I configure LDAP on Centos 6 for user authentication in the most secure and correct way?

During the last couple of days I have been using a lot of F-words, while browsing Internet for good documentation about how to setup an LDAP-server. So far I have found none, but plenty that are less then good, but better then bad. So I had to do it the usual Linux way, read, test, scream, read, test and scream.

What I would like to do is the following.

  • Installed on a Centos 6 minimum installation, both for server and clients.
  • Installed in a correct way, the way the developers of openldap intended it to be done.
  • Installed in a secure way. LDAPS, Iptables, SELinux etc. enabled.
  • Using SSSD on the clients for the "authentication" connections to the LDAP-server.

This question is of the kind that I answer myself, but I would appreciate if you have suggestions about how to do the installation even better.


Source: (StackOverflow)

Install PHP7 from Remi repo

I installed PHP7 from Remi repo with

sudo yum -y install httpd
sudo yum -y install epel-release
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 
sudo rpm -Uvh remi-release-6*.rpm
sudo yum -y --enablerepo=remi,remi-test install php70
scl enable php70 'php -v'
sudo ln -s /usr/bin/php70 /usr/bin/php

and it is working via CLI. Now I want to make it work with apache but i can't find a so to pass as a second argument to LoadModule

LoadModule php7_module        unknown_path  
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Is this the correct approach to make PHP7 to work with apache2?


Source: (StackOverflow)

How to check CentOS 6 Server VM Host after a power falure?

This afternoon, someone at our office decided to pull the plug out of our server because it was storming outside. They didn't shut it down, they just pulled the plug out while it was running.

The server has 4 SATA drives in a software RAID 10 configuration, and LVM running on top of the RAID. The Server is running CentOS 6.2 Minimal and is a virtual machine host using KVM. At the time that it was unplugged, there were many guest machines running on the computer. Each guest has one or more LVM partitions that it uses directly as hard drives. The guest partitions are EXT3, EXT4 and NTFS. The Host OS is on an EXT4 partition.

Later, when the power came back, that person plugged it back in, and it started up. Since they plugged it in without attaching a monitor first, there is no way to see what came up on the screen. I tried attaching a monitor now, but it won't work unless the monitor is connected at boot. I've left it on, exactly as is, until I can get some advice since I don't want to screw anything up (further).

I can get into the host via SSH. I have not rebooted it yet in case there is something in a log somewhere that might be useful.

What I need to do is check all the disks and partitions for data integrity, if that's even possible. I think RAID 10 uses some kind of memory based cache and I'm worried about the drives being inconsistent, or files being corrupt if there were things in the cue to write to the drive that hadn't been written yet.

[root@othello ~]# cat /proc/mdstat
Personalities : [raid10] [raid1] 
md2 : active raid1 sdc1[2] sda1[0] sdd1[3] sdb1[1]
      102388 blocks super 1.0 [4/4] [UUUU]

md0 : active raid10 sda3[0] sdc3[2] sdd3[3] sdb3[1]
      1952289792 blocks super 1.1 512K chunks 2 near-copies [4/4] [UUUU]
      bitmap: 0/15 pages [0KB], 65536KB chunk

md1 : active raid10 sdc2[2] sda2[0] sdd2[3] sdb2[1]
      1022976 blocks super 1.1 512K chunks 2 near-copies [4/4] [UUUU]

unused devices: <none>

It also bothers me that it's calling my arrays, "near-copies". Is that normal?

What kind of disk checks should I run to make sure everything is OK with the drives and data? Are there any other things I should check?

UPDATE

Output of mdadm --detail

[root@othello ~]# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.1
  Creation Time : Sat Feb 25 09:26:20 2012
     Raid Level : raid10
     Array Size : 1952289792 (1861.85 GiB 1999.14 GB)
  Used Dev Size : 976144896 (930.92 GiB 999.57 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Sun Mar 11 12:59:30 2012
          State : active 
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : near=2
     Chunk Size : 512K

           Name : othello.myserver.com:0  (local to host othello.myserver.com)
           UUID : 58ba40ab:12516733:e3779362:68200fdd
         Events : 2208

    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       1       8       19        1      active sync   /dev/sdb3
       2       8       35        2      active sync   /dev/sdc3
       3       8       51        3      active sync   /dev/sdd3

Source: (StackOverflow)

PECL command produces long list of errors

Currently running PHP 5.4 on CentOS 6.5.

I installed the webtatic php55w package then installed PEAR+PECL without issue along with redis and mongo through PECL.

Shortly after, I realized 5.5 is not compatible with the framework I was working with so I yum erased php55w and installed php54w in it's place.

Now the pecl command doesn't work at all. It just produces this really long string of errors every time I issue any pecl command (abbreviated...most repeated dozens of times):

Warning: Invalid argument supplied for foreach() in Command.php on line 259

Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 259

...etc etc etc...

Notice: Undefined index: honorsbaseinstall in Role.php on line 180

Notice: Undefined index: honorsbaseinstall in Role.php on line 180

...etc etc etc...

Notice: Undefined index: installable in Role.php on line 145

Notice: Undefined index: installable in Role.php on line 145

...etc etc etc...

Notice: Undefined index: phpfile in Role.php on line 212

Notice: Undefined index: phpfile in Role.php on line 212

...etc etc etc...

Notice: Undefined index: config_vars in Role.php on line 49

Notice: Undefined index: config_vars in Role.php on line 49

...etc etc etc...

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 259

Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 259

...etc etc etc...

XML Extension not found

How can I fix this?


Source: (StackOverflow)

Where is the correct place to set net.netfilter.nf_conntrack_buckets?

I'm currently trying to set net.netfilter.nf_conntrack_buckets on boot. I initially assumed that this could be done through sysctl.conf, but net.netfilter.nf_conntrack_buckets (and other net.netfilter configurations) were not applied at all. Adding sysctl -p to rc.local allowed all the net.netfilter configurations to be applied with the exception of net.netfilter.nf_conntrack_buckets. I'll also note that trying to set this from the terminal using sysctl -w results in 'error: permission denied on key 'net.netfilter.nf_conntrack_buckets''

# This should be applied at boot
net.netfilter.nf_conntrack_max=1966080
net.netfilter.nf_conntrack_buckets=245760

Where is the correct place to do this?


Source: (StackOverflow)

Changing the maximum mail size in Postfix

When sending large email to a new CentOS6 server running Postfix as the MTA, the following message is returned:

tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 552 552 5.3.4 Error: message file too big (state 18)

I found the following suggestion, but am unclear as to where it needs to be added in the main.cf file:

This was caused by Postfix and it's limit on not only messages but mailbox sizes.

I had to add this setting in /etc/postfix/main.cf:

message_size_limit = 31457280

How can the maximum mail size (including attachments) be increased in Postfix?


Source: (StackOverflow)

Is installing a GUI on my CentOS server a good idea?

I have a new dedicated server that I'm going to create a couple of VMs on. OS will be CentOS 6.5, for the host and the VMs.

Does the GUI on the host (Gnome etc) give any real benefit when it comes to handling the VMs? Or is it just sucking up system resources unnecessarily? Can you quantify how much? Does it affect resources all the time, or only when I'm viewing it?

What does it enable me to do that I can't do from the command line with virsh etc?

This is an E5-1650 (6 core, 12 threads) box with 32GB ram.

If you're of the opinion that a GUI is a useful thing to have, can you tell me which packages I need to install. I know "yum install Desktop" does the job, but it installs a hell of a lot of dependencies, and I wondered if there's a slimline alternative?


Source: (StackOverflow)

Persist IP address alias across reboots in CentOS/RHEL 6 using "ip" command

I've always used the ifcfg-eth0:1 alias files to create additional addresses. However, in recent rhel documentation, it states that:

As the ip command of the iproute package now supports assigning multiple address to the same interface it is no longer necessary to use this method of binding multiple addresses to the same interface.

Furthermore, numerous answers and comments on this site mention that ifconfig is deprecated and that "ip" should be used instead. I'm fine using it for live changes, but how do I persist the changes across reboots without using the alias files?


Source: (StackOverflow)

gpg --gen-key hangs at gaining enough entropy on centos 6

Trying to generate a key for a server.

gpg --gen-key

We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.

and it just hangs there.

There is another error:

can't connect to `/root/.gnupg/S.gpg-agent': No such file or directory

which seems to go away after:

gpg-agent --daemon
GPG_AGENT_INFO=/tmp/gpg-4c5hyT/S.gpg-agent:1397:1; export GPG_AGENT_INFO;

#GPG_AGENT_INFO=/tmp/gpg-4c5hyT/S.gpg-agent:1397:1; export GPG_AGENT_INFO;
gpg --gen-key
...

but again, it hangs at "...gain enough entropy".

There are no "++++++++++++++++++++++++++++++++++++++++++"'s which from forum posts looks like should be expected as the key is generated.

I have tried reinstalling the package, but seemingly everything depends on gpg.

I've read other people having problems with this on centos 6 too (whereas centos 5 works fine).

There is nothing remarkable in /var/log/*.

Any ideas on where to go from here?

Thanks.


Source: (StackOverflow)

CentOS 6 and locale error

I just installed CentOS 6 and whenever I login to the system via SSH remotely, I get the following error:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

When I type "locale" on the command line, I get the following output:

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
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

What can be the problem? How can I solve this issue?


Source: (StackOverflow)

In CentOS 6.x, how can I upgrade to Kernel 3.4?

I have a server running CentOS 6.2 with kernel version 2.6.32, but I need to increase my application Performance.

The Kernel Version 3.4 has x32abi which can improve the performance so i want to upgrade to 3.4 ? Is it possible?

I tried downloading kernel compiling and installing but still I see the same Kernel version..

What went wrong? I followed the process in mentioned in the link below.

http://www.tecmint.com/kernel-3-5-released-install-compile-in-redhat-centos-and-fedora/


Source: (StackOverflow)

Upgrade CentOS 5.x to CentOS 6.x - tips and techniques

Now that CentOS 6.0 is making its way to the various mirror sites, I wanted to solicit opinions on the upgrade process. In working with the commercial RedHat 5.6 and 6.x distributions for the past few months, I've been relying on a fresh install instead of an in-place upgrade for my test systems.

Since the real CentOS 6 release is here, is anyone planning on performing the migration in-place? Are there any situations where it makes sense? If so, what are the pitfalls of an in-place update?


Source: (StackOverflow)

HP DL380p Gen8 (p420i controller) I/O oddity on XFS partitions

On DL380p gen8 servers using XFS on top of LVM on top of raid 1+0 with 6 disks, an identical workload results in a ten-fold increase in disk writes on RHEL 6 compared to RHEL 5, making applications unusable.

Note that I'm not looking at optimizing the co6 system as much as possible, but at understanding why co6 behaves so wildly different, and solving that.

vmstat/iostat

We have a MySQL replication setup, using mysql 5.5. Mysql slaves on gen8 servers using RHEL 6 as OS perform badly, inspection with vmstat and iostat shows that these servers do ten times the page out activity and ten times the amount of writes to the disk subsystem. blktrace show that these writes are not initiated by mysql, but by the kernel.

Centos 5:

[dkaarsemaker@co5 ~]$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0     12 252668 102684 10816864    0    0     8   124    0    0  9  1 90  0  0
 1  0     12 251580 102692 10817116    0    0    48  2495 3619 5268  6  1 93  0  0
 3  0     12 252168 102692 10817848    0    0    32  2103 4323 5956  6  1 94  0  0
 3  0     12 252260 102700 10818672    0    0   128  5212 5365 8142 10  1 89  0  0

[dkaarsemaker@co5 ~]$ iostat 1
Linux 2.6.18-308.el5 (bc290bprdb-01.lhr4.prod.booking.com)  02/28/2013

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           8.74    0.00    0.81    0.25    0.00   90.21

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
cciss/c0d0      277.76       399.60      5952.53 2890574849 43058478233
cciss/c0d0p1      0.01         0.25         0.01    1802147      61862
cciss/c0d0p2      0.00         0.01         0.00     101334      32552
cciss/c0d0p3    277.75       399.34      5952.52 2888669185 43058383819
dm-0             32.50        15.00       256.41  108511602 1854809120
dm-1            270.24       322.97      5693.34 2336270565 41183532042

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           7.49    0.00    0.79    0.08    0.00   91.64

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
cciss/c0d0      300.00        32.00      4026.00         32       4026
cciss/c0d0p1      0.00         0.00         0.00          0          0
cciss/c0d0p2      0.00         0.00         0.00          0          0
cciss/c0d0p3    300.00        32.00      4026.00         32       4026
dm-0              0.00         0.00         0.00          0          0
dm-1            300.00        32.00      4026.00         32       4026

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           4.25    0.00    0.46    0.21    0.00   95.09

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
cciss/c0d0      507.00       160.00     10370.00        160      10370
cciss/c0d0p1      0.00         0.00         0.00          0          0
cciss/c0d0p2      0.00         0.00         0.00          0          0
cciss/c0d0p3    507.00       160.00     10370.00        160      10370
dm-0              0.00         0.00         0.00          0          0
dm-1            507.00       160.00     10370.00        160      10370

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           5.33    0.00    0.50    0.08    0.00   94.09

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
cciss/c0d0      318.00        64.00      4559.00         64       4559
cciss/c0d0p1      0.00         0.00         0.00          0          0
cciss/c0d0p2      0.00         0.00         0.00          0          0
cciss/c0d0p3    319.00        64.00      4561.00         64       4561
dm-0              0.00         0.00         0.00          0          0
dm-1            319.00        64.00      4561.00         64       4561

And on Centos 6 a ten-fold increase in paged out and disk writes:

[root@co6 ~]# vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 361044  52340 81965728    0    0    19  1804   36  110  1  1 98  0  0  
 0  0      0 358996  52340 81965808    0    0   272 57584 1211 3619  0  0 99  0  0  
 2  0      0 356176  52348 81966800    0    0   240 34128 2121 14017  1  0 98  0  0 
 0  1      0 351844  52364 81968848    0    0  1616 29128 3648 3985  1  1 97  1  0  
 0  0      0 353000  52364 81969296    0    0   480 44872 1441 3480  1  0 99  0  0  

[root@co6 ~]# iostat 1
Linux 2.6.32-279.22.1.el6.x86_64 (bc291bprdb-01.lhr4.prod.booking.com)  02/28/2013  _x86_64_    (32 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.08    0.00    0.67    0.27    0.00   97.98

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda             373.48      1203.02    115203.05   11343270 1086250748
dm-0             63.63        74.92       493.63     706418    4654464
dm-1            356.48      1126.72    114709.47   10623848 1081596740

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.25    0.00    0.19    0.06    0.00   99.50

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda             330.00        80.00     77976.00         80      77976
dm-0              0.00         0.00         0.00          0          0
dm-1            328.00        64.00     77456.00         64      77456

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.38    0.00    0.19    0.63    0.00   98.81

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda             570.00      1664.00    128120.00       1664     128120
dm-0              0.00         0.00         0.00          0          0
dm-1            570.00      1664.00    128120.00       1664     128120

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.66    0.00    0.47    0.03    0.00   98.84

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda             317.00       448.00     73048.00        448      73048
dm-0             34.00         0.00       272.00          0        272
dm-1            309.00       448.00     72776.00        448      72776

Narrowing down

Gen 8 servers using RHEL 5, and gen 7 servers using RHEL 5 or 6 do not show this problem. Furthermore, RHEL 6 with ext3 as filesystem instead of our default xfs does not show the problem. The problem really seems to be somewhere between XFS, gen8 hardware and centos 6. RHEL 6 also shows the problem.

Edit 29/04: we added qlogic HBA's t the G8 machine. Using XFS on fibre channel storage does not show the problem. So it's definitely somewhere in the interaction between xfs/hpsa/p420i.

XFS

The newer xfs in rhel 8 seems to be able to detect underlying stripe width, but only on p420i controllers using the hpsa driver, not p410i controllers using cciss.

xfs_info output:

[root@co6 ~]# xfs_info /mysql/bp/
meta-data=/dev/mapper/sysvm-mysqlVol isize=256    agcount=16, agsize=4915136 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=78642176, imaxpct=25
         =                       sunit=64     swidth=192 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=38400, version=2
         =                       sectsz=512   sunit=64 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

sunit/swidth are both 0 in all the setup marked as OK above. We seem to be unable to change this, either in mkfs or with the noalign mount option. We also don't know if this is the cause.

Hugepages

Other people having XFS problems on rhel 6, say that disabling hugepages, and especially transparent hugepages can be beneficial. We disabled both, the problem did not go away.

We tried and observed many things already, none of the following have helped:

  • Using numactl to influence memory allocations. We noticed that g7 and g8 have a different numa layout, no effect was seen
  • Newer kernels (as new as 3.6) did not seem to solve this. Neither did using fedora 17.
  • iostat does not report a ten-fold increase in write transactions, only in number of bytes written
  • Using different I/O schedulers has no effect.
  • Mounting the relevant filesystem noatime/nobarrier/nopdiratime did not help
  • Changing /proc/sys/vm/dirty_ratio had no effect
  • This happens both on systems based on 2640 and 2670 CPU's
  • hpsa-3.2.0 doesn't fix the problem

Source: (StackOverflow)