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

TP-Link WDR3600 N600 Serial

When adding a serial header to the board of a WDR3600 and using the same RS232 TTL converter as with the WDR4300 I found the output was all garbage. I re-soldered the connectors several times but the output remained unchanged.

 
After some investigation I found that a TTL UART converter is required so I ordered one from ebay titled
 
USB 2.0 to TTL UART 6PIN CP2102 Module Serial Connector Converter Adaptor Cable

 
 
which arrived today, inserting into my Windows 7 laptop the appropriate device driver could not be found for it, after some further investigation I found the correct one for it which i've made available from here
 
 
Other windows versions and os's are also available to download from
 
The converter which worked with the WDR4300 but not the WDR3600 is titled
 
MAX232 RS232 Serial To TTL Output Converter Board RXD TXD RTS CTS F PIC Atmel

 
 
and the output from it was 
 
[code]n³ÔIXðzåyÿþñ0~`ÿ!¡ =äþ@}ü?Kxððý°
                                0vÂüüþòýÈPøðÀ íxøTÄ
                                                   0@Løð>ý°08 èTöuÀà@Ààäì°o °ý$ôÀèÐÏ
ÀÄ ÉðþõäÄ°àø8ô9ø:pHHTÀ?hÐãÀ8dú8:(þ 9ãÀxd8`ÜÐÃøÀðøÀÀÐ@(ÊïzÀn¨Â#îÉÂà~r `À)1ð@ÌäÀ0'ð<8Àa0à`9þø
 
8P~`dç80þA Àûøüð ¼ãàd8x980@óø
À[/code]
 
Using the TTL UART converter output was as expected
 
[code]U-Boot 1.1.4 (Sep  9 2013 – 14:28:41)
 
U-boot DB120
 
DRAM:  128 MB
id read 0x100000ff
flash size 8MB, sector count = 128
Flash:  8 MB
Using default environment
 
PCIe Reset OK!!!!!!
In:    serial
Out:   serial
Err:   serial
Net:   ag934x_enet_initialize…
No valid address in Flash. Using fixed address
 wasp  reset mask:c03300
WASP  —-> S17 PHY *
: cfg1 0x7 cfg2 0x7114
eth0: ba:be:fa:ce:08:41
athrs17_reg_init: complete
eth0 up
eth0
Autobooting in 1 seconds
## Booting image at 9f020000 …
   Uncompressing Kernel Image … OK
 
Starting kernel …
 
Booting Atheros AR934x
[    0.000000] Linux version 2.6.31–LSDK-9.2.0_U6.616 (tplink@localhost.localdomain) (gcc version 4.3.3 (GCC) ) #1 Mon Sep 9 14:32:03 CST 2013
[    0.000000] Ram size passed from bootloader =128M
[    0.000000] flash_size passed from bootloader = 8
[    0.000000] CPU revision is: 0001974c (MIPS 74Kc)
[    0.000000] ath_sys_frequency: cpu srif ddr srif cpu 560 ddr 450 ahb 225
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00008000
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[1] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00008000
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ath-nor0:128k(u-boot),1024k(kernel),6912k(rootfs),64k(config),64k(ART) mem=128M[/code]
Continue Reading

Samba hide dot files

Setting up a Samba server at work using local users I found that when logging via windows the following files were displayed in the shared folder

.bash_history
.bash_logout
.bashrc
.profile
 Now there there is a possibility that these files can be deleted via the share which would impact the local ssh user. After searching I found that there is a variable that can be set in smb.conf by putting
hide dot files = yes
 in the [homes] section, however as I found out if you have windows set to ‘view hidden files’ this takes priority and the files are still shown.
 After much more searching I found the veto function, so adding
veto files = /.*/
to [homes] section results in the . (dot) files not being displayed. So my smb.conf [homes] looks like this
[homes]
comment = Home
Directories browseable = no
writable = yes
create mask = 0700
directory mask = 0700
valid users = %S
veto files = /.*/
Don’t forget to restart Samba after making the change.
Continue Reading

bash: /bin/rm: Argument list too long

I came across this error when trying to delete lots of files on Debian Squeeze. This error apparently occurs due to the reason that the system commands show limitations when a large number of arguments are fed into a single command.
 
so I created a bash script called bulkrm containing
 
for i in *; do
rm -f $i;
done
chmod +x bulkrm
../bulkrm
 
(WARNING THIS WILL DELETE ALL FILES IN THE FOLDER IT'S EXECUTED FROM SO USE
AT YOUR PERIL)
 
Continue Reading

NAS down! NAS down!

My home nas has decided to die for the second time, good job I keep a cold spare. I've swapped the drives over and the raid is currently rebuilding. I am now on my third shuttle so thinking I will replace it with a HP N54L Microserver and be done with it, just need to wait for one of their cashback offers to crop up then I'll buy one.
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