Showing posts with label linux troubleshooting. Show all posts
Showing posts with label linux troubleshooting. Show all posts

Sunday, January 8, 2012

Fixing 'initramfs error' boot Problem in Linux.

Yesterday, I faced initramfs boot error on my Linux Mint 9 box. I don't know what went wrong, but I remember that I forced restart my system, as it was not responding. It hung up in a command line terminal. I changed the terminal (ctrl+alt+[f1-f6]), and then unable to get back to the GUI (ctrl+alt+f7). The screen was showing some weird software error.
Code:
No init found. Try passing init= boot arg
BusyBox v1.10.2 (Ubuntu 1:1.10.2.2ubuntu7) built-in shell (ash)
(initramfs)

Sunday, June 19, 2011

Run vlc media player as root.

There's an issue in vlc player that it won't run when you are logged in as root. I don't know the reasons, may be its developers have some security concerns.
Anyways, you can make it run as root by following a simple series of steps, assuming that you have already installed it & it's running in case of other users.
Follow these steps:
  • Login as root.
  • Install ghex/khex (Hex editor for Gnome/KDE environment). 

Thursday, December 31, 2009

Configuring Broadcom (bcm43xx) Wireless Adaptor in Linux!

Configuring wireless adaptor in linux wasn't an easy job few years back, but now some of the linux distribution have started providing inbuilt drivers with OS like Kubuntu, Mint etc.
My laptop has broadcom wireless adaptor, which didn't responded to many of the linux distribution, until now when I came across Linux mint 7 (gloria). It detects my adaptor, by just choosing the STA proprietary wireless driver for it & works fine after that.
Recently, I have found some of the methods to configure the wireless adaptor in different linux distributions.

For OpenSUSE, a 1-click install YMP file (YaST Metapackage file) is available from Packman. To install this, go to http://packman.links2linux.org/ & search for broadcom-wl. Click on '1-click install' icon & follow the onscreen instructions.

To get it working on Mint 5, you can follow the instructions given at www.linuxmint.com/wiki/index.php/Broadcom_bcm43xx

.As for Fedora, its available in RPM fusion & for Mandriva, there is Mandriva non free repositories.

