tag:blogger.com,1999:blog-50478664529183137222024-03-06T02:13:03.410+02:00PowerAdded.netpsy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-5047866452918313722.post-70653176220879830462020-11-03T13:01:00.003+02:002020-11-03T16:57:56.152+02:00ssh no longer able to connect to older hosts<p><span style="font-family: helvetica;"><span style="font-size: medium;"><span>Fedora33 implements higher security standards, not only for server side, but even when it comes to client connections.</span></span></span></p><p><span style="font-family: helvetica;"><span style="font-size: medium;"><span>This includes more restrictive rules on accepted Ciphers, Kex (key exchange) algorithms, etc.</span></span></span></p><p><span style="font-family: helvetica;"><span style="font-size: medium;"><span>Unfortunately this leads to situation in which you can no longer connect to older hosts, like CentOS5, some switches, for example JunOS12.</span></span></span></p><p><span style="font-family: helvetica;"><span style="font-size: medium;"><span>If you start getting the similar SSH errors:</span></span></span></p><p><span style="font-size: medium;"><span style="font-family: courier;">=================</span></span></p><p><span style="font-size: medium;"><span style="font-family: courier;">debug1: send_pubkey_test: no mutual signature algorithm<br />debug1: kex: algorithm: (no match)<br />Unable to negotiate with xx.xx.xx.xx port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1<span style="font-family: courier;"> </span></span></span></p><p><span style="font-size: medium;"><span style="font-family: courier;"><span style="font-family: courier;">=================</span></span></span></p><p><span style="font-size: medium;"><span style="font-family: courier;"><span style="font-family: courier;"> </span></span></span></p><div style="text-align: left;"><span style="font-family: helvetica;"><span style="font-size: medium;"><span>What you can do is slightly tune the openssh client requirements.</span></span></span></div><div style="text-align: left;"><span style="font-family: helvetica;"><span style="font-size: medium;"><span> </span></span></span></div><div style="text-align: left;"><span style="font-family: helvetica;"><span style="font-size: medium;"><span>You can put this on your config. This exact config will cover all hosts which you connect to, but if you wish this only on specific machines, instead of the wildcard '*' put the name or the IP of your machines, separated by 'space'</span></span></span></div><div style="text-align: left;"><span style="font-family: helvetica;"><span style="font-size: medium;"><span><br /></span></span></span></div><div style="text-align: left;"><span style="font-family: helvetica;"><span style="font-size: medium;"><span>In file: ~/.ssh/config</span></span></span></div><div style="text-align: left;"><span style="font-family: helvetica;"><span style="font-size: medium;"><span><br /></span></span></span></div><div style="text-align: left;"><span style="font-size: medium;"><span style="font-family: times;"><span style="font-family: helvetica;">Add/Edit the following section</span><br /></span></span></div><div style="text-align: left;"><span style="font-size: medium;"><br /><span style="font-family: courier;">=================</span></span></div><div style="text-align: left;"><span style="font-size: medium;"><span style="font-family: courier;">Host *<br /> KexAlgorithms +diffie-hellman-group1-sha1<br /> Ciphers +aes256-cbc<br /> PubkeyAcceptedKeyTypes +ssh-rsa <br /></span></span></div><div style="text-align: left;"><span style="font-size: medium;"><span style="font-family: courier;">=================</span></span></div><div style="text-align: left;"><span style="font-size: medium;"><span style="font-family: courier;"> </span></span></div><div style="text-align: left;"><span style="font-size: medium;"><span style="font-family: times;"><span style="font-family: courier;"><span style="font-family: courier;"><span style="font-family: helvetica;"><span>This will probably fix a lot of issues for you. </span></span><br /></span></span></span></span></div><p><span style="font-size: medium;"><br /></span></p>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-34385399390528199562020-11-03T12:46:00.000+02:002020-11-03T12:46:01.550+02:00git: error: gpg failed to sign the data<p>If you try to sign commit with git, and you get the following error:</p><p><span style="font-size: small;">======================</span><span style="font-size: small;"> </span></p><pre class="code"><span style="font-size: small;">error: gpg failed to sign the data
</span></pre><pre class="code"><span style="font-size: small;">fatal: failed to write commit object</span></pre><pre class="code"><span style="font-size: small;">======================</span></pre><pre class="code"><span style="font-size: small;"> </span></pre><ol style="text-align: left;"><li><pre class="code"><span style="font-size: small;">Check your ~/.gitconfig file, which must include at least the following sections:</span></pre><pre class="code"><span style="font-size: small;"><span style="font-size: small;">[user]<br /> name = Your Name Here<br /> email = your@email.com<br /> #key ID coming from gpg --list-keys<br /> signingkey = AABBCCDDFF112233445566<br />[commit]<br /> gpgsign = 1<br />[gpg]<br /> #could be gpg or gpg2 or full path to them<br /> program = gpg2</span> </span></pre></li><li><pre class="code">If above is fine, check if your GPG is working correctly on the following link:</pre></li></ol><pre class="code"><a href="http://www.poweradded.net/2020/11/gpg-or-gpg2-gpg-signing-failed.html" target="_blank"> gpg or gpg2 gpg: signing failed: Inappropriate ioctl for device </a><br /></pre>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-35742740830291024832020-11-03T12:38:00.000+02:002020-11-03T12:38:31.134+02:00gpg or gpg2 gpg: signing failed: Inappropriate ioctl for device<p> If you ever get the following error, while trying to sign with gpg:</p><p></p><p><i>gpg: signing failed: Inappropriate ioctl for device</i></p><p></p><p>try the following steps</p><p>Test if gpg is actually working:</p><p>====================== <br /></p><p></p><pre class="code bash"><span class="kw3">echo</span> <span class="st0">"test"</span> <span class="sy0">|</span> gpg2 <span class="re5">--clearsign</span></pre><pre class="code bash">======================</pre><pre class="code bash"><span class="re5">If you get error like this: </span></pre><pre class="code bash"><span class="re5"> </span></pre><pre class="code bash"><span class="re5">====================== </span></pre><pre class="code bash"><span class="re5">[root@localhost]# echo "test" | gpg2 --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
test
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device </span></pre><pre class="code bash"><span class="re5">======================</span></pre><pre class="code bash"><span class="re5"> </span></pre><p></p><p>then try the following:</p><p></p><pre class="code bash"><span class="kw3">======================</span></pre><pre class="code bash"><span class="kw3"><span class="re5">[root@localhost]# </span>export</span> <span class="re2">GPG_TTY</span>=$<span class="br0">(</span>tty<span class="br0">)</span></pre><pre class="code bash"><span class="br0">======================</span></pre><pre class="code bash"><span class="br0"> </span></pre><pre class="code bash"><span class="br0">If this fixes the problem, add it to your .bashrc or .bash_profile file </span></pre><p><br /><br /></p>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-43758528929566956512020-10-17T11:23:00.002+03:002020-10-17T11:23:26.508+03:00growpart: no tools available to resize disk with 'gpt'<p>If you get the following message while trying to resize GPT partition:</p><p><span style="font-family: courier;"><br /></span></p><pre><span style="font-family: courier;"><code>[root@localhost ~]# growpart /dev/sda 1
no tools available to resize disk with 'gpt'
FAILED: failed to get a resizer for id ''</code></span></pre><pre><code> </code></pre><pre><code>This is because you are missing the package: </code><code><code>gdisk</code></code></pre><pre><code><code> </code></code></pre><pre><code><code>Install it, and the problem is solved:</code></code></pre><pre><code><code> </code></code></pre><pre><span style="font-family: courier;"><code><code><code>[root@localhost ~]# yum -y install gdisk</code></code></code></span></pre><pre><code><code><code> </code></code></code></pre><pre><code><code><code> </code> </code> </code></pre>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-17387414176280391512016-10-25T08:46:00.003+03:002016-11-11T14:05:23.789+02:00BlueGate sip GSM gateway - very bad choiceSome time ago, we bought new SIP GSM gateway for our PBX. The GSM gw is BlueGate sip GSM gateway, dual SIM (<a href="http://www.alphatechtechnologies.cz/en/products/gsm-gateways/voip-gsm-gateway-bluegate-sip/" rel="nofollow" target="_blank">http://www.alphatechtechnologies.cz/en/products/gsm-gateways/voip-gsm-gateway-bluegate-sip/</a>).<br />
<br />
I read in the spec that it is coming with Siemens radio module and decided that the GW will be made with high quality in mind.<br />
<br />
Unfortunately this was not the case and we faced our firs issue.<br />
<br />
The operators started complaining that they hear noise during call, and despite the fact that the signal to noise ratio is very good, the noise which is heard during call is too loud and very very annoying.<br />
<br />
The noise is coming from the radio module and the producer of the GW confirmed it, but they said that they will not do anything about it. Here is their last answer from the communication with them:<br />
<br />
<b>Hello,<br />
I haven't good news. I got the BG SIP twin yesterday. I tested
it with our specialist for analog signals. The moment BG SIP twin
connect analog output from GSM modul we hear the noise from the
GSM modul too. But we can't take out only noice incomming from GSM
modul. I do nothing with it.</b><br />
<br />
Until now we used Vierling GSM GW which was using ISDN to connect with PBX and we have had no problem with it, but I decided to switch to SIP and bought the crap described above.<br />
<br />
The second issue we have had with this device, is that probably in 99% of the cases, it was not passing DTMF tones to the PBX. We just did not get any DTMF and the clients which were calling us on these lines were not able to choose anything from the IVR menu.<br />
<br />
Considering the issues with the noise, we did not even bothered to write again to their support, because we already knew that this device is dead for us. <br />
<br />
As a conclusion: DO NOT buy BlueGate SIP GSM gateway from <a href="http://www.alphatechtechnologies.cz/" rel="nofollow" target="_blank">http://www.alphatechtechnologies.cz</a>. They suck.<br />
<br />
Now we have direct land line SIP trunk with the mobile operator, and all is just fine. psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-12281394154114671642014-12-21T10:47:00.005+02:002014-12-21T10:48:08.393+02:00How to apply OTA update or UNROOT rooted nexus 5 without loosing user data. These days I got notification from my phone (Nexus5 with android 5.0) that I have update to android 5.0.1.<br />
<br />
The phone is rooted without modification of the boot partition. <br />
<br />
I tried to update, the phone rebooted and started the update process and after a few seconds it say ERROR, and stops.<br />
<br />
It appears that the updater checks for modifications on system partition and if some are found, the update is stopped.<br />
<br />
Here is how I managed to update, without flashing all back to stock and suffering the pain of reinstalling all my apps, loosing user data (if not backed up), loosing app states and so on, basically a lot of time can be lost.<br />
<br />
The below instructions will probably work on all nexus devices with slight modifications.<br />
<br />
All the commands which I am going to present you are tested on linux, but they should work on windows and mac too, as long as you have downloaded android SDK.<br />
<br />
I assume that your bootloader is unlocked. If not, you can not do anything without wiping out the phone.<br />
<br />
How to check if bootloader is locked, two ways:<br />
<br />
1. When you power on the phone you see the GOOGLE logo. If the bootloader is unlocked you will see unlocked padlock below the google logo.<br />
2. Switch OFF the phone, then hold for 5-6 seconds Volume Down + Power.<br />
<br />
This will start the bootloader for you (one lying down android with open stomach :))<br />
Below the android you will see some info, about your phone, bootloader version etc.<br />
On the last line it says: "LOCK STATE - unlocked" if bootloader is unlocked <br />
<br />
<br />
1. Download android sdk. http://developer.android.com/sdk/index.html#Other<br />
<br />
If you do not intend to develop, you DO NOT need the "android studio", just download 'SDK tool only"<br />
<br />
2. If undr Linus/Mac, extract the contents of the package<br />
<br />
3. Run <b>android-sdk-linux/tools/android</b>. This will start GUI which will let you choose which components to install<br />
<br />
4. Choose "Android Platform SDK tools" and hit install<br />
<br />
5. If all went fine, you will have folder android-sdk-linux/platform-tools/ which contains the tools you need.<br />
<br />
6. Switch On "usb debugging" on your device.<br />
<br />
7. When you connect the phone, try this simple command:<br />
<br />
<b>sudo android-sdk-linux/platform-tools/adb shell</b><br />
<br />
The phone will probably pop up a dialog, asking for confirmation to allow the connection from the computer.<br />
Hit YES and the command you executed will be drop you in a shell on the phone.<br />
If this happens then all is good, you can continue<br />
<br />
8. Download the stock images for your current version of android:<br />
https://developers.google.com/android/nexus/images<br />
<br />
9. Extract the file, in my case (hammerhead-lrx21o-factory-01315e08.tgz). You will get ZIP file called hammerhead-lrx21o/image-hammerhead-lrx21o.zip<br />
<br />
10. Extract it too and you will get the image files<br />
<br />
cache.img <br />
boot.img <br />
recovery.img <br />
userdata.img <br />
system.img <br />
<br />
11. If you want to root your phone after the update, download also:<br />
Chanfire installable ZIP: As of time of this writing, version 2.40 (http://download.chainfire.eu/641/SuperSU/UPDATE-SuperSU-v2.40.zip)<br />
<br />
You can see which is the latest version here: http://forum.xda-developers.com/apps/supersu<br />
<br />
12. Upload the file to your device, you can do this with the following command:<br />
<br />
android-sdk-linux/platform-tools/adb push UPDATE-SuperSU-v2.40.zip /sdcard/Downloads<br />
<br />
This will place the file in your Download folder on the phone.<br />
<br />
13. Download TWRP rescue image:<br />
http://techerrata.com/browse/twrp2/hammerhead<br />
<br />
14. Be very careful from now on :)<br />
<br />
15. Go in to fastboot mode by doing either power off the phone, then hit volumedown + power for a few seconds, or if the phone is on, with the following command:<br />
<br />
<b>sudo android-sdk-linux/platform-tools/adb reboot bootloader</b><br />
<br />
This is supposed to send you in bootloader.<br />
<br />
15. Flash stock recovery image: (you should be in the dir where the extracted images are )<br />
<br />
<b>sudo android-sdk-linux/platform-tools/fastboot flash boot boot.img </b><br />
<br />
reboot bootloader again<br />
<b>sudo android-sdk-linux/platform-tools/fastboot reboot-bootloader</b><br />
<br />
16. Flash recovery image to stock<br />
<br />
<b>sudo android-sdk-linux/platform-tools/fastboot flash recovery recovery.img</b><br />
<br />
reboot bootloader again<br />
<b>sudo android-sdk-linux/platform-tools/fastboot reboot-bootloader</b><br />
<br />
17. Flash the system img<br />
<br />
<b>sudo android-sdk-linux/platform-tools/fastboot flash system system.img</b><br />
<br />
<br />
<br />
<br />
<br />
18. Reboot the device.<br />
In the bootloader, navigate with (volume +/-) and when it shows "REBOOT", hit power to confirm, this will reboot the phone and boot android. And you now have unrooted device.<br />
<br />
19. Apply the update, either go to settings-> about -> check for updates.<br />
If nothing is shown there you can wait for some time and the notification will pop up again. (there is a faster method for update, but I intentionally do not show it here)<br />
<br />
20. When the update is applied, if you want to root again the device, do the following:<br />
<br />
<b>sudo android-sdk-linux/platform-tools/adb reboot bootloader</b><br />
<br />
21. Flash the recovery image with the twrp image which you downloaded earlier:<br />
<br />
sudo android-sdk-linux/platform-tools/fastboot flash recovery openrecovery-twrp-2.8.2.0-hammerhead.img<br />
<br />
22. Reboot bootloader<br />
<br />
<b>sudo android-sdk-linux/platform-tools/fastboot reboot-bootloader</b><br />
<br />
23. With volume +/- navigate to menu "Recovery Mode"<br />
24. You will see a interface with buttons.<br />
25. Go to Install<br />
26. Navigate to your download folder and select the file you uploaded there earlier. In current case this is UPDATE-SuperSU-v2.40.zip<br />
27. At the bottom "Swipe to Confirm Flash"<br />
28. If all went fine, your device is rooted at this step<br />
29. Reboot the phone and enjoy your root. <br />
<br />psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com1tag:blogger.com,1999:blog-5047866452918313722.post-78102662487297490942014-11-12T23:38:00.003+02:002014-11-12T23:40:01.321+02:00How to concatenate files containing columns of data in Linux<h4>
</h4>
<h4>
Ever wondered how to concatenate text files containing columns next to each other ?</h4>
<h4>
One little bash trick which can help you do this the easy way:</h4>
<h4>
</h4>
<h4>
Assume you have for example three files containing something like this:</h4>
<h4>
</h4>
<h4>
file1.txt</h4>
<h4>
a b c</h4>
<h4>
a b c</h4>
<h4>
a b c</h4>
<h4>
a b c</h4>
<h4>
</h4>
<h4>
</h4>
<h4>
file2.txt</h4>
<h4>
</h4>
<h4>
1 2 3</h4>
<h4>
1 2 3</h4>
<h4>
1 2 3</h4>
<h4>
1 2 3</h4>
<h4>
</h4>
<h4>
file3.txt</h4>
<h4>
</h4>
<h4>
m n p</h4>
<h4>
m n p</h4>
<h4>
m n p</h4>
<h4>
m n p</h4>
<h4>
</h4>
<h4>
What we want to achieve is the following result:</h4>
<h4>
</h4>
<h4>
a b c 1 2 3 m n p</h4>
<h4>
a b c 1 2 3 m n p</h4>
<h4>
a b c 1 2 3 m n p</h4>
<h4>
a b c 1 2 3 m n p</h4>
<h4>
</h4>
<h4>
You have two options</h4>
<h4>
</h4>
<h4>
<b>Option 1:</b> Try to do it in bash and die in pain. This is usually not funny.</h4>
<h4>
</h4>
<h4>
<b>Option 2:</b> The easy way, use the command <i>"paste"</i>:</h4>
<h4>
</h4>
<h4>
<i>[user@host ~]$ paste file1.txt file2.txt file3.txt <br />a b c 1 2 3 m n p<br /><br />a b c 1 2 3 m n p<br /><br />a b c 1 2 3 m n p<br /><br />a b c 1 2 3 m n p</i></h4>
<h4>
</h4>
<h4>
The command paste will concatenate the files for you</h4>
<h4>
</h4>
<h4>
The program have some cool options, like you can set separator, or use the -s option which will cause the following behavior "paste one file at a time instead of in parallel"</h4>
<h4>
</h4>
<h4>
Here is an example with the same files:</h4>
<h4>
<i><br /></i></h4>
<h4>
<i>[user@host ~]$ paste -s file1.txt file2.txt file3.txt </i></h4>
<h4>
<i>a b c a b c a b c a b c</i></h4>
<h4>
<i>1 2 3 1 2 3 1 2 3 1 2 3</i></h4>
<h4>
<i>m n p m n p m n p m n p</i></h4>
<h4>
</h4>
<h4>
Each row, becomes a new column. </h4>
<h4>
</h4>
<h4>
Have fun :)</h4>
psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-51988635103198682622012-06-08T10:21:00.001+03:002012-06-08T10:33:59.366+03:00Broadcom BCM 802.11 linux-sta driver compilation issuesI am using one lenovo netbook, which is coming with Broadcom wireless adapter.<br />
Since I was having performance issues with the open source driver I started using the driver provided by Broadcom:<br />
<br />
<a href="http://www.broadcom.com/support/802.11/linux_sta.php">http://www.broadcom.com/support/802.11/linux_sta.php</a><br />
<br />
On the newer kernel there are two compilation issues which need patching.<br />
<br />
The patches provided below are for version 5.100.82.112 of the driver.<br />
<br />
The first issue which I hit was the following error during compilation <br />
<pre>/usr/src/linux-sta/src/wl/sys/wl_linux.c:396:2: error: unknown field ‘ndo_set_multicast_list’ specified in initializer
/usr/src/linux-sta/src/wl/sys/wl_linux.c:396:2: warning: initialization from incompatible pointer type [enabled by default]
/usr/src/linux-sta/src/wl/sys/wl_linux.c:396:2: warning: (near initialization for ‘wl_netdev_ops.ndo_validate_addr’) [enabled by default]
make[2]: *** [/usr/src/linux-sta/src/wl/sys/wl_linux.o] Error 1
make[1]: *** [_module_/usr/src/linux-sta] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.4.0-1.fc17.i686'
</pre>
<br />
The secon issue is the following error<br />
<br />
<pre>/usr/src/linux-sta/src/wl/sys/wl_linux.c:43:24: fatal error: asm/system.h: No such file or directory
</pre>
<br />
which is caused by dropping the header asm/system.h in kernel 3.4 in favor of 5 new headers.<br />
<br />
More about this can be read here:<br />
<br />
<a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=0195c002">http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=0195c002</a><br />
<br />
<br />
<br />
Here is a patch witch fixes both of the issues.<br />
<br />
<br />
You can download the patch from pastebin:<br />
<br />
<a href="http://pastebin.com/C8TZ8q88">http://pastebin.com/C8TZ8q88</a><br />
<br />
I am pasting the code in pastebin, because blogger.com has an "incredibly good" editor and I am fighting for half an hour to make it not hiding most of the source code and as you can see he wins :).
<br />
<br />
place this text in a file and save it<br />
<br />
then go in the dirver directory in my case:<br />
<br />
cd /usr/src/linux-sta/src/wl/sys/<br />
<br />
and run the patch<br />
<br />
patch -p0 < /path/where/the/you/saved/the/patchfile.patch<br />
<br />
then try to compile as usual<br />
<br />
cd /usr/src/linux-sta/<br />
make clean<br />
make install<br />
depmod -a<br />
modprobe wl<br />
<br />psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-90796826784554706762012-03-04T23:04:00.002+02:002012-03-04T23:07:57.091+02:00Errors when trying to compile tp_smapi on recent kernels (for me on Fedora 16)Whoever from you who have a ThinkPad laptop and is using tp_smapi kernel module is probably having troubles compiling the module on recent kernels.<br />
<br />
I especially experience problems compiling it on Fedora 16 kernel 3.2.7-1.fc16.i686 but as far as I can see, others people have the same issue on Fedora 15 and other distros too.<br />
<br />
For the ones who does not know, this module is giving you an interface to the shock sensor which can be used from hdapsd to protect your HDD from shocks and also gives you some very cool features to control the charge/discharge of your battery and presents you some very useful information about the battery, which can be found in /proc and /sys<br />
<br />
Now back to the problem.<br />
<br />
When I try to compile the kernel module, version tp_smapi-0.40, I get the following error:<br />
<br />
<br />
===================================================<br />
<pre>make -C /lib/modules/3.2.7-1.fc16.i686/build M=/usr/src/tp_smapi-0.40 O=/lib/modules/3.2.7-1.fc16.i686/build modules
make[1]: Entering directory `/usr/src/kernels/3.2.7-1.fc16.i686'
CC [M] /usr/src/tp_smapi-0.40/thinkpad_ec.o
/usr/src/tp_smapi-0.40/thinkpad_ec.c:91:8: warning: type defaults to ‘int’ in declaration of ‘DECLARE_MUTEX’ [-Wimplicit-int]
/usr/src/tp_smapi-0.40/thinkpad_ec.c:91:1: warning: parameter names (without types) in function declaration [enabled by default]
/usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_lock’:
/usr/src/tp_smapi-0.40/thinkpad_ec.c:108:28: error: ‘thinkpad_ec_mutex’ undeclared (first use in this function)
/usr/src/tp_smapi-0.40/thinkpad_ec.c:108:28: note: each undeclared identifier is reported only once for each function it appears in
/usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_try_lock’:
/usr/src/tp_smapi-0.40/thinkpad_ec.c:122:23: error: ‘thinkpad_ec_mutex’ undeclared (first use in this function)
/usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_unlock’:
/usr/src/tp_smapi-0.40/thinkpad_ec.c:134:6: error: ‘thinkpad_ec_mutex’ undeclared (first use in this function)
/usr/src/tp_smapi-0.40/thinkpad_ec.c: At top level:
/usr/src/tp_smapi-0.40/thinkpad_ec.c:91:8: warning: ‘DECLARE_MUTEX’ declared ‘static’ but never defined [-Wunused-function]
/usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_try_lock’:
/usr/src/tp_smapi-0.40/thinkpad_ec.c:123:1: warning: control reaches end of non-void function [-Wreturn-type]
make[3]: *** [/usr/src/tp_smapi-0.40/thinkpad_ec.o] Error 1
make[2]: *** [_module_/usr/src/tp_smapi-0.40] Error 2
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.2.7-1.fc16.i686'
make: *** [modules] Error 2
</pre>===================================================<br />
<br />
After some digging I found the solution in one forum thread, and the solution is:<br />
<br />
Replace all the occurrences of DECLARE_MUTEX with DEFINE_SEMAPHORE, which, at the time I am writing this, are in files:<br />
<br />
thinkpad_ec.c on line 91<br />
tp_smapi.c on line 112<br />
<br />
For those of you who want a patch:<br />
<br />
------------- cut below this line -------------<br />
<pre>--- thinkpad_ec.c.orig 2008-12-16 07:03:06.000000000 +0200
+++ thinkpad_ec.c 2012-03-04 22:58:10.409371153 +0200
@@ -88,7 +88,7 @@
#define TPC_PREFETCH_JUNK (INITIAL_JIFFIES+1) /* Ignore prefetch */
/* Locking: */
-static DECLARE_MUTEX(thinkpad_ec_mutex);
+static DEFINE_SEMAPHORE(thinkpad_ec_mutex);
/* Kludge in case the ACPI DSDT reserves the ports we need. */
static int force_io; /* Willing to do IO to ports we couldn't reserve? */
--- tp_smapi.c.orig 2008-12-16 07:03:06.000000000 +0200
+++ tp_smapi.c 2012-03-04 22:58:22.074334276 +0200
@@ -109,7 +109,7 @@
#define SMAPI_PORT2 0x4F /* fixed port, meaning unclear */
static unsigned short smapi_port; /* APM control port, normally 0xB2 */
-static DECLARE_MUTEX(smapi_mutex);
+static DEFINE_SEMAPHORE(smapi_mutex);
/**
* find_smapi_port - read SMAPI port from NVRAM
</pre>-------------- cut above this line ---------------<br />
<br />
Get the text, place it in a file, save the file.<br />
change the directory in the source dir:<br />
<br />
cd tp_smapi-0.40<br />
<br />
apply the patch <br />
<br />
patch -p0 < /path/to/the/file/with/the/patch<br />
<br />
you can try "make" now.<br />
<br />
Load the module and happy shock protecting :)psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-3956621817431241282011-08-16T16:17:00.000+03:002011-08-16T16:17:38.310+03:00Guess the web browser :)<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYnDQyJmLTB_9dvZgIdCJMH7g8egTTK6Ne5tbJU2TLOH_iovIlB0w8zjrnhCB70Nl2ZWZr-JSiMyapfyzMjYEX9CuzXD_jm7_DmudBX_MU-PfNrhQ89RbCDgn4-pqqQFupzLdxewlR_oI0/s1600/H4lcN.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYnDQyJmLTB_9dvZgIdCJMH7g8egTTK6Ne5tbJU2TLOH_iovIlB0w8zjrnhCB70Nl2ZWZr-JSiMyapfyzMjYEX9CuzXD_jm7_DmudBX_MU-PfNrhQ89RbCDgn4-pqqQFupzLdxewlR_oI0/s1600/H4lcN.jpg" /></a></div><br />
psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-85676563561758066482011-06-23T17:33:00.000+03:002011-06-23T17:33:27.682+03:00Nvidia support sucksI am using Linux for quite some time and my laptop has Nvidia video card.<br />
<br />
All was working fine for some time, but approximately a year ago I started experiencing really weird video behavior when using NVidia driver and all was just fine with nouveau driver. <br />
<br />
I tried to resolve my issue and posted a thread in http://forums.nvidia.com/ but I did not get any help, just some other guy was experiencing the same problem.<br />
<br />
Then I tried the next logical thing, contact nvidia support directly. <br />
<br />
I described my problem with explanation how to reproduce, but unfortunatelly they told me that were unable to reproduce and closed the tickets.<br />
<br />
Some time after that I did really deep research about this issue and found other users experiencing the same behavior and I got some more additinal information about the case.<br />
<br />
I opened another ticket with their support and it looks like the same guy tried to support me, but this time he really really made me mad with his answers.<br />
<br />
here is the complete history<br />
<br />
<br />
----------------------------------------------------------------------------------------------------------------<br />
ticket opened on 05/13/2011 05:19 AM<br />
<br />
Hello,<br />
<br />
I have a thinkpad R61 with Quadro NVS 140M.<br />
OS: Fedora 14<br />
Kernel: 2.6.35.13-91.fc14.i686<br />
NV Driver: 270.41.06<br />
<br />
I am experiencing the following behavior:<br />
<br />
After I install the nvidia driver I have really bad experience while switching between the apps. The worst speed comes when I try to switch back from some other app to Firefox with site open.<br />
It draws the toolbar, menus, address bar and then sometimes it takes 2 secs to display the page pane.<br />
<br />
The things are getting really ugly if I start Open Office Calc (spreadsheets), OpenOffice Draw and try to work with them. Even marking an area with the mouse in OpenOffice Draw is very slow.<br />
<br />
The speed slows down with time and finally can drive you crazy.<br />
<br />
This effect is temporarily cured if I "flush" Pixmap Cache with the following commands:<br />
<br />
nvidia-settings -a PixmapCache=0<br />
nvidia-settings -a PixmapCache=1<br />
<br />
<br />
I dont have any of the above symptoms if I use nouveau, however I have other problems with this driver :).<br />
<br />
The above happens with KDE and GNOME.<br />
<br />
In the same time I have no problems watching video using VDPAU video output and decoding x264 encoded movie.<br />
<br />
I read in the net that lots of users have similar problems and tried a LOT of things in order to prevent this behavior from happening and no luck:<br />
<br />
Here is my device section in xorg.conf<br />
<br />
=============================<br />
Section "Device"<br />
Identifier "Device0"<br />
Driver "nvidia"<br />
VendorName "NVIDIA Corporation"<br />
Option "TripleBuffer" "false"<br />
Option "BackingStore" "false"<br />
Option "RenderAccel" "True"<br />
Option "PixmapCacheSize" "2000000"<br />
Option "OnDemandVBlankInterrupts" "True"<br />
Option "AllowSHMPixmaps" "0"<br />
Option "AllowIndirectPixmaps" "True"<br />
Option "DamageEvents" "True"<br />
<br />
EndSection<br />
=============================<br />
<br />
However with or without the additional directives, it does not make much difference.<br />
The only thing that can almost normalize the things for some time are the above mentioned commands which disable and enable PixmapCache<br />
<br />
Please help.<br />
----------------------------------------------------------------------------------------------------------------<br />
<br />
NVIDIA SUPPORT: Response (Mike) 05/13/2011 02:05 PM<br />
<br />
He even wrote my name wrong, but I can live with that.<br />
<br />
<br />
Hi Devan,<br />
<br />
Thank you for contacting NVIDIA Customer Care.<br />
<br />
It appears that you contacted us already about this issue in December 2010 in support case id 101118-000139 which I handled.<br />
<br />
Thank you for the new information that flushing the pixmap cache also temporarily works around the problem.<br />
<br />
I reviewed the case notes from December and we could not identify or resolve the problem from your logs, and also I tried and could not reproduce the problem with a borrowed laptop with an NVS 140M.<br />
<br />
Let me know if there is any additional information about the problem and I will help if I can, but based on the previous and current information unfortunately I could not help you.<br />
<br />
Best regards,<br />
<br />
Mike<br />
NVIDIA Customer Care<br />
<br />
----------------------------------------------------------------------------------------------------------------<br />
Me. 05/14/2011 09:57 AM <br />
<br />
Hello,<br />
<br />
In order to reproduce the issue you really need some time of work on the laptop. You have to agree that the fact that you were unable to reproduce, does not mean that the problem does not exists. I tried different distributions and always get the same behavior and the only thing that fixes it, is switching to nouveau driver. This fact itself means a lot for me.<br />
<br />
If you search in google for things like:<br />
nvidia pixmap<br />
nvidia kde slow<br />
<br />
and some other similar phrases you will find really long threads (not only for problems with quadro NVS but others too) with many different supposed work arounds. Some threads are old some are new, they blame one thing or another, I have tried all the recommendations in these forums and did not find anything, that eliminates the problem.<br />
<br />
If I send you a video file with the speed for simple things, but using different driver, is this going to convince you ?<br />
<br />
----------------------------------------------------------------------------------------------------------------<br />
NVIDIA SUPPORT 05/16/2011 10:55 AM <br />
<br />
THE MOST IMPUDENT ANSWER EVER<br />
<br />
<br />
Hi Deyan,<br />
<br />
I am already convinced that you have a real problem!<br />
<br />
The problem is, I can't solve your problem from information in the logs, and I can't solve it by watching a video of the problem.<br />
<br />
The only way I can solve this problem is to reproduce it, which is why I borrowed the laptop with NVS 140M and did a lot of testing on it to try to reproduce the problem.<br />
<br />
I want to help you but please understand my limitations, as I need relevant information in the log (which was not there) or a reproduction of the problem to help you. Or sometimes I can help if your problem is already known based on the symptoms but this is not the case.<br />
<br />
Best regards,<br />
Mike<br />
<br />
----------------------------------------------------------------------------------------------------------------<br />
<br />
ME: 05/18/2011 04:04 AM <br />
<br />
Hello,<br />
<br />
I am still willing to record a video, so you can see how I reproduce the problem and try to reproduce it for yourself.<br />
<br />
I will submit you a video link shortly<br />
<br />
I really want to use the nvidia driver.<br />
<br />
----------------------------------------------------------------------------------------------------------------<br />
<br />
NVIDIA SUPPORT 05/18/2011 09:08 AM <br />
<br />
OK, I'll watch the video and see if there are steps to reproduce the problem that I missed when I tested this.<br />
<br />
----------------------------------------------------------------------------------------------------------------<br />
ME: 05/20/2011 12:20 AM <br />
<br />
Hello,<br />
<br />
I just uploaded the video to youtube.<br />
It does not look very beautiful but you can see more details on full screen.<br />
<br />
Here is a link to youtube:<br />
<br />
http://www.youtube.com/watch?v=_xxxxxxxxx<br />
<br />
If you want to take a look at the original uncompressed video,<br />
<br />
Here is a link to it too:<br />
<br />
http://xxxxxxxxx/xxxxxx.MOV<br />
<br />
<br />
<br />
This was 1 month ago. No answer no nothing after that.<br />
<br />
Here there are 2 possibilities:<br />
<br />
1. The do know about the problem and now facing the fact that I have a video showing the problem, they just ignore me and no fix provided.<br />
This behavior is BAD BAD BAD.<br />
<br />
2. They do not care about my problem and just ignore me. It looks like NVIDIA support is so badly organized that their support department does not even have a supervisor who can monitor their support staff and trying to make them solve users problem.<br />
<br />
Again: BAD BAD BAD<br />
<br />
This is really annoying and I really hate the fucking video card now.psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-5609309950375512972011-04-29T17:18:00.000+03:002011-04-29T17:18:15.320+03:00How to run cron jobs on even/odd days, minutes etc..Ever wondered how to start a cron job on even/odd minute/day/hour ?<br />
<br />
Here are some examples:<br />
<br />
Example1: You want to run job on even/odd minute:<br />
<br />
0-59/2 * * * * /path/to/evenjob.sh<br />
1-59/2 * * * * /path/to/oddjob.sh<br />
<br />
Example2: You want to run job in 10th minutie of every even/odd hour:<br />
<br />
10 0-23/2 * * * /path/to/evenjob.sh<br />
10 1-23/2 * * * /path/to/oddjob.sh<br />
<br />
Example3: You want to run job at 5pm every even/odd date<br />
<br />
0 17 2-31/2 * * /path/to/evenjob.sh<br />
0 17 1-31/2 * * /path/to/oddjob.sh<br />
<br />
If you dont clearly remember the positions of the minutes/hours/days you can find them in this man page:<br />
<br />
man 5 crontab<br />
<br />
here is a snippet from it:<br />
<br />
<br />
<table border="1"><tr>
<td>field</td>
<td>allowed values</td>
</tr>
<tr>
<td>minute</td>
<td>0-59</td>
</tr>
<tr>
<td>hour</td>
<td> 0-23</td>
</tr>
<tr>
<td>day of month</td>
<td>1-31</td>
</tr>
<tr>
<td>month</td>
<td>1-12 (or names, see below)</td>
</tr>
<tr>
<td>day of week</td>
<td>0-7 (0 or 7 is Sun, or use names)</td>
</tr>
</table>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-46655102672944803892011-03-03T16:24:00.000+02:002011-03-03T16:24:49.828+02:00How to access IPv6 IP address from web browserThese days I am playing with IPv6 and tried to access few sites directly by IP address.<br />
<br />
It looks like the browsers are trying to interpret the IPv6 address as name:port and the connection of course fail.<br />
<br />
If you type directly in the browser, for example:<br />
<br />
http://2a02:2e0:3fe:100::8<br />
<br />
you will get error message.<br />
<br />
If you want this to be interpreted as IPv6 address you will have to type the address like this:<br />
<br />
http://[2a02:2e0:3fe:100::8]<br />
<br />
I tested this on Linux with the following browsers:<br />
<br />
Firefox<br />
Opera<br />
Google Chromepsy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com1tag:blogger.com,1999:blog-5047866452918313722.post-77002295002158703652011-02-07T20:34:00.000+02:002011-02-07T20:34:10.093+02:00CentOS 5 / RedHat Enterprise Linux (RHEL) 5 not IPv6 readyThese days I am trying to start using IPv6 on CentOS 5, but unfortunately I found that this distro is not exactly ready to run IPv6. What is the main problem for me: The kernel version coming with the distro is not, I repeat it is NOT, capable of doing connection tracking, which is very very bad. <br />
We are being brought back in the days of kernel 2.2 and ipchains. <br />
Probably some of you remember how crippled it was, compared to 2.4 and 2.6 + iptables.<br />
<br />
Well it looks like the users of RHEL 5 are screwed (at least for now) even though they are paying.<br />
In this bug report,<br />
<br />
https://bugzilla.redhat.com/show_bug.cgi?id=243739<br />
<br />
the RH developers basically say that backporting of xtables to kernel 2.6.18 is not possible, which sounds very bad for me. They can at least try to release a newer kernel version even though this is against the versioning policy accepted by RedHat, but you have to agree that this is too expensive distro and to not support IPv6.<br />
They recommend building kernel from source with enabled IPv6 connection tracking features.<br />
Come on guys what I am paying for, for building my custom kernels ?psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-85275979118052430782010-11-12T12:38:00.000+02:002010-11-12T12:38:40.422+02:00Old but still good :): HDD performance degradation by screaming on the disk arrayHi,<br />
<br />
This is old but very useful movie, which shows how the HDD performance degrades when there is a vibration.<br />
<br />
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/tDacjrSCeq4?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/tDacjrSCeq4?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-65535172113370621802010-08-05T14:21:00.003+03:002010-08-05T14:25:30.377+03:00Google datacenter tourHello guys,<br /><br />I just found this cool video, which is basically a tour in one of Google's datacenters.<br /><br /><object height="385" width="640"><param name="movie" value="http://www.youtube.com/v/zRwPSFpLX8I&hl=en_US&fs=1"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed src="http://www.youtube.com/v/zRwPSFpLX8I&hl=en_US&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="385" width="640"></embed></object>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-4063313986341876592010-07-26T15:16:00.004+03:002012-06-16T10:06:19.766+03:00Allied Telesis (Allied Telesyn) green switches, really bad choiceHi guys,<br />
<br />
It has been awhile since my last post, but not because I have nothing to write about, its just I can go crazy while I am writing about the problem and kind of experiencing it again while writing :).<br />
<br />
We are using Allied Telesys (Allied Telesyn) switches for some years now. Since we needed and still need only Layer 2 switches we decided to go with Allied Telesis AT-2000/24. Although this model has some really nasty things which annoy me (like 32bit counters on 1G interfaces, which is insane), they were working and doing their main purpose, switching and VLAN support.<br />
<br />
However a new series were released, the green AT-9000/28 and AT-9000/52, this is basically 28/52 port Layer2, manageable, gigabit switch.<br />
<br />
First we bought 28 port model, it is working, but after a couple of days working the switch os crashes and the switch becomes unmanageable, but still switching, they released a completely rewritten firmware these days, but I have not tested it yet, because they are not supporting backward compatibility of the config and I have the rewrite it manually again. Can you imagine how stupid is this?<br />
<br />
The big problem comes with AT-9000/52. We bought 2 pieces, and I have a really hard time making them work with Cisco 76xx router.<br />
<br />
The problem is that both of the switches simply refuse to accept ARP reply from the router.<br />
<br />
I receive internet from ISP over a tagged VLAN 500. I connect one PC to AT-9000/52. The PC port is untagged member of VLAN500. With arping I am able to see the entire network, I get arp reply from any machine located no matter in which rack, however I am unable to receive arp reply from the ISP router (CISCO 76xx). The router can see my MAC address (which mean it can send arp request and get arp reply from me), but I can not receive the arp reply from the router no matter what I do. If I manually put the MAC address of the router in the ARP table of the PC, I have no problems communicating with it.<br />
<br />
Here is what I tried to do in order to resolve the problem, but unfortunatelly without any luck.<br />
<br />
<br />
1. I connected a PC directly on the cable which comes from the upstream switch, set up a tagged interface on the laptop, I can see the router without any glitches. However If I plug the cable in the switch AT9000/52 I just cant receive a single ARP reply from the router and router only, everything else in vlan 500 is visible (Linux machines).<br />
<br />
2. I attached a different switch the same model AT9000/52, he acts exatly the same.<br />
<br />
3. I have a switch AT9000/28 which is the same firmware version which is working without problem with the same config.<br />
<br />
<br />
Considering the fact that the 28 port switch is working and 52 port switches are unable to work using the exactly same config, makes me think, that this is basically a hardware issue.<br />
<br />
The Allied Telesis support is trying to reproduce the problem but they say that they are unable to reproduce and refuse to log in and take a look at my test environment, which really drives me crazy. Their inability to reproduce the problem in the lab does not mean that that the switch is working and this can not happen in my network.<br />
<br />
I am waiting almost 6 months for any resolution, but honestly speaking I dont expect one. They just dont care.<br />
<br />
Since I can not use this brand any more because it simply does not work I decided to switch to Juniper switches. I hope I will have less problem with them. The first disadvantage of the Juniper over the Allied Telesis is the price :).<br />
<br />
Conclusion: Do not buy Allied Telesis AT-9000/52 green switches, they obviously dont work in all environments. This so basic feature of VLAN support is turned into a crap in this model and although, they improved the cli very much compared to the previous model, they crapped basic functionality. The switch totally sux and I really hate it.<br />
<br />
UPDATE 16.06.2012: We are using Juniper EX2200 ever since and I want to say that I love them.<br />
Very good switches and very good price per features ration. Cisco does not have such switch for this price, actually they do not have any switch with such features for the price of Juniper switches.psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com1tag:blogger.com,1999:blog-5047866452918313722.post-37168428417387483252010-01-03T15:00:00.002+02:002010-01-03T15:06:53.794+02:00Supermicro with Tylersburg chipset, stupid IPMI behavior. - UPDATE1Hi again.<br /><br />Following my previous post regarding <a href="http://www.poweradded.net/2009/08/supermicro-with-tylersburg-chipset.html">Supermicro with Tylersburg chipset, stupid IPMI behavior.</a><br /><br />I just want to add that this behaviour is fixed on IPMI firmware level.<br />There is an check-box added in the Configuration -> LAN Select, where one can choose whether to use the dedicated IPMI LAN or On-Board LAN. However still a little crippled menu, because you can not choose which Onboard port to use.psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com1tag:blogger.com,1999:blog-5047866452918313722.post-18194086856312025282009-09-29T11:52:00.002+03:002009-09-29T11:57:22.692+03:00Kaspersky support is real crapWe have in the office a pack of 10 licenses for Kaspersky Internet Security (KIS).<br /><br />Since we suspect a serial number leak, we asked Kaspersky support to generate for us a new key and make the old one invalid. Guess what we are waiting 1 month already for answer, any answer.<br /><br />The ticket is in status: "Waiting for reply from global support team"<br /><br />I really hate such crappy support.<br /><br />Conclusion: Kapspersky support sucks (sux )psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-81419553010822496252009-09-15T16:45:00.023+03:002023-11-14T10:55:02.268+02:00CD/DVD tray LOCK/UNLOCK under Linux<p><br />
LOCK/UNLOCK your CD/DVD under Linux<br />
</p><p></p><p></p><p>
==== UPDATE ====</p><p>UPDATE: As you can see in the comments, one reader suggested using eject utility:<br />
<br />
Lock the drive: eject -i 1<br />
Unlock the drive: eject -i 0<br />
<br />The option was not available when coded the below program. </p><p>This works perfectly for me. <br />
==============</p><p><br />
==== UPDATE ==== <br />
It looks like when the time passes by, the things get changed<br />
The below program stopped working after some changes in udev rules.<br />
In order to make it work again you have to grab control over your eject button from udevd<br />
<br />
comment the following line:<br />
ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $tempnode", GOTO="cdrom_end"<br />in /lib/udev/rules.d/60-cdrom_id.rules,<br />restart udev <br />
<br />
voila, the program is working again.<br />
<br />
============================<br />
<br />
When I am home, my kid is playing with my laptop DVD and tries to grab the tray and take it away :).<br />
<br />
As you can imagine I am not very happy with this and wanted to find a program to lock the tray but unfortunately did not find any usable.<br />
<br />
I found one but it is for Windows, and it costs money. Come on guys you want 15 US$ for 10 rows of code. This is a robbery.<br />
<br />
Besides that I am working under Linux and this programs is no good to me.<br />
<br />
I am not a programmer but since I was unable to find a suitable program I wrote one.<br />
<br />
It is tested under Linux (Fedora 11 if that matters at all).<br />
<br />
How to compile:<br />
<br />
gcc -o cd-dvd-lock cd-dvd-lock.c<br />
<br />
Usage ./cd-dvd-lock lock|unlock<br />
<br />
Depending on the parameter it either locks or unlock the tray.<br />
<br />
Copy the source below and save it in file called cd-dvd-lock.c<br />
<br />
<br /><br />------------ COPY BELOW THIS LINE------------<br /><br />/*<br />* cd-dvd-lock.c<br />*<br />* This program is free software; you can redistribute it and/or modify<br />* it under the terms of the GNU General Public License version 2 as<br />* published by the Free Software Foundation.<br />*<br />* The initial developer of the original code is Deyan T. Chepishev<br />* http://www.poweradded.net/<br />*<br />* (C) 2009 Deyan T. Chepishev<br />*/<br /><br />/*<br />*<br />* The CD/DVD device is expected to be /dev/cdrom. This is<br />* usually a symlink to the real device. If you dont want to create a symlink<br />* just edit the path in the code and point it to your CD/DVD device.<br />*<br />*/<br /><br />#include <sys/types.h><br />#include <sys/stat.h><br />#include <fcntl.h><br />#include <linux/cdrom.h><br />#include <stdlib.h><br />#include <stdio.h><br />#include <strings.h><br />#include <sys/ioctl.h> <br /><br />void usage( char a[] );<br /><br />int main(int argc, char *argv[]){<br /><br />//The location of cd/dvd device. Edit this if necessary<br />char device[]="/dev/cdrom";<br /><br />int fd,lock=9999;<br /><br /><br />// Set unbuffered output<br />setvbuf(stdout, NULL, _IONBF, 0);<br /><br />if( 2 != argc ){<br /> usage(argv[0]);<br /> exit(1);<br />}<br /><br />if (0 == strcasecmp(argv[1],"lock")){<br /> lock=1;<br />}<br /><br />if(0 == strcasecmp(argv[1],"unlock")){<br /> lock=0;<br />}<br /><br />if( (0!=lock) && (1!=lock) ){<br /> usage(argv[0]);<br /> exit(1);<br />}<br /><br />if (-1 == (fd=open(device,O_RDWR|O_NONBLOCK))){<br /> printf("Error opening device: \"%s\", ",device);<br /> perror("");<br /> exit(1);<br />}<br />if (0 != ioctl(fd, CDROM_LOCKDOOR,lock)){<br /> printf("Error locking device: \"%s\", ",device);<br /> perror("");<br /> exit(1);<br />}<br />}<br /><br />void usage( char a[] ){<br />printf("\n\nUsage %s [lock|unlock]\n\n", a);<br />}<br /><br /><br />------------ COPY ENDS ABOWE THIS LINE------------<br /></p>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com12tag:blogger.com,1999:blog-5047866452918313722.post-69244824964255939812009-08-20T01:27:00.007+03:002010-08-10T09:58:03.748+03:00Supermicro with Tylersburg chipset, stupid IPMI behavior.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Rgr_g9gn7CUv1xOCOYVhF2z5LpnBt7z_H_j6KSfo_IEPyvIvAGQbcC0OdAPbGoy9rYFdfWYTvtKEy7PQtDYgA2RiHLl7__xqNWuuvlHc5LJc4nLADcyLKyC1kOdNKnJPyzJjRWeQQrKA/s1600-h/X8DT6F_spec.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 261px; height: 222px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Rgr_g9gn7CUv1xOCOYVhF2z5LpnBt7z_H_j6KSfo_IEPyvIvAGQbcC0OdAPbGoy9rYFdfWYTvtKEy7PQtDYgA2RiHLl7__xqNWuuvlHc5LJc4nLADcyLKyC1kOdNKnJPyzJjRWeQQrKA/s400/X8DT6F_spec.jpg" alt="" id="BLOGGER_PHOTO_ID_5375030550885649634" border="0" /></a><br /><div style="text-align: justify;">============ UPDATE==============<br />I just want to add that this behaviour is fixed on IPMI firmware level.<br />There is an check-box added in the Configuration -> LAN Select, where one can choose whether to use the dedicated IPMI LAN or On-Board LAN. However still a little crippled menu, because you can not choose which Onboard port to use.<br />============ UPDATE==============<br /><br />These days I got my hands on a bunch of supermicro servers with Tylersburg chipset ( -f types of MB with embedded IPMI) and 55xx series processors.<br /><br />For the MBs from supermicro designed for 54xx and below CPUs, I got used with the IPMIs with dedicated LAN port which were working as expected. The IPMI is going out via the dedicated LAN port no matter what.<br /><br />I wanted to set up the servers ready for delivery in the data center. All I wanted to do is to set up a proper IPs on the IPMI and make sure I can see it. Everything else can be done remotely.<br /><br />The servers arrive with a sticker on them which shows the current IP set for IPMI. What I do is to plug the servers in the power sockets, without powering them on, then connect to IPMI, change the IP address and GW, then save and that is all. No noise in the office no head ace.<br /><br />With all servers with chipset different from Tylersburg so far, no problem.<br />What was my astonishment when I realized that I can not see the IPMI. My first assumption was that the IP on the sticker was wrong. Ok not a big deal, just boot into BIOS and change it from there. I did boot but all I saw was that the IP address is set as on the sticker and I still did not have any ping to the IPMI.<br /><br />I tried to set it to something else, still the same result unable to even get an ARP response from the IPMI card. These kind of problems really drives me mad.<br /><br />I got on the phone my HW vendor to ask for the weird behaviour. After a few minutes conversation, I started doing something which was against any logic. I started to unplug the network cable and try the other LAN port on the MB which were supposed to be dedicated LAN port for the MB, and guess what, IPMI was located on the first MB port instead of the dedicated IPMI port.<br /><br />From this point on, in order to make the stupid IPMI to move to the dedicated port I had to do a cold reboot with a network cable attached to the IPMI port.<br /><br />If you plug the server in the power socket without network cables connected, the IPMI is so "smart" that it goes on the wrong port again. It does not start on the dedicated IPMI LAN port but on the first port of the MB. This is completely stupid logic for me. Why should the stupid IPMI play smart. This is a server after all. You can not play with the remote management because you think you are smart. I want to be able to pin down the IPMI LAN port, to something unchangeable. Everything else is incredibly stupid, although it may look cool to someone.<br /><br />Why do I hate this. I find this behaviour unacceptable because for example you have lots of servers. All of them have IPMI cards. All the IPMI cards are connected in a private LAN which is visible only via VPN for example.<br />Now for some reason you want cold reboot of some server. You call the datacenter support and request a cold reboot.<br />All is fine so far, but imagine that during the cold reboot the support guy by mistake unplug the IPMI of the server, or the RJ45 connector is not well connected or something like this. After the cold reboot the "smart" IPMI will be pinned down to the MB LAN port and depending on the IP address set it might become visible to the public, which is really, really not a very good idea.<br /><br />I thought that this is not normal behaviour, and started to look for a way to disable it. However I found a raised middle finger in the docs:<br /><br />Notes:<br />1. If you wish to use the IPMI-dedicated LAN port for your network connections, be sure to connect an RJ45 cable to your dedicated LAN port before you activate the BMC (at first power-on or cold reset). Otherwise, the BMC will look for a shared LAN port to connect to if the IPMI-dedicated LAN cable is not detected upon BMC activation.<br />2. However, should you decide to use the IPMI-dedicated LAN port for a network connection, please perform a BMC cold reset or power cycle reset in order for the dedicated LAN to be detected.<br /><br />And the worst thing, you can not disable this stupidity so far.<br /><br />Supermicro are saying that they are working on a resolution of this issue. I hope to fix this soon and to be able to choose from the BIOS on which port I want the IPMI, not someone else to choose for me.<br /><br /></div>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com3tag:blogger.com,1999:blog-5047866452918313722.post-67846334787306832482009-08-14T11:58:00.004+03:002009-08-14T16:51:01.680+03:00Idle3 disabling, not working for some WD drivesSince these days I have troubles with the sutpid "Green" technology from Western Digital, I made some check on my servers and find on some of them more GREEN Drives. I tried to disable idle3 state on some of them, but unfortunately it just does not work for some of them.<br />For example on:<br />WD10EACS - 1T Standard edition<br /><span class="textheadertitle">WD1000FYPS - 1T WD RE2-GP </span><br /><br />On the above drives I was unable to disable idle3 state.<br /><br />wdidle3.exe /D<br /><br />wdidle3.exe gives me something like: idle3 timer set to 6500ms. No matter that one of them is RE edition. I suppose it uses some old firmware. I will try to get the latest firmware from WD.<br /><br />The program does not care that I pass the option for disabling the timer. The only good thing in this case is to increase the timer to maximum value<br /><br />wdidle3.exe /S255<br /><br />Actually from the HDDs I have tried to play with, the only one which actually agree to disable their timer were WD 2TB RE4 model: WD2002FYPS<br /><br />Conclusion: DO NOT buy GREEN HDDs for servers. They will screw you.psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com2tag:blogger.com,1999:blog-5047866452918313722.post-84968953268624373322009-08-07T22:54:00.010+03:002009-08-28T18:01:22.099+03:00DOS boot from GRUB<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuZ5ZrL-qECajb4hmGrivGelhrYRGPNQYtdQ9xR_4ss_0g0VGt8r8X4gyuFVWHUx0vA9D2tzvuvaKYX4AUNU16jwYNPD839AntXTLCWOYL1sxoLaAynqKMROqdiZHX-bITNeXjV5_C5tYj/s1600-h/ms-dos.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 176px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuZ5ZrL-qECajb4hmGrivGelhrYRGPNQYtdQ9xR_4ss_0g0VGt8r8X4gyuFVWHUx0vA9D2tzvuvaKYX4AUNU16jwYNPD839AntXTLCWOYL1sxoLaAynqKMROqdiZHX-bITNeXjV5_C5tYj/s200/ms-dos.jpg" alt="" id="BLOGGER_PHOTO_ID_5367323468722737058" border="0" /></a><br /><br />If you are running linux and you are wondering how to boot DOS without using boot floppy or CD image keep reading :).<br /><br />This article will also help to those people, who want to flash their BIOS without making a boot floppy or CD or DVD or whatever.<br /><br />You can download either FreeDOS or MSDOS or whatever DOS version you want.<br />All you need is plain .img image. I will show you how to do this using FreeDOS, but it should be pretty similar for other DOS versoins.<br /><br />You can download FreeDOS image from here:<br /><a href="http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz">http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz</a><br />Or MSDOS image from here:<br /><a href="http://www.allbootdisks.com/">http://www.allbootdisks.com/</a><br /><br /></div><p style="text-align: justify;"><span style="font-weight: bold;">1. Download the fdos and the files you theoretically would want to put on a floppy.</span><br /></p><div style="text-align: justify;"> <pre> <span style="font-style: italic;">wget </span><a style="font-style: italic;" href="http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz" class="external free" title="http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz" rel="nofollow">http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz</a><br /><span style="font-style: italic;"> gunzip FDOEM.144.gz</span><br /></pre><br /></div><p style="text-align: justify; font-weight: bold;">2. Install syslinux (dos floppy bootloader): </p><div style="text-align: justify;">On redhad based distros this is pretty straight forward:<br /><br />yum install syslinux<br /><br />I guess that almost all distributions have this package<br />Create DOS directory and copy bootloader/diskimage </div><p style="text-align: justify; font-weight: bold;">3. Create a directory for DOS stuff and copy the bootloader and the disk image there. memdisk may be elsewhere on your system, and the image will be wherever you copied/unzipped it to. </p><div style="text-align: justify;"> <pre> <span style="font-style: italic;">mkdir /boot/dos</span><br /><span style="font-style: italic;"> cp /usr/lib/syslinux/memdisk /boot/dos</span><br /><span style="font-style: italic;"> cp FDOEM.144 /boot/dos</span><br /><br />NOTE: memdisk may be located somewhere else. It is part of syslinux package, just find where it is.<br /><br />If you want to add some additional programs/files to the floppy (for example BIOS flash program and ROM file)<br /><br /></pre></div><p style="text-align: justify; font-weight: bold;">4. Create a mount point and mount the floppy image. </p><div style="text-align: justify;"><span style="font-style: italic;"> mkdir /media/floppy mount -t msdos -o loop /boot/dos/FDOEM.144 /media/floppy</span><br /><br />Note, if a different boot image is being used (instead of FDOEM.144) that should be called instead.<br />Once /media/floppy is mounted, one can copy various DOS programs to that "floppy" area, such that they will be present after one reboots.<br /><pre><br /><span style="font-size:130%;">Add boot option to grub for floppy</span><br /></pre></div><p style="text-align: justify; font-weight: bold;">5. Add a boot option for the floppy image. </p><p style="text-align: justify;">For redhat distros and derivatives the GRUB config file is:</p><p style="text-align: justify;">/etc/grub.conf</p><p style="text-align: justify;">for Suse<br /></p><p style="text-align: justify;"> /boot/grub/menu.lst<br /></p><div style="text-align: justify;"><span style="font-style: italic;">title DOS</span><br /><span style="font-style: italic;">root (hd0,0)</span><br /><span style="font-style: italic;">kernel /boot/dos/memdisk</span><br /><span style="font-style: italic;">initrd /boot/dos/FDOEM.144</span><br /><span style="font-style: italic;">boot</span><br /><br />Note: If you have separate boot parition you should remove "/boot" from the path:<br /><br /><span style="font-style: italic;">title DOS</span><br /><span style="font-style: italic;">root (hd0,0)</span><br /><span style="font-style: italic;">kernel /dos/memdisk</span><br /><span style="font-style: italic;">initrd /dos/FDOEM.144</span><br /><span style="font-style: italic;">boot</span><br /><br />Regarding the line: "root (hd0,0)", take a look at the other entries in your config file and put the same numbers</div>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-87688826474628518622009-08-07T16:39:00.008+03:002009-08-07T23:34:23.933+03:00Dos boot images<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibsZ18RCzK9QNQSti3OXt0M3e7EpxWGHBQJPic5TJLP_bGqPK10Nye6q2o0aSM8eqAVODYk5yCH5m90NW2NOzwTabFwXD8N3QRgmGeZJBLglzYl5c-GYgl2MiNL_zyxIKxJzozZLVKdIrX/s1600-h/Msdos622.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 313px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibsZ18RCzK9QNQSti3OXt0M3e7EpxWGHBQJPic5TJLP_bGqPK10Nye6q2o0aSM8eqAVODYk5yCH5m90NW2NOzwTabFwXD8N3QRgmGeZJBLglzYl5c-GYgl2MiNL_zyxIKxJzozZLVKdIrX/s320/Msdos622.jpg" alt="" id="BLOGGER_PHOTO_ID_5367226036864512994" border="0" /></a><br /><div style="text-align: justify;">In my work I am dealing with lots of machines which are not running Microsoft OS-es. However sometimes (for example to flash bios) I need to boot DOS, which really drives me mad, because I use linux on my laptop and all the dos images available for download are basically .exe programs which are trying to automatically create you an FDD disk. For example on this site: <a target="_blank" href="http://www.bootdisk.com/">http://www.bootdisk.com/</a> there are lots of boot images, but unfortunately all of them are "smart" .exe programs.<br /><br />As you can imagine this is completely unsuitable in my case for 2 reasons:<br /><br />1. I dont run windows.<br />2. I dont have a FDD drive.<br /><br />This basically renders this images pretty useless.<br />So my basic goal was to find a plain .img file, which can be copied directly on floppy with 'dd' or, the better choice, to be booted directly from GRUB.<br /><br />After some google searching I found a site which have lots of Dos bootable disks in .img files.<br /><br /><div style="text-align: left;">You can download such images from this site: <a target="_blank" href="http://www.allbootdisks.com/">http://www.allbootdisks.com/</a><br /><br />If you want to know, how to boot DOS from whitin GRUB, take a look at this article:<br /><br /><a href="http://www.poweradded.net/2009/08/dos-boot-from-grub.html">http://www.poweradded.net/2009/08/dos-boot-from-grub.html</a><br /></div></div>psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0tag:blogger.com,1999:blog-5047866452918313722.post-82910329644638985882009-08-05T22:11:00.003+03:002009-08-05T22:44:13.443+03:00Western Digital WD RE4 2TB HDD troubles: UPDATE1Here is a little update of my article about WD RE4 2TB HDD<br /><br />Here is the previous post:<br /><a href="http://www.poweradded.net/2009/08/western-digital-wd-re4-2tb-hdd-troubles.html">http://www.poweradded.net/2009/08/western-digital-wd-re4-2tb-hdd-troubles.html</a><br /><br />After 4 days of testing with "smart" parking turned off, using wdidle3.exe, it looks like the problem is gone so far.<br />However I am still pissed off to the manufacturer of controller and backplane (Supermicro for both). It is not acceptable some stupid failure of a lousy HDD to drag the other arrays down. You can not imagine the headache you will get when you loose 14T of data if it is important. And all this because of the stupid and not suitable for servers "smart" head parking from Western Digital<br /><br /><br />P.S. You know, when I was trying to find if anyone have at least something similar to my problems with these drives, when I type WD RE4 problems in google, I was getting some result for "Resident Evil 4". Quite suitable dont you think :) ? The new drives from Western Digital 2TB, Green Power, Resident Evil 4 (RE4).<br /><br />More to come, when I get the HDDs and plug them in to my chassis.psy__http://www.blogger.com/profile/10065406688953064403noreply@blogger.com0