Kroko Just another WordPress weblog

January 2, 2011

Linux force reboot/shutdown

Filed under: Linux — Tags: , , , , — admin @ 1:53 am

Forcing reboot

Linux is not Windows XP and if reboot fail you usually still connect by SSH and do something. This commands will show you how to remotely hard reboot machine. Hard reboot mean that shutdown scripts will not run and machine reboot immediately without syncing hard disk drives, shutdown applications etc, it’s more like hitting the reset button.

echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

This commands enable sysrq and after this calls fast reboot. If you want to force shutdown machine try this.

Force shutdown

echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger

Pasted from
This came handy, when I had a server that had some IO error and it can no longer read from disk, only few cached binaries into memory kept it running (kernel, SSHD, bash), I could still access the machine via SSH but can no longer do anything, forcing the reboot as mentioned above was my only resort, and it worked like charm…

September 19, 2010

Xen on centos 5.5

Filed under: Linux — Tags: , , , , , — admin @ 10:49 pm

Xen Guest OS boot error looks like:

Mounting root filesystem.
mount: could not find filesystem '/dev/root'
Setting up other filesystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory
Booting has failed.

The most common cause of this problem is a conflict of SCSI modules. In order to resolve this it is necessary to create a new initrd initialization RAM Disk without SCSI modules, and then use this to boot the guest Linux operating system. This can be achieved using the following command:

mkinitrd --omit-scsi-modules --with=xennet --with=xenblk --preload=xenblk initrd-$(uname -r)-no-scsi.img $(uname -r)
move the file to /boot

Once the new initrd image file has been generated simply refer to it in the “ramdisk” line of the Xen configuration file, for example:

kernel = "/boot/vmlinuz-2.6.18-194.3.1.el5xen"
ramdisk = "/boot/initrd-2.6.18-194.3.1.el5xen-no-scsi.img"
memory = 1024
name = "centos5"
vif = [ 'mac=00:16:36:4c:87:c3,bridge=virbr0,script=vif-bridge' ]
disk = ['tap:aio:/xen/centos.img,xvda1,w', 'tap:aio:/xen/centos.swap,xvda2,w']
root = "/dev/xvda1 ro"

July 21, 2010

Testeaza autentificarea SMTP a serverului tau de email

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

[ad#ad-1]

La instalarea unui server de mail, unul din lucrurile trebuie să faceţi înainte de “a fi online”, este de a testa daca totul functioneaza ok, adica ce trebuie sa mearga sa mearga si ce nu .. sa ne asiguram ca nu.

Unul din lucrurile care le testam este dacă serverul dvs. suportă corect comanda AUTH. Această comandă este utilizata atunci când un client la distantă doreste să se identifice ca un utilizator “autorizat”, astfel încât să poată folosi server-ul dvs. pentru trimis mail-uri. Acest lucru este foarte util pentru companiile care au angajati care călătoresc si nu numai.

Acum sa trecem la practica.

Generam linia base64 de autentificare:

% perl -MMIME::Base64 -e 'print encode_base64("\000test\@kroko.ro\000not.my.real.password")'
AHRlc3RAa3Jva28ucm8Abm90Lm15LnJlYWwucGFzc3dvcmQ=

Ne conectam la server:

% telnet 1.2.3.1 25

Escape character is '^]'.
220-xxx ESMTP Exim 4.69 #1 Wed, 21 Jul 2010 09:59:22 +0200
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
ehlo testing
250-xxx Hello testing [xx.xx.xx.xx]
250-SIZE 52428800
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
AUTH PLAIN AHRlc3RAa3Jva28ucm8Abm90Lm15LnJlYWwucGFzc3dvcmQ=
235 Authentication succeeded

daca primiti un mesaj de confirmare gen: “235 Authentication succeeded” atunci totul e ok.

dupa ce ne-am autentificat putem trimite si un email de test:

mail from: xxx@xxx.ro
250 OK
rcpt to: yyy@yyyy.com
250 Accepted
data
354 Enter message, ending with "." on a line by itself
From: xxx@xxx.ro
To: yyy@yyy.com
Subject: test email

email de testttt!
.
250 OK id=1ObUEA-0000JA-2N
quit

« Newer PostsOlder Posts »

Powered by WordPress