Force firmware update

I did a firmware update on my raspberry pi only for it to fail half way through (mistakingly did it over wireless) however it still showed as latest version
uname -a
Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux[/code]

but functionality that was supposed to be added in this update still didn’t work, so I managed to do a forced update using

sudo mv /boot/.firmware_revision ~
sudo rpi-update

and this time everything went as expected

*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100   135  100   135    0     0    187      0 –:–:– –:–:– –:–:–   243
100  7026  100  7026    0     0   7273      0 –:–:– –:–:– –:–:–  7273
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** We’re running for the first time
*** Backing up files (this will take a few minutes)
*** Backing up firmware
*** Backing up modules 3.10.25+
*** Downloading specific firmware revision (this will take a few minutes)
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100   168  100   168    0     0    164      0  0:00:01  0:00:01 –:–:–   233
100 21.1M  100 21.1M    0     0   615k      0  0:00:35  0:00:35 –:–:–  705k
*** Updating firmware
*** Updating kernel modules
*** depmod 3.12.20+
*** Updating VideoCore libraries
*** Using HardFP libraries
*** Updating SDK
*** Running ldconfig
*** Storing current firmware revision
*** Deleting downloaded files
*** Syncing changes to disk
*** If no errors appeared, your firmware was successfully updated to 48c18db1502612455f7f69d72a73c91882950686
*** A reboot is needed to activate the new firmware

Continue Reading

Resetting user and root password on raspberry pi

I hadn't used my pi for a while and when I did I found that I had changed the pi user password from the predfined 'raspberry' one. I did a bit of searching and found a method that work so thought i'd share.

Remove the SD card from your pi and insert into a card read attached to a windows machine.
After being detected a new drive should show up under My Computer called 'boot'
Open this drive and open the file cmdline.txt
This is a single line file and should look somethinig like this

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 rootwait

Now what you need to do is add init=/bin/sh to the end of it so it looks like this

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 rootwait init=/bin/sh

Save and close and reinsert the card into your pi. Now you'll need a KVM attached to your pi for the next bit, power up the pi and you'll notice early on in the boot process it stops and returns a bash prompt character #

From here enter the following
 

mount -o remount,rw /
passwd pi
(enter a new password)
sync
exec /sbin/init

You can also change the root user password at the same time if you have enabled that user, just use passwd root

After executing the final command your pi will boot normally and you will be able to login using the credentials you set. The final stage is to open /boot/cmdline.txt file and remove init=/bin/sh form the end, on your next reboot the pi will go through the boot process normally.

Continue Reading

Add Wireless To The Raspberry Pi

I had bit of a nightmare getting wireless to work properly so I put together this howto hoping it will help others. This was done on a raspberry pi running raspbian (wheezy).

sudo apt-get install wireless-tools wpasupplicant

get your psk using the following command where yourssid is your SSID’s name ie HOME and where passphrase is your wireless password ie PASSWORD123 wpa_passphrase yourssid yourpassphrase

Using my examples above this should output the following

network={
ssid="HOME"
#psk="PASSWORD123"
psk=57d9fbb3d0e8eed3bd17d76a61805e2c4b73a81d1686debeaf44559d8bc15800 }

From this copy the psk string then

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

and insert it onto the psk line and edit the SSID name, save and exit.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid=”HOME”
scan_ssid=1
psk=57d9fbb3d0e8eed3bd17d76a61805e2c4b73a81d1686debeaf44559d8bc15800
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
sudo nano /etc/network/interfaces and add the following (obviously adjust it to your network setup ie static etc), save and exit
auto lo
iface lo inet loopback
iface eth0 inet dhcpallow-hotplug wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
Now I had a problem whereby wirless was only bougth up when the wired conneciton was plugged, obviously this defeats the whole object of wireless so I managed to come up with this fix
sudo nano /etc/default/ifplugd and add the following
# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION. When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES=""
HOTPLUG_INTERFACES="wlan0 eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

Save and exit then reboot and hopefully your wireless interface will be bought up and connect successfully.

Continue Reading