Authentication token manipulation error

One of my friend forgot his ubuntu password and i tried to fix it by going to recovery mode dropping into root shell and resetting the password for the user

root@username-PC:~# passwd username
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged

But this time it didn’t work as usual. It showed an error “Authentication token manipulation error”.
I tried googling an found that the file system is not mounted with read/write permission.
From root shell remount file system with read/write permission.

mount -rw -o remount /

Then try changing the password using

passwd username

Some times it may may throw the same error again, then delete the password for the user from /etc/shadow file using the fllowing command

sudo passwd -d username

Replace username with your’s. Then again change the password using

passwd username

Happy Hacking 🙂

Advertisements

How to fix a “Problem with MergeList” or “status file could not be parsed” error

I recently got this error, usually may happen after a Heroku toolbelt setup

E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.

you wont be able to update through terminal too

Screenshot from 2016-04-30 14:56:09

Open Terminal and issue this command

sudo rm -vf /var/lib/apt/lists/*

Generate a new list by doing a update

sudo apt-get update

Happy Hacking 🙂

Installing Flask and hosting a simple Flask app in Heroku PART 1

Install pip or easy_install to install python packages on ubuntu
FOR PIP

sudo apt-get install python-pip

or
FOR easy_install

sudo apt-get install python-setuptools

Install virtualenv
——————

sudo easy_install virtualenv
pip install virtualenv

After installing virtaulenv isuue this command

virtualenv flask

you will get a folder named flask change directory to this folder

cd flask

It contains a complete Python environment ready to be used for this project
Virtual environments can be activated and deactivated, if desired. An activated environment adds the location of its bin folder to the system path, so that for example, when you type python you get the environment’s version and not the system’s one.

Now install flask

flask/bin/pip install flask

Create a Heroku account and Install the Heroku tool belt

https://devcenter.heroku.com/articles/getting-started-with-python#introduction

touch run.py

and inserting the basic “Hello World” code

import os
from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello():
    return 'Hello World!'

Test your Flask install by running this webserver:

python run.py

You should see this in your terminal:
* Running on http://0.0.0.0:5000/

Screenshot from 2015-08-07 20:47:11

Now, navigate to localhost:5000 in your browser and make sure you can see “hello world” printed out in the browser window.

Ubuntu 14.04 installer doesn’t show existing partitions

I encountered a strange problem while trying to install Ubuntu 14.04 on a box where a fresh Windows 7 is installed.It’s 1 TB hard disk partitioned into 6 drives. The Ubuntu installer doesn’t show any partition it just showed the whole 1TB as blank one partition. The installer also didn’t detect the Windows 7 installed on the system usually the installer used to detect windows and suggests to install alongside with windows.

Screenshot from 2016-01-13 16_26_02

 

Screenshot from 2016-01-13 16_26_30

 

Screenshot from 2016-01-13 16_26_40

So i quit form the installer and continued on the live session.After some googling i found this solution

The system may report that the disk contains a GUID Partition Table (GPT), which is left behind on a disk that was once used as a GPT disk but then incompletely converted to the more common Master Boot Record (MBR) form. In such situation, the system cannot recognize the partition of Windows. All that the system can see is the whole volumn. If you want to dual boot you can acheive that by removing the GPT data.

Use FixParts to remove GPT data

FixParts is intended to fix is a disk that shows no partitions in GParted or similar tools, although you know the disk to contain partitions because they’re visible to the Linux kernel or to other partitioning software.

Open up a terminal in live session.

Install Fixparts

sudo apt-get install gdisk

Backup
First backup your current partition table

sudo sfdisk -d /dev/sda > partition.txt

Where dev/sda is the partition you want to modified (backup). Next time when you want to restore the partition table, you will be able to recover your partition table by reversing the program.

sudo sfdisk -f /dev/sda < partition.txt

To see the drive’s

Screenshot from 2016-01-13 16_30_59

Delete the GPT data

sudo fixparts /dev/sda

The first check that the program preforms is for stray GPT data. If it finds lefeover GPT data, it warns you of this fact and ask you what to do:

NOTICE: GPT signatures detected on the disk, but no 0xEE protective 
partition! The GPT signatures are probably left over from a previous 
partition table.Do you want to delete them (if you answer 'Y', this 
will happen immediately)? (Y/N):

Now you can delete the GPT data by simply type Y.

That’s done. Back to your installation and see if the system can find the previously installed Windows partitions.

Screenshot from 2016-01-13 16_32_56

Screenshot from 2016-01-13 16_34_02

Screenshot from 2016-01-13 16_35_39

Screenshot from 2016-01-13 16_35_53

Now we can see windows 7 partitions on Ubuntu.

Happy Hacking 🙂

Obtain Time From GSM netwok using SIM900

Instead of using a Realtime Clock if the Project is already using a SIM 900 module then you can obtain correct Date and Time from the NTP Server GSM Network using the following commands.

AT

OK If your response contains this, This string should tell you all is well

AT+CMGF=1

OK If your response contains this, This string should tell you all is well(Set SMS Text Mode )

AT+CENG=3

OK If your response contains this, This string should tell you all is well(command is used to turn on the engineering mode to get detailed network information)

AT+CCLK?

+CCLK: “16/01/12,07:33:42+00”
If the response is OK then you will get date and time in above format.
Date – YY/MM/DD format

 

SIM 900 Network Time

2015 in review

The WordPress.com stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 50,000 times in 2015. If it were a concert at Sydney Opera House, it would take about 19 sold-out performances for that many people to see it.

Click here to see the complete report.

GPRS using SIM900 and AT Commands

sim900-gprs-gsm-module-arduino-compatible

Powerup the Sim900 module
connect it to the system through serial to USB or through FTDI cable.The TTl pins for FTDI is available near to the DB9 connector.

Open any serial Terminal porogram. In Linux i use GtkTerm. Select the correct port and set
Baudrate = 9600
parity = None
Bits = 8
Stop bits = 1
Flow Control = None

Screenshot from 2015-11-26 12:49:46

 

Screenshot from 2015-11-25 20:00:44

 

The AT Commands

I am posting the commands and its reply for better understanding. I am using an Airtel postpaid sim card.
Make sure you have enough balance on Sim card.

First Command

AT

OK If your response contains this, This string should tell you all is well

This is to check if SIM is unlocked.

AT+CPIN?

+CPIN: READY If your response contains this, then it means SIM is unlocked and ready

This checks if SIM is registered or not

AT+CREG?

+CREG: 0,1 This string in the response indicates SIM is registered

Check if GPRS is attached or not

AT+CGATT?

+CGATT: 1 A response containing this string indicates GPRS is attached

Reset the IP session if any

AT+CIPSHUT

SHUT OK This string in the response represents all IP sessions shutdown.

Check if the IP stack is initialized

AT+CIPSTATUS

STATE: IP INITIAL This string in the response indicates IP stack is initialized

single connection mode,if AT+CIPMUX=1 multi connection mode

AT+CIPMUX=0

OK This string indicates single connection mode set successfully at SIM 900

This sets the PDP context parameters such as PDP type (IP, IPV6, PPP, X.25 etc), APN, data compression, header compression etc.

AT+CGDCONT=1,"IP","airtelgprs.com"

OK If your response contains this, This string should tell you all is well

you need to know the APN, username and password for your service provider
AT+CSTT= “APN”, “UNAME”, “PWD”
For Airtel

AT+CSTT="airtelgprs.com"

OK If your response contains this, This string should tell you all is well

Bring up the wireless. The response to this might take some time

AT+CIICR

OK indicates wireless is up

Get the local IP address

AT+CIFSR

aa.bb.xx.yy If previous command is successful, you should an IP address in the response

comamnd returns the current connection status

AT+CIPSTATUS

STATE:IP STATUS if not this, some thing is wrong

Start the connection, TCP, domain name, port

AT+CIPSTART= "TCP","flaskprint.herokuapp.com","80"

CONNECT OK This string in the response indicates TCP connection established

Request initiation of data sending

AT+CIPSEND

The response should be the string “>” to indicate, type your data to send
Type anything after the prompt
>This is the Test Data
Now use Ctrl+Z key combination to indicate end of data sending

You should get some response back from the server. Normally some error message. But you have established the connection

To close the connection

AT+CIPSHUT

SHUT OK Indicates shutdown successful

Screenshot from 2015-11-25 20:12:47Screenshot from 2015-11-25 21:53:44Screenshot from 2015-11-25 20:51:29

 

For the ease of Copy Pasting retyping AT commands in sequence

AT
AT+CPIN?
AT+CREG? 
AT+CGATT?
AT+CIPSHUT
AT+CIPSTATUS
AT+CIPMUX=0 
AT+CGDCONT=1,"IP","airtelgprs.com"
AT+CSTT="airtelgprs.com"
AT+CIICR
AT+CIFSR
AT+CIPSTATUS
AT+CIPSTART= "TCP","flaskprint.herokuapp.com","80"
AT+CIPSEND

Happy Hacking 🙂