Jun 022011
 
Hristo Botev

Hristo Botev

If you are in Bulgaria on 2-nd June around noon, you are probably puzzled why there is “Alarm” sound in the air and everyone stopped their activity and stood still for one minute.

It’s the day of Hristo Botev and the struggle of the Bulgarians against the Turkish presence on the Balkans.

Hristo Botev is one of the Bulgarian national heroes.

He is born on 25-th December 1847 (January 6 in new style) in the city of Kalofer in a family of a teacher. (parents Botyo Petkoff and Ivanka Boteva). He studies in a school in the city of Karlovo as a kid, under his father’s supervision but later returns to his city of birth where he graduates. Later he goes in Russia and applies as a private pupil in the Odessa gymnasium and serves for few years as a teacher in a village’s school in Zadunayevka,

At 1867 he returns in Kalofer and starts to prepare a rebellion against the rich and the Turks. During his stay in Bulgaria, local newspaper called Gayda (a kind of music pipe) publishes his verses and espеcially “Thy mother” (“Майце си”).

From october 1867 he starts living in Romania, working in the city of Braila as an metranpist for the newspaper “Danube Sunrise” *(Дунавска Зора) Lies few years in prison for conspiration but released because of applied appeal and help from his comrades Levski and Karavelov (other Bulgarian revolutionaries).

May 1876 starts the April Uprising in Bulgaria, which is quickly overwhelmed by Turkish army, but when Botev heard about it – He started preparations for entering Bulgaria with an army of revolutionaries. They abducted a ship called Radetzky and forced the captain to land and embark on Bulgarian shores on 17-th may.

The battle is futile and Hristo Botev dies on 2-nd of June.

 

 Posted by at 12:25 pm
Jun 022011
 

A friend of mine asked me, because his machine is having bad CMOS battery and on every reboot, his machine claims we are January 1970 😀

Cute. Obviously, I wasn’t born yet, when he had this web server 😀

This is what you must do to synchronize your clock:

bash-4.1# ntpdate 0.pool.ntp.org
2 Jun 11:08:57 ntpdate[3110]: step time server 94.26.7.48 offset -13.078094 sec
bash-4.1# hwclock --systohc
bash-4.1#

As simple as it is. 2 commands. Of course, if you have an NTP server closer to you than ntp.org. Feel free to use other server.

If you want this to be done in one script, that’s started as user, you may set it this way:

bash-4.1# touch SyncClock.sh
bash-4.1# cat > SyncClock.sh
#!/usr/bin/bash

echo "Clock is syncing to NTP, please wait..."

sudo /usr/sbin/ntpdate 0.pool.ntp.org
sudo /sbin/hwclock --systohc
^D
bash-4.1# chmod +x SyncClock.sh

Of course, this user should have passwordless sudo 😉 which I don’t really recommend.
And with this script in mind, if you want your timer synchronized every reboot, put it to /etc/rc.d/rc.local:

bash-4.1# echo -e "\n#Clock sync script\n/root/scripts/SyncClock.sh" >> /etc/rc.d/rc.local

Or even better, put it to cron, so it’s synchronized daily.

bash-4.1# cp /root/scripts/SyncClock.sh /etc/cron.daily

That’s really all you could need.

 Posted by at 11:26 am

How to reboot Slackware gracefully after Kernel panic

 l!nux  Comments Off on How to reboot Slackware gracefully after Kernel panic
May 302011
 
Where is SysRQ?

Where is SysRQ?

First of all.

It happens.

Don’t panic.

When the Kernel sees an error that can’t be avoided with his casual means, Kernel panics.

This can be seen as an error message in console and with blinking “Caps lock” and “Scroll lock” indicators on your keyboard. Even if something happened, you are in X.org and you can’t see the console Panic message but see the blinking LED indicators – Kernel has panicked. You don’t have access to your system anymore.

Again. Don’t panic. This error is sometimes seen as often as BSOD in Windows vintage ’98.

Most of the present day editors will auto-save your work often, so you probably have a work copy of your document from 5 minutes ago. This is not a reason to panic. The only reason to be a bit wary is, the hard drive needs to be synchronized with the cache. To execute the command “sync” with panicked Kernel is actually quite possible (see below).

The system invokes Panic when there is unrecoverable error. It’s locked out, so there is no future harm, data loss or security breach. It’s not necessarily something bad. You only need to restart and have a look what actually broke.

There are few things you need to do for graceful restart.

  • Get back control of your system (keyboard)
  • Synchronize the cache with the disk.
  • Issue a clean sigTerm and sigKill on all processes.
  • Reboot, so you can have a look at logs and what the hell broke.

There are magic key strokes, that can do all of this and they are invoked by holding “Alt + SysRq” and pressing some of the buttons of the character keyboard.

  • Alt + SysRq + R will try to Retake back the keyboard,
  • Alt + SysRq + E will try to gracefully tErminate all processes so they flush and clean,
  • Alt + SysRq + I will send signal kIll to all processes,
  • Alt + SysRq + S will Sync,
  • Alt + SysRq + U will Unmount and
  • Alt + SysRq + B will reBoot.

If you have a look at the letters REISUB and read backwards, you will get BUSIER. So just remember BUSIER for next time the system goes BUSY with Kernel Panic 😀

There is longer way to remember it, but I never liked it. It’s “Reboot Even If System is sUper Broken”. In my opinion BUSIER is much easy to remember. Just remember to apply it backwards or you will simply just reboot with Alt + SysRq + B.

So, now we can have a look, what happened to our Kernel that led to panic. Have a look at /var/log/messages and search for the last restart logged. (less uses the slash-sign for searching. Just press “/” and write “restart”. Then with “/” and “Enter” you issue find-next, until no more are found)

bash-4.1# cd /var/log/
bash-4.1# cat messages | less
...
May 30 12:04:44 stoill -- MARK --
May 30 12:23:57 stoill kernel: [11970.623138] Bluetooth: Core ver 2.15
May 30 12:23:57 stoill kernel: [11970.623189] NET: Registered protocol family 31
May 30 12:23:57 stoill kernel: [11970.623193] Bluetooth: HCI device and connection manager initialized
May 30 12:23:57 stoill kernel: [11970.623198] Bluetooth: HCI socket layer initialized
May 30 12:31:45 stoill syslogd 1.5.0: restart.
...

Something obviously gone bad with the Bluetooth USB I inserted in the machine. Problem found, but I will not try to bore you to death with details.

Anyway. If you try to execute those Keystrokes without panicked Kernel (REISUB while holding Alr+SysRq), you will make graceful sync + reboot on your machine. If you do only the “RE” part while in X, you will close everything and make it to Login screen really fast. And if you do Alt+SysRq+S, you will sync all unsaved cache to HDD. Good to know.

If yow want to learn all possible Alt + SysRq key strokes and what they do, refer to the Kernel archives here, and happy hacking 😉

 Posted by at 3:50 pm