Showing posts with label Linux -- Tips n Tricks. Show all posts
Showing posts with label Linux -- Tips n Tricks. Show all posts

Thursday, March 13, 2014

"Printer-out-of-paper" error or bug?


I am using HP-1050 Deskjet printer and it is attached by USB to Fedora-14 system. Installed cups package is cups-1.4.8-5.fc14.i686. Sometime back as I was printing a document when the printer was out of paper. I put back the paper in place and everything started working normally Except the error message "Printer-out-of-paper" which seem to have permanently stuck on the printer. 

system-config-printer (version 1.2.9) showed printer with the red error sign. The status message under Properties -> Ink/Toner Levels displays "Printer HP-Deskjet-1050-J410 is out of paper"

The point to note here is that the printer was working normally apart from that status message which was quite annoying. Restarting of cups service, switching on and off the printer did not help the cause.

How to fix;

After a bit search (hit and trial), I commented out the following line in /etc/cups/printer.conf;

# Reason media-empty-error

Restarted the cups service and voila!! The error message is no longer visible. 

Wednesday, February 19, 2014

Accessing a Linux box in GUI mode

Here is how to setup a Linux system that would allow you to access it from a remote system using VNC client

A.       Login to the Linux box & switch to root user. Now, install and configure
           the packages stated below;

1.          yum groupinstall "Desktop"

2.         yum install xorg-x11-fonts-100dpi.noarch xorg-x11-fonts-ISO8859-1-100dpi.noarch
            xorg-x11-fonts-misc.noarch xorg-x11-fonts-Type1.noarch tigervnc-server

3.         Modify the /etc/inittab to set runlevel 5 (thus, the system would run
            in full GUI mode)

4.         Now, configure vnc password with the command "vncpasswd"

5.         Start the vncserver by running the command "vncserver"


B.       On the client system install VNC-Viewer-XXX from the link
           http://www.realvnc.com/download/viewer/

C.       Start the VNC-Viewer client and connect to the Linux box ( :5901 
           as the VNC Server value)

Note:    Just in case you are not able to access the System, check the iptables rules 
             (firewall) and allow the port 5901 to be accessed from outside.



Tuesday, August 10, 2010

IPTABLES, Custom IP Chains in Linux

Creating a custom IP Chain, adding rules to that and creating a rule which would bring the Custom Chain into play:

1. Create a New Rule:
[root@rhel5 ~]# iptables -N MYCHAIN

2. Add a rule to that chain eg. to disallow an IP (192.168.1.10) from accessing the SMTP port (25) on (192.168.1.20):
[root@rhel5 ~]# iptables -A MYCHAIN -s 192.168.1.10 -d 172.168.1.20 -p tcp --dport 25 -j REJECT

(The destination IP is an alias to the network interface eth0, eg. eth0:1)


3. Creating a rule in the default INPUT chain which would jump to the custom rule whenever any request comes on the eth+ interface:
[root@rhel5 ~]# iptables -A INPUT -i eth+ -j MYCHAIN

4. Save the iptables rules:
[root@rhel5 ~]# service iptables save

5. Restart the iptables service
[root@rhel5 ~]# service iptables restart

6. To list all the rules;
[root@rhel5 ~]# iptables -L

Saturday, July 31, 2010

Trouble setting up wireless for the network card type BCM4312 802.11b/g on Dell Inspiron-1525 running Fedora-13 ?

This piece of information is for all those who might face some issue in setting up of wireless network for Fedora release 13 (Goddard) on your "Dell Inspiron - 1525" laptop having BCM4312 802.11b/g card. The default driver which Fedora-13 provided for BCM4312 802.11b/g didn't work for me, thus I had look for a driver that would have served my purpose of going wireless. Following are the steps by which I could make wireless working for me, hope it helps you too...


So let's get started;
1. Check if you have wireless connection;
[root@Fedora-13 ~]# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wlan0 IEEE 802.11bg Mode:Managed Access Point: Not-Associated
Tx-Power=0 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
pan0 no wireless extensions.


