How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

October 5, 2015

Comodo intermediate certificate

Filed under: Linux — Tags: , , , — admin @ 11:22 am

Well when try to install a ssl certificate from comodo they send you a zip with 4 files.
AddTrustExternalCARoot.crt
COMODORSAAddTrustCA.crt
COMODORSADomainValidationSecureServerCA.crt
www_domain_com.crt

If you want to install this on apache it sholuld be something like this

SSLCertificateFile /path/www_domain_com.crt
SSLCertificateKeyFile /path/www_domain_com.key
SSLCACertificateFile /path/intermediate.crt

Where intermediate.crt is
cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > intermediate.crt

September 25, 2015

Remove all files created before a certain date

Filed under: Linux — Tags: , , , , — admin @ 12:45 pm

What I want is to delete manually all e-mail that are before 01/01/2015

The command is
find /directory/path -type f ! -newermt 2015-01-01 -ls -exec rm -f {} \;

September 22, 2015

centos /dev/md127 problem after reboot

Filed under: Linux — Tags: , , , , — admin @ 1:06 pm

Hello
Well today I want to explain about my raid experience.
I have to setup a hybrid server on hetzner. I setup the ssd on raid1 using installimage and those other hard drive I have create a raid from linux and mounted them on /raid1 directory .
However after reboot, my /dev/md4 disappear and a /dev/md127 appear.
To create the raid I have use this
fdisk /dev/sdc and /dev/sdd . Make a primary partition and set it up as fd software raid partition .

mdadm –create /dev/md4 –level=1 –raid-devices=2 /dev/sdc1 /dev/sdd1
mkfs.ext4 /dev/md4
mkdir /raid1
mount /dev/md4 /raid1

And insert this into fstab file
/dev/md4 /raid1 ext4 noatime,rw 0 0

So how to fix this ?
First I try to input some information into /etc/mdadm.conf but without luck . It appear that the linux read this late and the centos/ubuntu initalize this from initrd . So in order to fix this some steps have to be done .
After reboot try to fill the information into mdadm.conf with
ARRAY /dev/md/4 UUID=b3c33fe5:3b078681:e2776e37:4f9fd991
The UUID I have taken from

mdadm –detail /dev/md4

First unmount and stop the raid

mdadm –stop /dev/md127
After this assemble it again with your desire
mdadm –assemble /dev/md4 /dev/sdc1 /dev/sdd1

After this I have copy the
/boot/initramfs-2.6.32-573.3.1.el6.x86_64.img to a backup file ( initramfs-2.6.32-573.3.1.el6.x86_64.img-back ) in case something go wrong.

After this run
dracut –force

If is centos 5 or less you have to copy initrd file and to recreate use
mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)

On ubuntu you have to run
sudo update-initramfs -u

And restart the server.

September 16, 2015

wrong date on xen vps

Filed under: Linux — Tags: , , , , — admin @ 2:03 pm

If you ever are on vps and try to change time and you see it wrong , you can try this also

echo 1 > /proc/sys/xen/independent_wallclock

After this set the clock again .
For me worked .

August 14, 2015

Reinstall grub after raid crash

Filed under: Linux — Tags: , , , — admin @ 5:51 pm

Well today a client with hetzner server have a problem. Both hard from raid have failed. One is lost forever and one is with bad.
After I have run recover hard for rebuild in raid the server still didn’t boot up. My /dev/sda was faulty and replaced but server was stcuk and didn’t start .
I have to rebuild grub , the hetzner wiki have a tutorial but is not exactly .
So .. in order to start the server reboot in rescue system.
Then my partition table was something like this
/dev/md1 ( /boot ) /dev/md3 (/var) and /dev/md4 (/)

I run this in this order

mount /dev/md4 /mnt
mount /dev/md1 /mnt/boot
mount /dev/md3 /mnt/var

After this

chroot-prepare /mnt
chroot /mnt
grub-install /dev/sdb
grub-install /dev/sda

And the server was up and running .
From here you should be able to copy the partition table to new hard drive and start rebuilding the raid .

 

Another tutorial say something like this

# mount /dev/md1 /mnt
# mount -t none -o bind /dev /mnt/dev
# mount -t proc -o bind /proc /mnt/proc
# mount -t sysfs -o bind /sys /mnt/sys
# chroot /mnt

# grub

Look for the file stage1 to find the boot partitions

grub> find /grub/stage1
(hd0,1)
(hd1,1)

Install the bootloader on both partitions. Both are regarded as hd0 from the point of view of the bootloader at boot time.

grub> device (hd0) /dev/sda
device (hd0) /dev/sda
grub> root (hd0,1)
root (hd0,1)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
Checking if “/boot/grub/stage1” exists… yes
Checking if “/boot/grub/stage2” exists… yes
Checking if “/boot/grub/e2fs_stage1_5” exists… yes
Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… 17 sectors are embedded.
succeeded
Running “install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,1)…
succeeded
Done.

The same for the other disk

grub> device (hd0) /dev/sdb
grub> root (hd1,1)
grub> setup (hd0)
grub> quit

On another website found some differences

mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
mount -t dev -o bind /dev /mnt/dev
mount -t proc -o bind /proc /mnt/proc
mount -t sys -o bind /sys /mnt/sys
chroot /mnt
For debian 
apt-get install --reinstall grub-pc 
dpkg-reconfigure grub-pc 
« Newer PostsOlder Posts »

Powered by WordPress