Mounting a Raspberry Pi image in Linux

This is quite a useful tip: if you have used Win32DiskImager or similar to clone a Raspberry Pi SD card and you want to mount the resulting .img file in Linux, you need to use the ‘offset’ argument to cater for the .img file including multiple partitions.

Details are here, but the summary would be:
parted [image].img

Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit                                                             
Unit?  [compact]? B                                                       
(parted) print

The output should look something like:

Code:
Model: ATA ST3160815AS (scsi)
Disk /dev/sda: 160041885696B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start          End            Size           Type     File system     Flags
 1      32256B         10733990399B   10733958144B   primary  ext4
 2      10733990400B   21500881919B   10766891520B   primary  ext3
 3      21500881920B   158961761279B  137460879360B  primary  ext4
 4      158961761280B  160039272959B  1077511680B    primary  linux-swap(v1)

type q to exit from parted.

Now to mount a partition, you have to run something like:

Code:
sudo mount -o loop,offset=32256 picked.img mount/point

 

Advertisements

Ping not resolving on Linux?

Weird one, but sometimes some of my virtual machines can’t resolve external web addresses. Ping 8.8.8.8 fine, but ping http://www.google.com and you get an ‘unknown host’ error.

Seems to be a problem with resolv.conf – always check /etc/resolv.conf and see if it is pointing to 127.0.0.1 as the DNS.

LDAP issue with sendmail

For some reason, I suddenly stopped receiving email notifications of my voicemail from my trixbox server. A bit of hunting around, I discovered the following error in the logs, or when I tried to manually send mail using sendmail:

451 4.3.5 Error getting LDAP results in map ldapsx: Unknown error 325
sxadmin-scalix@scalix... Deferred: 451 4.3.5 Error getting LDAP results in map ldapsx: Unknown error 325

All of this occurred after I changed my DNS suffix on my new router. To fix the problem, I updated the OMHOSTNAME setting in /etc/opt/scalix/instance.cfg to what the fully-qualified name was et voila! All working when I use the following test code:

echo "Subject: test" | /usr/lib/sendmail -v my@email.com

Building a VPN

So, being the holidays and everything, I thought it would be useful to be able to dial-in to my home network and get access to all my local network resources. I first tried to do this when I was in San Francisco over Putty SSH. Can I just note for everyone reading this that this is not a good idea because if anything goes wrong (like when trying to create a new bridged interface), your network connection goes down…and so does your SSH connection!

But I’ve had a bit of better luck following the howto on OpenVPN.net and have got it so that I currently have a routing connection (not bridged) up and running. So an internal IP address now accesses my server, and I’m able to access the Samba shares, and the VOIP network as well! 🙂

Now, I’m just going to work on bridging the network…when I get home! 😉