(Well, it shows wlan0 since it has the driver installed for wireless device, but for me unfortunately this did work when I tried to connect it with my wireless modem). Thus the workaround is to remove the driver installed and find an appropriate one and hook it up with the Broadcom network card.

2. Locate the Device ID's of Broadcom cards on your system by:
[root@Fedora-13 ~]# lspci -n | grep 14e4

3. Locate the installed driver;

[root@Fedora-13 ~]# lspci -v
0b:00.0 Network controller: Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01)
Subsystem: Dell Wireless 1395 WLAN Mini-Card
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at fe7fc000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [58] Vendor Specific Information: Len=78
Capabilities: [e8] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [d0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [13c] Virtual Channel
Capabilities: [160] Device Serial Number 41-d9-4d-ff-ff-a9-00-23
Capabilities: [16c] Power Budgeting
Kernel driver in use: b43-pci-bridge
Kernel modules: ssb

4. Note the Kernel module from above output and if you are interested to get the details;
[root@Fedora-13 ~]# modinfo ssb
filename: /lib/modules/2.6.33.3-85.fc13.i686/kernel/drivers/ssb/ssb.ko
license: GPL
description: Sonics Silicon Backplane driver
srcversion: B67624D9C93DCB668DC35D2
alias: pci:v000014E4d0000432Bsv*sd*bc*sc*i*
alias: pci:v000014E4d00004329sv*sd*bc*sc*i*
alias: pci:v000014E4d00004328sv*sd*bc*sc*i*
alias: pci:v000014E4d00004325sv*sd*bc*sc*i*
alias: pci:v000014E4d00004324sv*sd*bc*sc*i*
alias: pci:v000014E4d00004321sv*sd*bc*sc*i*
alias: pci:v000014E4d00004320sv*sd*bc*sc*i*
alias: pci:v000014E4d00004319sv*sd*bc*sc*i*
alias: pci:v000014E4d00004318sv*sd*bc*sc*i*
alias: pci:v000014E4d00004315sv*sd*bc*sc*i*
alias: pci:v000014E4d00004312sv*sd*bc*sc*i*
alias: pci:v000014E4d00004311sv*sd*bc*sc*i*
alias: pci:v000014E4d00004307sv*sd*bc*sc*i*
alias: pci:v000014E4d00004306sv*sd*bc*sc*i*
alias: pci:v000014E4d00004301sv*sd*bc*sc*i*
depends: mmc_core
vermagic: 2.6.33.3-85.fc13.i686 SMP mod_unload 686
5. Download the driver files:
Downloaded the file hybrid-portsrc-x86_32-v5.60.48.36.tar.gz from

6. Extract it under a folder like /home/bijit/Downloads/hybrid_wl;
[root@Fedora-13 hybrid_wl]# tar -xvzf hybrid-portsrc-x86_32-v5.60.48.36.tar.gz

7. Now, you can refer to the installation manual that comes with package which was downloaded. But,
let me continue with how that was done on my system...
To build the driver I did the following;

8. Check the version of the installed Kernel;

[root@Fedora-13 hybrid_wl]# uname -r
2.6.33.3-85.fc13.i686

9. To make sure if I have the all the tools available, tried the following command only to encounter the
error :-)

make: *** /lib/modules/"release"/build: No such file or directory. Stop.

10. So, I would require the Kernel-devel package since it would not have thrown the above
error and there would have been the directory (/lib/modules/2.6.33.3-85.fc13.i686/build)
created by that package.

11. Installed the following Development package for building kernel modules to match the kernel;
kernel-devel-2.6.33.3-85.fc13.i686

12. Now, check for the directory which was missing earlier;
[root@Fedora-13 hybrid_wl]# ll /lib/modules/2.6.33.3-85.fc13.i686/build
lrwxrwxrwx. 1 root root 46 May 13 06:58 /lib/modules/2.6.33.3-85.fc13.i686/build
-> ../../../usr/src/kernels/2.6.33.3-85.fc13.i686

