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

Friday, August 27, 2010

Forget root password of a Debian Machine & resetting it

I am writing this small post just because

  • i forgot the root password of my debian machine
  • didn’t find a through post that list all steps in one place and had to look at several ones at a time

The steps are as follows

I am quoting these lines from that post

Some Linux distribution, such as Ubuntu for instance, offer a specific boot menu entry where it is stated "Recovery Mode" or "Single-User Mode". If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.

Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:

  • use the arrows to select the boot entry you want to modify.
  • press e to edit the entry
  • use the arrows to go to kernel line
  • press e to edit this entry
  • at the end of the line add the word single
  • press ESC to go back to the parent menu
  • press b to boot this kernel

The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).

Here we are, we have gained root access to the filesystem, let's finally change the password.

According to the above words, we should be ok and we have access to the file system. At this state you run the command “passwd” and enter the new password.

If it worked with you then Thanks to the editor. If you got some problems like me, then keep reading.

Problem 1

After editing grub line and add the “single” keyword at the end of that line. I got it loading well until i was prompted for the root password for maintenance and give the ability to skip but by then i will be leaving runlevel 1 and entering runlevel 2 getting login/password prompt i am trying to skip.

To solve this problem do the following:

  • Edit the grub line again and leave the keyword “single” there as before but add at the end as well these words “init=/bin/bash”
  • exit edit mode
  • press the button “b” while you have this modified grub line highlighted to start booting with this modified grub line

Voila, you have now access to shell as a root. run the command “passwd” and you should be fine entering the new desired password. If you got a problem, then continue reading.

Problem 2

Whenever i run the command “passwd” and re-enter the new password i get this error at the end

authentication token lock busy

If so, know that the problem is that you are accessing the system in read-only mode. In order to access it in read-write mode, do the following.

From the shell run this command

mount -o remount,rw /

after that run “passwd” command and this time you should have the ability to enter the new password

and live happily ever after

Monday, June 15, 2009

Install Mechanize On Debian

Installing mechanize gem on Debian should be as easy as running this command

gem install mechanize

but this won’t succeed unless you install these packages on your Debian machine

apt-get install libxml-dev libxslt1-dev

Once installed, gem will be installed seamlessly

Update:

if the above apt-get command didn't work with you and you got an error that package doesn't exist

try this new line

apt-get install libxml2-dev libxslt1-dev

as some packages names has changed

[Linux] Mounting windows folders

Due to my new configuration which is using Windows as my default OS and Debian shell through Virtualbox, my need to have a folder shared between these two environment become a must in order to ease file sharing and exchange.

At first, i depended on “shared folders” feature of VirtualBox which after a while failed as i always get a “Protocol Error” whenever i deal with files IO on that shared folder.

That’s why i looked for another solution that is more stable than that one and reached to using “CIFS” as a way to mount windows shared folder on my Debian machine.

The steps are very easy to be made and gives you a stable robust solution away from VirtualBox problems. i can summarize these steps as follows

  1. install on your Debian machine “smbfs” package which will add this new type of mounting called “CIFS”
  2. suppose your machine IP is “192.168.1.6” and you shared a folder on it called “work” and this folder is secured to be used only with certain group which is administrators and one of these administrators is named “BioNuc” and have a certain password then your command will be                                                                                         mount -t cifs -o username=BioNuc ‘\\192.168.1.6\work’ <linux-path-to-mount-on-it>
  3. After writing this line, you will be asked to insert your password in order to make mount process successful

That’s it, Enjoy sharing folders seamlessly

Monday, April 13, 2009

Giants Alliance

Two giants are there one called Windows and another called Linux. As i am fan of Windows Interfaces and Usability (by the way i use Windows XP) and also fan of the extreme shell power of Linux, I wished if i can exploit these two powers at the same time.

The solution i found was using Windows XP as my primary OS and adding Debian version on virtual machine. You may be asking why should this solution be said when it is well known and made by some many users but actually, i made some modifications to this solution.

What i did can be summarized in these following points:

  • installing debian without any interface at all, just a shell no more
  • using virtual machine shared folder technique to share a folder between my XP machine and my Linux machine
  • installed ZOC program which is a powerful shell program that allows connecting using openssh and supports multi tabs which is very important feature not available in putty
  • installed openssh-server on debian
  • fixed an IP for my debian machine so as to save my openssh configuration one time only without changing it each time i connect to it

This way, i enjoy my XP machine and whenever i need the shell of linux. i connect using openssh on my debian virtualized machine and do what i want

I use this solution while developing ROR applications, i prepared the environment i use as follows

  • installed ruby, rails, mysql on my debian machine
  • opened remote connections to mysql database so as to use MySQL Query Browser from XP machine

Now, i open my IDE on XP machine that changes in folders place in the shared folder between two machines and i open my server from virtual machine and test apps on debian machine IP rather than my localhost

This experience is great and i enjoy it so much as i feel i have the power of each environment Windows & Linux at the same time

In order to optimize the performance of my Virtual Machine somehow, i raised the priority of these virtualized processes to ‘High’ or even ‘Realtime’. it is now better but not perfect

I think in order to raise the performance significantly, i need to buy another motherboard supporting Intel VT technology. Using such technology i can move virtualization from software layer (being a process that Windows XP Scheduler deal with) to hardware layer which should improve performance as stated

That’s it, i suggest you try this experience and Enjoy as i do

Monday, February 2, 2009

[>30] Mounting my N80 mobile on Ubuntu Machine

This shall be the first episode in my long series called ">30" which simply means that it took more than 30 minutes. I am collecting here some of the problems that i fought with for more than 30 minutes in order not even solve it but finding a resource on the internet that can relief me from such a pain.

