Click here

Tuesday, September 6, 2016

SVN useful commands

1) To see the list of files changed between 2 revisions

svn diff  -rX:Y 
svn log -v -rX:Y

X - Revision1
Y- Revision 2

Example:
 svn diff  -r11995:12159 

2) To checkout a branch

svn checkout  <branch name>

Example:

svn checkout https://xyz.com/testCode

3) To checkout a specific version

svn checkout -r "revisionNumber" "url"

Example:

svn checkout -r 12345 https://xyz.com/testCode


Monday, August 8, 2016

Windows shortcut to Mute/unMute volume

you can create a Master Volume Shortcut and also assign a Shortcut Key.

Right click on a empty area on desktop, and click on New and Shortcut. 

Paste the following in to the location of the item area:-

%windir%\System32\SndVol.exe -f 49825268

Click Next button and give a name to the Shortcut and click Finish.

Now You right click on it and select Properties.

Click Shortcut tab.

Assign your desired shortcut key like F8 or F9 in the Shortcut Key area.

Click OK/Apply.

Monday, August 1, 2016

Decoding Machine check register exception

Dump
CPU 0: Machine Check Exception: 0000000000000004
CPU 1: Machine Check Exception: 0000000000000005
      Bank 5: b200000802000e0f


Kernel Code snippet:

rdmsr (MSR_IA32_MC0_STATUS+i*4,low, high);  - reads the values of 64 bit machine check registers
        if (high & (1<<31)) {
            if (high & (1<<29))
                recover |= 1;
            if (high & (1<<25))
                recover |= 2;
            printk (KERN_EMERG "Bank %d: %08x%08x", i, high, low);
if (recover & 2)
        panic ("CPU context corrupt");

Decoding : 

( Reference Document)
You will need to browse to Intel’s website hosting Intel® 64 and IA-32 Architectures Software Developer Manuals. There, download a manual named “Intel 64 and IA-32 Architectures Software Developer’s Manual Combined Volumes 3A, 3B, and 3C: System Programming Guide”.

(Reference: https://vmxp.wordpress.com/2014/10/27/debugging-machine-check-errors-mces/comment-page-1/)

IA32_MCi_STATUS MSRS
Each IA32_MCi_STATUS MSR contains information related to a machine-check error if its VAL (valid) flag is set.

Bank 5: b200000802000e0f  - In hex format


63 62 61 60 59 58 57 56 55  54 53      52 - 38                37   36-32         31 - 16                     
1    0  1   1   0   0  1    0  0     00        000000000000000  0    01000   0000 0010 0000 0000   

 15  - 0
0000 1110 0000 1111  ( Bank value in binary format)


63 -  VAL -MCi_STATUS register valid
61 - Uncorrected error
60  - Error reporting enabled
57 - Processor context corrupt

Model specific errors   ( 16 – 31 bits) - Model-specific error code field, bits 31:16
27-25 bits - Bus queue error type

000 for BQ_ERR_HARD_TYPE error
001 for BQ_ERR_DOUBLE_TYPE error   --  It’s Double bit error detected on data read in our case
010 for BQ_ERR_AERR2_TYPE error
100 for BQ_ERR_SINGLE_TYPE error
101 for BQ_ERR_AERR1_TYPE error

0 -15 -  Specifies the machine-check architecture-
defined error code for the machine-check error condition detected
IA32_MCi_Status [15:0] Compound Error Code Encoding


Wednesday, July 27, 2016

Configure webserver in Virtual box

Guest OS: Ubuntu 15.04
Host OS:   Windows

1) Install apache in webserver
         sudo apt-get install apache2

2) Check the status of webserver
            sudo service apache2 status

3) Configure a static file of your own

       sudo vi /var/www/html/hello.txt

4) To access the webpage from host OS, you need to configure " Host-Only adapter" in adapter settings

settings->Network->adapter1

5) After adpater settings check for interface IP inside VM ( Mostly its in 192.168.*.* range). Also ping the IP from host OS to validate the IP connectivity.

6) Access the configured static webpage from host OS
  http://192.168.*.*/hello.txt

Wednesday, February 3, 2016

Virtual box VM communication

In order to communicate between the VM's and also to connect to  an internet, please follow the below steps