13. Building the driver as a loadable kernel module (LKM);
[root@Fedora-13 hybrid_wl]# make clean
[root@Fedora-13 hybrid_wl]# make
(Well, here I had to install gcc with all/any of its dependencies. This was necessary since compilers were
missing on my system)

14. In the above steps, the build process completes to generate "wl.ko" file.

15. I need to remove the previous non-fuctional "ssb" drivers;
[root@Fedora-13 hybrid_wl]# lsmod | grep "b43\|ssb"
[root@Fedora-13 hybrid_wl]# rmmod ssb; rmmod b43

16. As a precaution blacklisted the drivers to prevent it from getting loaded in future;
[root@Fedora-13 hybrid_wl]# echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf;
[root@Fedora-13 hybrid_wl]# echo "blacklist b43" >> /etc/modprobe.d/blacklist.conf;

17. Insmod the driver that was built in the previous steps;
Since, no "wl" drivers were prior to this one on my system, i had to add a security module before using the "wl" module.
[root@Fedora-13 hybrid_wl]# modprobe lib80211
then;
[root@Fedora-13 hybrid_wl]# insmod wl.ko

Wireless driver (wl.co) is now operational. Needed to wait for couple of seconds since
the Network Manager would take few seconds to detect the presence of a new network
driver and show the surrounding wireless networks.

18. Make the driver Boot time loadable.
[root@Fedora-13 hybrid_wl]# cp wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/

Lets generate modules.dep and map files
[root@Fedora-13 hybrid_wl]# depmod -a
[root@Fedora-13 hybrid_wl]# echo modeprobe wl >> /etc/rc.local

Note: I ignored the license warning that I received at the time of module insertion. I don't think its going to make any difference. Well, the whole setup also works for Fedora-10 instalations if you have network card is the one mentioned above...

My wireless network on Fedora-13 is working smoothly like any other wireless on any other devices :-)

Saturday, April 11, 2009

Linux don't run well on Laptops! Who says :-)

I have successfully installed and configured Fedore Core 10 (Cambridge) on my Dell Inspirion 1525 Laptop without a hiccup.The only thing that annoyed me is that I could not play a single mp3 file in any of dozens of Music Players available on FC10. This is really a frustrating aspects of some modern Linux distros is that they do not come with mp3 support rolled in. May be, it is intentionally done to avoid any licensing issues. Also, granted using the ogg format is a much better solution as well as a much better sounding format but for a user like me who has a massive amount of mp3 files already located on multiple hard drives converting to ogg format would be a very time consuming option. So, I wanted to have the mp3 support on my native laptop itself.Here is the solution I have found.The first command will install the necessary repositories for yum to use.
First issue: rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
Now it’s time to install the actual plugin for support.
yum -y install gstreamer-plugins-bad gstreamer-plugins-ugly xine-lib-extras-nonfree

Now my system will allow mp3 playback in the major players. But there is still no xmms. To install xmms with mp3 support issue the following command:
yum install xmms xmms-mp3
Once this is finished your machine is all ready for full-blown mp3 playback in just about every type of application!

Monday, June 23, 2008

Installing ORACLE 9i on RHEL5

Note: I have installed it successfully on "Red Hat Enterprise Linux Server release 5 (Tikanga)" 32 bit. Please understand; it involves tweaking of Kernel parameters, so take care while you do that.

Steps:
1. Create oracle User AccountLogin as root and create te user oracle which belongs to dba group.$ su - root
# groupadd dba
# useradd -g dba oracle
2. Setting System parameters:Edit the /etc/sysctl.conf with an editor like vi and add following lines:kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
Note: You need to execute "sysctl -p" to apply the above settings.

3. Setting Oracle EnviromentEdit the /home/oracle/.bash_profile file and add following lines:ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/920
ORACLE_SID=orcl
LD_LIBRARY_PATH=$ORACLE_HOME/lib
ORACLE_OEM_JAVARUNTIME=/opt/jre1.3.1_15
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH ORACLE_OEM_JAVARUNTIME PATH