For CentOS, follow instructions(this methodology is obtained from http://kiranjith83.blogspot.com/):
Download wireless package from Broadcom
Untar the file hybrid-portsrc-x86_32_5_10_27_6.tar.gz (hybrid-portsrc-x86_64_5_10_27_6.tar.gz if you’re running on a 64-bit kernel) in its own folder:
>tar -xvzf hybrid-portsrc-x86_32_5_10_27_6.tar.gz
You should now see this in your directory listing:
hybrid-portsrc-x86_32_5_10_27_6.tar.gz
lib
Makefile
src

Add the following line to the file. Open file include/typedefs.h and add there the line below at header
#define TYPEDEF_BOOL

Without adding the header the compiling process exits with error
Now build the Loadable Kernel Module (LKM) like so:
>make -C /lib/modules/`uname -r`/build M=`pwd`

Of course, you need to make sure you have all the required kernel headers before building it. Once that’s done, your directory listing should look like this:
built-in.o
hybrid-portsrc-x86_32_5_10_27_6.tar.gz
lib
Makefile
modules.order
Module.symvers
src
wl.ko
wl.mod.c
wl.mod.o
wl.o

The magic file we need is wl.ko. Make sure you don’t have b43, b43legacy or b43xx loaded by running this:
>rmmod bcm43xx; rmmod b43; rmmod b43legacy

And for good measure remove ndiswrapper modules:
>rmmod ndiswrapper

Now load the module ieee80211_crypt_tkip:
>modprobe ieee80211_crypt_tkip

And finally load the wl.ko module:
>insmod wl.ko

Now if you do an ifconfig, you should see wlan0 right after your eth0 and lo devices.Test it out by scanning and connecting to a network. If it works, then you might want your module to load upon boot, which is something the Broadcom readme doesn’t touch on. Let me school you how.
Copy the wl.ko file to /lib/modules/2.6.26-1-686/kernel/net/wireless/
>cp wl.ko /lib/modules/2.6.26-1-686/kernel/net/wireless/

Create the module dependencies:
>depmod -a

Try loading your new module!:
>modprobe wl

If you get no error on modprobe, then it worked perfectly! Next you have to tell your system to load the module at startup. On my debian system, I do this by editing the file /etc/modprobe.conf to include the following:
>alias wlan0 wl

Now, reboot and you’ve got official Broadcom wifi. 
If you Need to setup linux as router do as follows?
Enable the ipforwarding and add the masqurade to eth0
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
***********************************************
Do reply & post me methods of doing it in other
linux OSs.

Monday, December 21, 2009

Ways of Disabling Linux-ROOT login!!



If you wish to disable root login due to some security reasons or you wanna troubleshoot root login problem, here are some methods>>>>>

1.---------->
> Open the file /etc/passwd
> Append the line root:x:0:0:root:/root:/bin/bash to root:x:0:0:root:/root:/sbin/nologin
Root login is disabled now.
[It's self explainatory] Undo it for enabling.

2.----------->
> Change the rwx rights of file /etc/securetty to any value, other than 600(ie. rw-------). This file is tty login file.
Eg. chmod 644 /etc/securetty
Undo it by, chmod 600 /etc/securetty

3.----------->
> Open the file /etc/securetty
> Comment out the terminal using #, in which u wanna deny access to root.
Take a look at my /etc/securetty file
__________________________________________________
#tty1
tty2
tty3
#tty4
tty5
tty6
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
__________________________________________________

There are 6 cli terminals, which r marked as tty1,tty2 ........
You can enter those by pressing combination of Alt+Ctrl+f1, ie. for terminal 1, for terminal 2 replace f1 by f2 & so on for other terminals.
Press Alt+Ctrl+f7, for coming back to the gui.
After you comment out the terminal, u can't login to that terminal, it will display :login incorrect
(Undo by removing the hashes from file)

4.----------->
> Create a file in /etc directory by the name "nologin".
In this method, all users get blocked.
Eg. Execute command --> 'touch nologin' or 'cat nologin'

5.----------->
> Type the command --> 'chage -E 0 root'
This command just expires the root password....
Just try to observe the difference in the 1st line of file /etc/shadow, before & after the execution of the given command.

root:$1$K2oyDN17$GqkZQHsHtnxpwrFCG7AI91:14203:0:99 999:7:::

root:$1$K2oyDN17$GqkZQHsHtnxpwrFCG7AI91:14203:0:99 999:7::0:

Ya, you are right, there is a extra zero at the end. That stands for the days left, for your password expiry.
Undo it by issuing the command --> 'chage -E NEVER root' or 'chage -E 99999 root'
Issuing the last command will replace the 1st line of /etc/shadow to....

root:$1$K2oyDN17$GqkZQHsHtnxpwrFCG7AI91:14203:0:99 999:7::99999:

You can also do this by directly appending the file.

6------------->
Ok first, as root, you need to install sudo. Next, also as root, you need to edit the file /etc/sodoers. Add the following line --

Code:
username ALL=(ALL) ALL
replace username with the user you want to be able to access root permissions.
now to disable the root account --
as root type the following at the command prompt

Code:
passwd -l root
the -l flag will lock the root account. No longer will root logins be possible on your box. It is simple to get them back, you just need to do the following --

Code:
sudo passwd root yourpasswordhere

-------------X------------

Ofcourse, there are some more ways for blocking root login. But I don't wanna risk my PC, trying those now.
These methods works fine in Redhat & Mandriva, so these should work on other Linux OSs.
For troubleshooting, these conditions should be checked for correct settings.
If you get trapped, using these methods, try login at runlevel 1 at grub-menu or use rescue CD, as I suggested in the thread
"Securing ROOT password!!"

*****************************Have A Nice Day !!************************

Securing ROOT password!!

In case, u forget ur root password or u wanna access the system with root privileges without knowing root password, u can easily change it by following these steps >>>

> Boot ur PC.

> Switch to linux OS listed in the Grub menu & press e( in Redhat), if it doesn't works then press f2 (in Mandriva), or try any other option which is listed in the boot screen untill u see the booting parameters for that OS, like...
kernel (hd0,9)/vmlinuz BOOT_IMAGE=linux root=UUID=f39877a0-9a19-11dd-8a61-97b60b6e4958 resume=/dev/sda7 splash=verbose vga=788
(ie. for Mandriva )

>Edit it, press space & 1 at the end of the line, so that it becomes....
kernel (hd0,9)/vmlinuz BOOT_IMAGE=linux root=UUID=f39877a0-9a19-11dd-8a61-97b60b6e4958 resume=/dev/sda7 splash=verbose vga=788 1
now press b for or simply enter key.

>Now the OS boots to runlevel 1 (that is single user mode, only root is logged on & is used for maintenence purposes), & sh prompt appears.

>Type the command passwd & then enter

>Type your new password 2 times, it goes like this..
INIT:entering single user mode
sh3.2-#passwd
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

>Type exit & enter.

Now ur root password is changed, so u can see, how easy it is for someone to break ur root password.

So we will now try to block the way through which someone can change the boot parameters
Here r the steps >>

>Open the terminal..
Type command, grub-md5-crypt & press enter, then enter your desired password for grub menu 2 times.. it goes like this...
[root@localhost ~]# grub-md5-crypt
Password:
Retype password:
$1$fEY8n$JcQYHPGCuYkxxKupgaB6c0

> Now u can see that, some junk characters appear on ur terminal. Next u have to edit menu.lst (or grub.conf in Redhat)
Copy the junk characters (which is md5 encryption of ur grub password).
Execute vi /boot/grub/menu.lst
Now observe the file menu.lst if u can see the line "hidden menu" {I'm assuming, u r familiar with vi editor basics}
If it is there, then type below it "password --md5 $1$fEY8n$JcQYHPGCuYkxxKupgaB6c0".
Else type above the line "default i" (i >=0, any integer value, depends on which OS u wanna boot by default, starting from zero)
hiddden menu
password --md5 $1$fEY8n$JcQYHPGCuYkxxKupgaB6c0
**If u wanna lock a particular OS, type "lock" below the OS specification. The OS will be locked & for booting it, u have to enter the grub-password.
Take a look at my menu.lst>>>>
__________________________________________________ __________________________________________________ ___________________________
timeout 10
color black/cyan yellow/cyan
gfxmenu (hd0,9)/gfxmenu
splashimage=(hd0,9)/boot/grub/hubble.xpm.gz
hiddden menu
password --md5 $1$MWiym$3QLabLcVRSyVUYIRa1aKy/
default 0

title MANDRIVA-Linux
kernel (hd0,9)/vmlinuz BOOT_IMAGE=linux root=UUID=f39877a0-9a19-11dd-8a61-97b60b6e4958 resume=/dev/sda7 splash=verbose vga=788
initrd (hd0,9)/initrd.img

title linux-nonfb
kernel (hd0,9)/vmlinuz BOOT_IMAGE=linux-nonfb root=UUID=f39877a0-9a19-11dd-8a61-97b60b6e4958 resume=/dev/sda7
initrd (hd0,9)/initrd.img

title failsafe
kernel (hd0,9)/vmlinuz BOOT_IMAGE=failsafe root=UUID=f39877a0-9a19-11dd-8a61-97b60b6e4958 failsafe
initrd (hd0,9)/initrd.img

title Windows-VISTA
root (hd0,0)
makeactive
chainloader +1
lock

title Windows Recovery
root (hd0,3)
makeactive
chainloader +1
lock
__________________________________________________ __________________________________________________ ___________________________

Save & exit from menu.lst.

Now boot your pc & try to edit the boot parameters as you did in first section, grub-menu displays --enter p to unlock next set of features.
Press p, it will prompt for grub-password, after entering grub-password, u can edit booting parameters & enter the locked OS.
************************MISSION-------ACCOMPLISHED************************

Hey, its not over yet.....................
Your root password is still not safe..................

Insert your bootable linux cd/dvd (or rescue cd)......
Process may be very different for different linux distribution, so I'm just explaining it in a simple way.
Mount ur / drive to /mnt.
Type passwd & change ur root password or Open etc/shadow & delete the Encrypted root password.
Eg. Change the line..........
root:$1$JK9GUDoD$9WXbaXbYRm61C7WdI12KI.:14202:0:99 999:7::: to root::14202:0:99999:7:::
The root password is cleared.
Also delete the line --> password --md5 $1$MWiym$3QLabLcVRSyVUYIRa1aKy/ from menu.lst file for clearing the grub-password.
And reboot.

So a person with some experience in linux (with a rescue cd) can takeover ur less configured system..
So the threat of physical access by a individual can't be ignored....
U can still block him, by enabling BIOS password......(there may be other ways too.)

Moral of the story ------------> A Social Engineering attack may be Lethal.

I think, its quite knowledgeable for Linux-newbies.

Plz post ur suggestion, comments,corrections & feedback............

Thanx for reading such a big thread!!