Adding a permanent network route in Windows

It’s not that common to add a network route in windows, but if you have more than one network interface and there are many networks hidden over there, you will need to do it

The syntax is quite simple

route -p add the_network mask the_netmask the_gateway metric the_metric

As an example, we will use the following information:

the_network 192.168.254.144
the_netmask 255.255.255.240
the_gateway 192.168.203.158
the_metric 10

And the resulting command is:

route -p add 192.168.254.144 mask 255.255.255.240 192.168.203.158 metric 10

-p means the network will be added permanently in windows registry, if you want to play with this new network until the next reboot, don’t use it.
If you do not what to do with metric , simply use 10

To check the routing table, use the command

route print

Squid 3.3 in Raspbian Wheezy

I have been playing recently with Squid and “Splash pages”, but this function works fine on Squid 3.2 and later; however Raspbian only offers Squid 3.1.

I looked for a ready to install 3.2+ version in the Webz but didn’t find one, so I backported the Debian Jessie version.

For the lazy ones, here are the links (try them at your own):

libecap2 (This dependency is not available in Wheezy)

libecap2_0.2.0-1_armhf.deb

libecap2-dev_0.2.0-1_armhf.deb

Then install squid3 (install according to your needs)

squid3_3.3.8-1.1_armhf.deb 

squid3-dbg_3.3.8-1.1_armhf.deb

squidclient_3.3.8-1.1_armhf.deb
squid3-common_3.3.8-1.1_all.deb

squid-cgi_3.3.8-1.1_armhf.deb

squid-purge_3.3.8-1.1_armhf.deb

 

Mounting a partition from a dd image

At some point, everybody may have done a dd image of a USB/SD stick, as the below example shows:

dd if=/dev/sdb of=foo.img 

But it is usual that at some point in time we would like to access the information inside the image, doing that is quite easy:

First,you should do a fdisk on the image:

fdisk -l foo.img

Disk foo.img: 7998 MB, 7998537728 bytes, 15622144 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002fc6d

Device Boot      Start         End      Blocks   Id  System
foo.img1   *             15622143     7811071+   c  W95 FAT32 (LBA)

Then some maths are needed. The operators are the start of the partition and the sector size in bytes.  The operation is simply start * sector size in bytes.

In this particular case the operation is 1 * 512 = 512.

Now that we have the result, that we call the offset. In other words, 512 is the offset where the partition starts in this dd image.

So the command to mount the partition is:

mount -t vfat -o loop,ro,noexec,offset=512 foo.img /mnt/mountpoint

And then we can copy the information from the partition inside!

 

 

 

 

Seeing what is being written or read in real time in Linux

Have you ever wondered which processes/tasks write or read to disk in Linux?  Maybe a real time log?

It’s quite simple to enable that feature with the following command:

echo 1 >/proc/sys/vm/block_dump

The output of the command goes to /var/log/messages or /var/log/kernel.log . It depends on the distribution you are using and how your log manager is configured.

Nov  9 21:21:01 hellboy kernel: [140072.428410] bash(31632): READ block 14156776 on md126p4 (8 sectors)
Nov  9 21:21:01 hellboy kernel: [140072.443138] bash(31632): READ block 14156816 on md126p4 (8 sectors)
Nov  9 21:21:57 hellboy kernel: [140127.746763] gnome-shell(5073): WRITE block 120375776 on md126p4 (8 sectors)
Nov  9 21:21:57 hellboy kernel: [140127.765385] gnome-shell(5073): dirtied inode 3627285 (?) on md126p4
Nov  9 21:22:00 hellboy kernel: [140130.602614] nvidia-settings(31743): dirtied inode 689070 (exe) on proc

The output shows the timestamp, the process name, the operation being done (read/write/dirty inode), block or inode number and the device.

Just to take note, a dirty inode is an inode that has had new data written into it but it has not been flushed to disk.

 

Dropping Linux Memory Cache

A Linux server of my own executes from time to time an rsync script, which one it finishes up doing its magic, leaves behind a lot of stuff cached in memory.

In order to “make available” the memory again to other applications, I recommend reading the following as seen on linux-mm.org

Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache…

 To use /proc/sys/vm/drop_caches, just echo a number to it.

 To free pagecache:

# echo 1 > /proc/sys/vm/drop_caches

To free directory entries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run “sync” first to flush them out to disk, these drop operations will tend to free more memory.

 

Purging WINS cache on Windows

On cmd execute:

nbtstat -R

parted: the resulting partition is not properly aligned for best performance

Rather than explaining the problem the title says, I’ll point you to the link you must read to understand/fix it:

http://blog.aloisiojr.com/?p=28

net-news/liferea-1.8.3 has improved its startup speed

For everybody out there complaining about liferea’s decreased performance in the 1.8.x releases, upstream has released 1.8.3 which uses sqlite 3 WAL journaling.

This basically improves the overall liferea’s performance, so if you are hating 1.8.x, please try the latest 1.8.3

Install Telnet Client on Windows 7 and above by using a command line

Quick ‘n dirty, from the cmd “console”

pkgmgr /iu:"TelnetClient"

Enterprise Manager 10.2.0.5 is not able to connect to the database instance

This error may have a variety of causes, and this is how I fixed it:

1. Dropped old Database Console

$ emca -deconfig dbcontrol db

2. Recreated Database Console

$ emca -config dbcontrol db

In the above step, the operation log ended up with:

SEVERE: Error starting Database Control
CONFIG: Stack Trace:
oracle.sysman.emcp.exception.EMConfigException: Error starting Database Control
at oracle.sysman.emcp.EMDBPostConfig.performConfiguration(EMDBPostConfig.java:649)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:227)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:196)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:184)
at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:494)
at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1161)
at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:478)
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:426)

After having repeated steps 1 and 2 a couple of times, checked environment variables were correctly set and checked users SYS, DBSNMP and SYSMAN were not locked, I started looking for this issue in oracle forums and I found the following:

https://forums.oracle.com/forums/thread.jspa?threadID=2173463

The root certificate used to secure communications via the Secure Socket Layer (SSL) protocol expires on 31-Dec-2010 00:00:00O , so If you try to configure Database Console after that date the certificate will cause errors.

Luckyly, Oracle released patch 8350262 which solves this issue.

3. So the obviously following step is to apply patch 8350262 which doesn’t need to put the database offline. Just check the provided README.txt from the patch zip file and you’ll be safe.

4. Repeat steps 1 and 2 again, and your OEM will be up this time :)

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.