Save the .bash_profile and execute following commands to load the new environment:
# cd /home/oracle.

# .bash_profile
4. Create base directory for OracleLogin as root and create base directory for Oracle ($ORACLE_BASE).
$ su - root

# cd /opt
# mkdir oracle
# chown oracle:dba oracle
5. Download and install required .rpm packagessome additional packages may be required for successful installation . To check whether required packages are installed on your operating system use following command:

rpm -q gcc glibc-headers glibc-kernheaders glibc-devel compat-libstdc++ cpp compat-gcc
6. Download the Java Runtime Enviroment (I used j2re-1_3_1_19-linux-i586.bin) from the
Sun website. Login as root, give the file execute permission and then execute it. When the JRE is exracted move the same under the directory "/usr/local" directory.# chmod +x j2re-1_3_1_19-linux-i586.bin

# ./ j2re-1_3_1_19-linux-i586.bin
# mv jre1.3.1_19 /usr/local/
7. Download the Oracle 9i (9.2.0.4) software from
Oracle website. Extract the files using following command:


gunzip ship_9204_linux_disk1.cpio.gz

gunzip ship_9204_linux_disk2.cpio.gz
gunzip ship_9204_linux_disk3.cpio.gz
cpio -idmv "<" ship_9204_linux_disk1.cpio
cpio -idmv "<" ship_9204_linux_disk2.cpio
cpio -idmv "< "ship_9204_linux_disk3.cpio
mv Disk* /home/oracle/
chown –R oracle:dba Disk*

When all archives were extracted you've got three directories Disk1, Disk2 and Disk3.

Edit the Disk1/install/linux/oraparam.ini and modify JRE_LOCATION variable and set path to our JRE installation from Step 6. JRE_LOCATION=/usr/local/jre1.3.1_19 4.

Start the Oracle software installation process. To start the installation process; execute the following commands:

$ cd Disk1
$ ./runInstaller

***************************************************
Errors with solutions:
1. When network configuration assistant and database configuration assistant has failed during startup then do following steps:
Solution:
$ cd /opt/oracle/920
$ rm JRE $ ln -s /usr/local/jre1.3.1_19 JRE
$ su - root
# cd /opt/oracle/920/JRE/bin # ln -s java jre
# cd i386/native_threads
# ln -s java jre
2. If you encounter the following error:
ORACLE_HOME/Apache/Apache/bin/httpd: error while loading shared libraries: libdb.so.2: cannot open shared object file: No such file or directory Solution: Create a symbolic link
$ su - root
# ln -s /usr/lib/libgdbm.so.2.0.0 /usr/lib/libdb.so.2
3. If you encounter something like below at the very beginning of installation:
error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory
Solution:
$ su - root
# cd /usr/lib
# ln -s libstdc++-3-libc6.2-2-2.10.0.so libstdc++-libc6.1-1.so.2
Now, run the installer again:
$ ./runInstaller
****************************************************
Note: If you encounter any more errors, please post it here










Sunday, June 10, 2007

Want to Hide yourself???

Do you want your Linux Box not to respond to ping request!
Here is how to do....

Check the value of /proc/sys/net/ipv4/icmp_echo_ignore_all
i.e.cat /proc/sys/net/ipv4/icmp_echo_ignore_all
Now, replace the current value by 1

i.e. echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

Now, try and ping your system from a different system...Are u getting any response????
Reboot ur system, and ur current settings is lost (Default is reverted back.. i.e. ping is enabled again.)

Want to make this a permanent one???
Make the following entry in /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_all=1

Now, run the following command to make the change effective...
sysctl -p


You are Hidden!!!

Monday, June 4, 2007

Shell Script

# Creating 50 users through a small script and setting their password as "password"
for x in {1..50}
do
useradd user$x; echo "password" (Place the Pipe symbol here) passwd --stdin user$x
done