1) Select Settings->network-> Attached to :Internal network from virtual Box GUI


2) Once VM boots up, we need to configure static IP's for an interface  to communicate between the VM's.
You need to stop networking service in VM's from resetting an interface.

3) Suppose if you want to connect to an internet  you need to configure NAT network 

File->preferences->Network  and add NAT networks

Tuesday, July 28, 2015

rsyslog

we can do lot of things with rsyslog. But its quite difficult to find the right options to achieve our goals. Templates in rsyslog are little bit confusing. Hereby I have shared the useful commands and tips which I have used so far.

Option 1
If you want to log messages contains specific string(IP, MAC etc), you can use the below option

:msg, contains, "172.71.12.19" /var/log/userip.log
 
This option logs all the messages with string "172.17.12.19" in userip.log 


Option2
Before I go to option2 , I want to explain few concepts for better understanding


In syslog, we configure sending logs using facility.severity, where facility is the name of the (let's call it) "component" of the system, such as kernel, authentication, and so on; and severity is the "level" of each of the logs logged by a facility, such as info (informational), crit (critical) logs.
So, if I want to send kernel critical logs, I'll use kern.crit.
The combination of facility and severity is known as the priority, for example...
  • priority = kern.crit
  • facility = kern
  • severity = crit

The facilities local0 to local7 are "custom" unused facilities that syslog provides for the user. If a developer create an application and wants to make it log to syslog, or if you want to redirect the output of anything to syslog (for example, Apache logs), you can choose to send it to any of the local# facilities. Then, you can use /etc/syslog.conf (or /etc/rsyslog.conf) to save the logs being sent to that local# to a file, or to send it to a remote server.

Suppose you have a configuration in syslog to log all the dameons using local0 facility

local0.*  /var/log/messages.log

If you want to skip the specific daemon(snort) logs from messages.log and want to log in a specific file then we need to use option 2.



:msg, contains, "snort"          -/var/log/messages

& ~


Symbol "~ " -denotes discards logging  


The configuration uses a property-based filter to see if the string "snort is contained" inside the MSG part of the syslog message. If so, the message is written to /var/log/messages. The next line then discards all messages that have been written.



Sunday, February 9, 2014

Compiling and Running 32 bit UML on 64 bit Debian operating system

Steps followed
============
1) apt-get install uml-utilities
2) sudo apt-get install gcc-multilib
C_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)
http://stackoverflow.com/questions/12591629/gcc-cannot-find-bits-predefs-h-on-i686
Since we are compiling the UML kernel for 32 bit in 64 bit operating system, we need a gcc-multilib package to solve the library issues
3) #include<sys/stat.h> in ./arch/um/os-Linux/mem.c
http://stackoverflow.com/questions/5918539/c-warning-implicit-declaration-of-function-fchmod
4) The below patch needs to be applied
 In some cases gcc >= 4.5.2 will optimize away current_thread_info().
To prevent gcc from doing so the stack address has to be obtained
via inline asm.

LKML-Reference: http://marc.info/?i=201104132150.05623.richard@...>

Acked-by: Kirill A. Shutemov <kirill@...>
Signed-off-by: Richard Weinberger <richard@...>
---
 arch/um/include/asm/thread_info.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
index e2cf786..5bd1bad 100644
--- a/arch/um/include/asm/thread_info.h
+++ b/arch/um/include/asm/thread_info.h
@@ -49,7 +49,10 @@ static inline struct thread_info *current_thread_info(void)
 {
         struct thread_info *ti;
         unsigned long mask = THREAD_SIZE - 1;
-       ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
+       void *p;
+
+       asm volatile ("" : "=r" (p) : "0" (&ti));
+       ti = (struct thread_info *) (((unsigned long)p) & ~mask);
         return ti;
 }

--
1.7.4.2

http://sourceforge.net/mailarchive/message.php?msg_id=27397459

Compilation steps
================
1) make mrproper ARCH=um
2) make menuconfig ARCH=um SUBARCH=i386
http://uml.devloop.org.uk/faq.html
3) make ARCH=um SUBARCH=i386

Omicron - people gathers in crowd

Amidst omicron thread, people are gathered in crowd at markets and public places to buy their daily needs. Because of full lockdown at Sunda...