The first episode of this series is talking about how to mount your Bluetooth device on your Ubuntu machine. I will explain such a thing on my N80 mobile and Ubuntu machine but i think anyone can use such points on any other devices and Linux machines.

Before getting into the main point, i would like to state that this post might get you the solution or not. I am writing it while doing such a task and while i am writing such introduction, i actually reach to the steps needed to get out of such misery journey. But, anyone whether we reach a solution together or not, i think this post will put you on a track to continue from so you won't lose your time reading it.

Note: points highlighted in bold style are points related to my case so it should change from one case to another.

The journey starts in this post Mounting a Nokia Phone a Little Bit Easier which is really a nice point to start with. It states these points
  • Find out your phone’s Bluetooth MAC address if you don’t know it already:
    hcitool scan
  • Find out the OBEX FTP channel it uses
    sdptool search FTP
  • Load the fuse kernel module:
    sudo modprobe fuse
  • Make a suitable mount point for your phone:
    mkdir /media/n80
  • Mount
    obexfs -bXX:XX:XX:XX:XX:XX -BYY /media/n80
    (where XX:XX:XX:XX:XX:XX is your phone’s MAC and YY is the OBEX channel)
  • Unmount when you’re done with your file transfers:
    fusermount -u ~/Phone
the above steps depends on having some libraries installed on your pc which are obexfs and obexfs. i got them easily using apt-get. If after doing the above steps everything went well then you are done. Yes that easy but if not then continue with me to know what i did after this step.

For me, i was capable of entering the mounted folder and even list files and not only this i removed a file. i thought it is time now to copy some files from my pc to the device. after using the cp command, i took no time at all and then it finished. I was sure something went wrong because i am connecting using bluetooth and things shouldn't end that fast. I used ls command to check that it was added but then it hanged for some time and stated that the folder i am inside isn't a valid one. Simple, mounting failed. I went out and entered again and ran ls command but nothing was listed. I unmounted and remounted but it sometimes shows everything or simply nothing

In some cases, i run "hcitool scan" again and can't find my device even. I disable my bluetooth on the device and enable it to start working again.

Anyway, it was time to search for a solution for such a problem. I found this can't add files to mounted volume, no free space sony Z610i ticket. I digged inside it and read for a while and knew that they have the problem of copying files since the mounted point is stating no free space on the mounted device. They stated this is a bug and pointed to its ticket here. It stated that current version of obexfs don't manage S60 3rd edition mobiles probably and found the ticked closed invalid. Looking at comments i found someone stating that this should be fixed if i used  "ObexFTP 0.22 / ObexFS 0.11" instead of the installed ones. These should be compiled as those got by apt-get are one step behind. Ok, no problem let's compile.

prepare an empty folder then wget these files one by one
  • http://downloads.sourceforge.net/openobex/obexfs-0.11.tar.gz?modtime=1213568386&big_mirror=0
  • http://downloads.sourceforge.net/openobex/obexftp-0.22.tar.bz2?modtime=1213568417&big_mirror=0
  • http://downloads.sourceforge.net/openobex/openobex-1.3.tar.gz?modtime=1150294112&big_mirror=0
tar these files using tar -xzf for .gz files and -xjf for .bz2 files. Now lets install them in this order openobex then obexftp and obexfs. This order is important because each one depends on the previous one. But, before doing so, these are some libraries i needed while compiling so make sure you have them installed
  • python-dev
  • libfuse-dev
  • libusb-dev
  • tcl8.4-dev
  • tcl-dev
now in each folder. run "./configure" then "make" then make "install" and you should be ready to redo the steps stated above which i wrote them at the beginning of my journey.

I did so but i am sorry to say that all this was useless for me. If everything went ok with you at this step then you are ready to have fun. If not then continue with me, i still have some points to state.

I reached this link now http://www.thinkwiki.org/wiki/How_to_setup_Bluetooth, i noticed that there is a section for symbian mobiles that is different from other mobiles. seems that i have to continue searching but i think enough for me this night. maybe tomorrow. If you still have problems till tomorrow then wait for my next post that i wish will settle things and put an end to this misery
Blogged with the Flock Browser

Monday, December 15, 2008

Try Wine

Wine is a very nice thing, it is a program you can use in order to run applications dedicated for certain platforms on any other one

for example i use it to run some windows application i get to use them on my linux machine, although Wine isn't fully mature yet but a large number of applications run nice on it

Monday, September 8, 2008

Ruby Make Problem

Still in my early days using Linux and trying to compile ruby 1.9 on my machine in order to move my working environment to Linux

I downloaded ruby 1.9 source from ftp.ruby-lang.org and as stated in readMe file, i ran

./configure --prefix={{any-desired-path}}

successfully then ran

make

it took some time then i was faced with that error

executable host ruby is required. use --with-baseruby option.

What is that error? and what ruby?? i am compiling ruby how come i need it.


Anyway, i began searching for an explanation. i reached to a comment in one of the forums stating that this error can occur in these two cases

1. ruby isn't in the default path
2. ruby isn't installed

More investigation showed that i should have any previous version of ruby installed in order to use it with that make file as follows

./configure --prefix={{any-desired-path}} --with_baseruby={{full-path-to-ruby-executable}}

then run make command once again. And it worked finally

What a nice recursive world, "ruby is needed to compile ruby"

Thursday, September 4, 2008

configure: error: C compiler cannot create executables

In my first start to use ubuntu, i wanted to compile ruby on my machine

i downloaded ruby source and executed configure file to generate make file

./configure

i got this error

C compiler cannot create executables

although i have gcc latest version installed



after investigating this error i found that the solution was

sudo apt-get install build-essential


after doing so, everything worked fine