Saturday, March 21, 2015

Multipage pdf from GIMP

A Multipage PDF from GIMP.


  1. Paste each page in as a layer
  2. Arrange the page/layers in reverse order (first page as bottom layer)
  3. Export as .mng
  4. On command line, 'convert file.mng file.pdf'


You need ImageMagick installed of course.

From this forum (MUCH easier way).

Saturday, March 14, 2015

Raspberry Pi SD card dd Benchmarks

I put a new SD card in my Pi today. I had the old one set up with Noobs and decided to ditch it for a straight Arch set up since that is all that I run on it anyway. I simply setup the new SD card with Arch from these instructions:

Arch Pi Download (click Installation tab)

I created a new partition for root and dd'ed the image from my Noobs install to it. Checked my config.txt and cmdline.txt and made sure my fstab was correct. (The parition numbers change for root in cmdline.txt and boot in fstab). It booted just fine.

My new card is a SanDisk Extreme 32GB UHS-I/U3 SDHC Memory Card Up To 60MB/s Read - SDSDXN-032G-G46 [Newest Version] from Amazon. The old card was a Transcend 16GB Class 10 SDHC Flash Memory Card (TS16GSDHC10E). The new card is bigger, which I like. I also like that I ditched Noobs and still have an SD card with Noobs ready if I get a new Pi. I wasn't thrilled that the write speeds are almost identical but I think that probably has more to do with the limitations of the Pi than the cards. Maybe I will do a write test from my laptop at some point to see.

Here are the results:

OC settings:


arm: frequency(45)=1000104000
core: frequency(1)=499999000
h264: frequency(28)=250000000
isp: frequency(42)=250000000
v3d: frequency(43)=250000000
uart: frequency(22)=3000000
pwm: frequency(25)=0
emmc: frequency(47)=250000000
pixel: frequency(29)=25200000
vec: frequency(10)=0
hdmi: frequency(9)=163683000
dpi: frequency(4)=0


Dirty I/O benchmark (memory and processor):



dd if=/dev/zero bs=1M count=1024 | md5sum
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 23.9798 s, 44.8 MB/s

SanDisk Extreme 32 Gb:


 hdparm -Tt /dev/mmcblk0

/dev/mmcblk0:
 Timing cached reads:   590 MB in  2.00 seconds = 294.60 MB/sec
 Timing buffered disk reads:  56 MB in  3.05 seconds =  18.36 MB/sec
[root@alarmpi ~]# hdparm -Tt /dev/mmcblk0p2

/dev/mmcblk0p2:
 Timing cached reads:   570 MB in  2.01 seconds = 284.25 MB/sec
 Timing buffered disk reads:  56 MB in  3.07 seconds =  18.24 MB/sec

dd bs=1M count=256 if=/dev/zero of=test conv=fdatasync
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 15.1568 s, 17.7 MB/s

Burn in sequence of direct reads is constant after 7 cycles:

dd if=/dev/mmcblk0 of=/dev/null bs=4M
7609+1 records in
7609+1 records out
31914983424 bytes (32 GB) copied, 2055.73 s, 15.5 MB/s

Transcend Class 10 16Gb:

hdparm -Tt /dev/mmcblk0

/dev/mmcblk0:
 Timing cached reads:   312 MB in  2.01 seconds = 155.25 MB/sec
 Timing buffered disk reads:  54 MB in  3.08 seconds =  17.53 MB/sec
[root@alarmpi ~]# hdparm -Tt /dev/mmcblk0p7

/dev/mmcblk0p7:
 Timing cached reads:   320 MB in  2.01 seconds = 158.98 MB/sec
 Timing buffered disk reads:  52 MB in  3.00 seconds =  17.30 MB/sec

dd bs=1M count=256 if=/dev/zero of=test conv=fdatasync
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 15.1096 s, 17.8 MB/s


If you have a Pi, post your SD card benchmarks here for comparison if you would like. Include the type of SD card, any overclock settings from your Pi and the type of SD card you are using.

Saturday, August 16, 2014

Setup Avahi to Use mDNS with a Raspberry Pi Running Arch Linux

Avahi is a simple open source Zero Configuration networking solution for Linux. It is tantamount to Bonjour for the OSX platform. The setup is pretty simple and straight forward. Since we have connected our Pi's to our laptops with a static IP it is really not necessary to use Avahi for name resolution because we could just add a line to our /etc/hosts file. However, if we have printers and other network clients that we would like to make available to our Pi and Laptop Avahi is a good choice to use to access these other DHCP clients on our network and the setup is simple enough.

Step 1:

Make sure you have a hostname set in the /etc/hostname on your Pi:

nano /etc/hostname
# /etc/hostname 
my-pi 

Make sure a hostname is set on your laptop also. If using systemd:

nano /etc/hostname 
# /etc/hostname 
my-laptop 

or if your laptop uses systemv: 

nano /etc/conf.d/hostname 
# Set to the hostname of this machine 
hostname="my-laptop" 

Step 2:


Install Avahi on your Pi:

pacman -Sy avahi nss-mdns 

Install on your laptop per your distro's package manager.

On both the Pi and the laptop, setup mDNS in your nsswitch.conf file. This will tell your OS to do a lookup with Avahi along with other name resolution methods:

nano /etc/nsswitch.conf 

find the hosts line and edit it as such:

hosts: files myhostname mdns4_minimal [NOTFOUND=return] dns mdns4 

Step 3:

Start the daemon on your Pi:

systemctl enable avahi-daemon
systemctl start avahi-daemon.service 

Start the daemon on your laptop the same way if you use systemd.
If you use rc-update do:

rc-update add avahi-daemon default

and start the daemon:

/etc/init.d/avahi-daemon start 

Step 4:

See if it all works as expected.
Try:

avahi-browse --all 

on each box to see what is shown on your network. You will need Zero Config software on every client in your network you would like to interact by name.local.
Now try to ping from your laptop:

ping my-pi.local

and from the Pi:

ping my-laptop.local

To see if your ping is working.

Step 5


If all works as expected, reboot and retest with Step 4.

Troubleshooting


If you still have an old IP assigned to the name for some reason (e.g. and earlier yet removed entry in /etc/hosts) try:

avahi-resolve -n my-pi.local 

to fix.

Note:

avahi-discover Cannot be used without X, so you are out of luck if you run your Pi Headless, but you can still use it from your laptop and such.

Thursday, August 14, 2014

Connect a Laptop Running WICD to a Raspberry Pi with a Persistent Peer to Peer Connection

Connect a Raspberry Pi to a Laptop that uses WICD for WiFi management with a Persistent Peer to Peer Wired Ethernet Connection and Connect Both to the Internet Simultaneously Without Blowing your brains out.....


This article assumes:

The two computers are connected with a crossover cable or at least one of the adapters are CrossOver aware. (see: Do you need a crossover cable?
http://www.networkworld.com/article/2219416/lan-wan/do-you-need-a-crossover-cable-.html)
Both the Raspberry Pi and the Laptop are connected to the internet and each other with a WiFi connection and the Pi is accessible with ssh..
The Laptop uses Wicd to manage Wifi connections....



Note: If at least one of the two cards supports Auto-MDIX, then the cross-over function will be taken care of automatically.

Your Pi should be Auto-MDIX.

Background


I recently purchased a Raspberry Pi and a WiFi dongle to connect to my WiFi router. I also have a WiFi connection on my laptop. However, the limitations of this type of connection became apparent when using NFS and trying to access my rtl dongle with a tcp connection. The wireless was just too slow.
It is usually simple enough in a case such as this to simply add a peer to peer wired link to share such services. However, I ran into problems because I use WICD to manage my WiFi connection on my Laptop. WICD is not scheduled to manage two connections simultaneously until version 2. Not having much luck using Network Manager with my Atheros wireless card I was a bit leery of ditching WICD for Network Manager. So I decided to figure out how to use the connection scripts in WICD to make my wired connection persistent. The main advantage of this method is my wired connection to the Pi is only attempted if I am at home. Since the connection scripts are per connection if I connect to another WiFi hotspot the wireless adapter will never attempt to connect to the Pi or attempt to mount my NFS shares. In short, the secret to making this all work was to blank out the entry for the wired connection in WICD and just manage the connection with ifconfig in the script.

Topography



Here is a Network Diagram showing the layout of our Network:


Step 1:



Connect manually to see if it works:


On Pi:
ifconfig eth0 10.10.0.11 netmask 255.255.255.0 broadcast 10.10.0.255

On laptop:
ifconfig eth0 10.10.0.10 netmask 255.255.255.0 broadcast 10.10.0.255

now:
ping 10.10.0.11
from latop to test
then:
ping 10.10.0.10
from pi to test

Use mii-tool to diagnose connection problems:
mii-tool eth0
And look for this in output:
eth0: negotiated 100baseTx-FD flow-control, link ok

The “link ok” is the important part. This means that your cables have a connection on the link layer.
try:
mii-tool eth0 -r

to fix problems. This command resets the link layer connection.

Depending on your distro, you wired connection may not be eth0. Use ifconfig with no switches from the command line to determine the name of your wired interface.

You will need to install mii-tool from your distro's package manager to use it. Refer to your distro's package manager documentation.

Step 2:


Make the connections persistent.


Setup the Pi:


Copy netctl static profile
cp /etc/netctl/examples/ethernet-static /etc/netctl/static

Then edit
nano /etc/netctl/static

To edit ip setting:
Address=('10.10.0.11/24')

add line:
SkipNoCarrier=yes

NOTE: the 'SkipNoCarrier' line should come before the 'Address' line.

The line above will make sure your Pi assigns an IP address to the interface regardless of whether the cable is connected or not.

make sure ifplugd is disabled with systemctl
systemctl disable ifplugd

Enable and start your new profile:
netctl enable static
netctl start static



Alternate method (probably better)

If you use this method do not create a netctl service for the interface. If you already have a netctl service for this interface, disable it with netctl.

cd /etc/systemd/network
nano eth0.network

Edit file to look like:

[Match]
Name=eth0

[Network]

#DHCP=both
Address=10.10.0.11/24

[Addreess]

Address=10.10.0.11/24
Peer=10.10.0.10/24

Broadcast=10.10.0.255/24


NOTE: Don't add an address line in the netctl profile if you have set an address here.


Setup Laptop

Open wicd tray icon
Preferences → General Settings → wired interface: blank

Add post connect script:

nano /etc/wicd/scripts/postconnect/start-wire

Now add these lines to the script:

# /bin/bash
ifconfig eth0 10.10.0.10 netmask 255.255.255.0 broadcast 10.10.0.255
# wait
# mount /mnt/<nfs-share>


Reboot to test.

You may need to add a static ip address for your interface to avoid DHCP errors on boot if you use OpenRC on your laptop.

nano /etc/conf.d/net

Add the line:

config_eth0="10.10.0.10 netmask 255.255.255.0 broadcast 10.10.0.255"


Now you should have a static wired connection between your laptop and Pi. Next article will be on setting up an avahi server on the Pi for local network name resolution.



Thursday, September 19, 2013

Compiz Options on Intel

The latest version of Compiz seem to work fine with out the old 'Loose Binding' and 'Indirect Rendering' switches set...However, turning these on will eliminate flickering in Stellarium and also fix problems with Facebook loading on Opera....

Wednesday, August 29, 2012

Upcomming Topics

I ran out of room on my laptop for my Sabayon installation, so I figured it was time to do some housecleaning anyways.  I booted up with my System Rescue CD and got to work.  I haven't used Vista in any meaningful way in quite sometime, so I imaged the partition and deleted it.  I also imaged the laptop recovery partition.  I backed up my home partition and my Vista data partition with a simeple cp -ax.  Then I used fsarchiver to backup the lvm volume of my root system.  Once I had all the backups in place, I deleted everything with fdisk. I booted up my Sabayon live CD, and reinstalled.

Once I had Sabayon in place, I booted back up with my Rescue Tools cd, restored my root partition with fsarchiver, mounted the lv_home with a mount /dev/sg_sabayon/lv_home and restored my home with a cp -ax, setup a chroot environment, made sure I had the same kernel using the kernel-switcher.  Then I rebooted with a Sabayon live CD and restored my boot partition, and whew!!!, it worked!!!  w00t!!!

So, anyway, I'm going to try to write a post per week here.  Some upcoming topics will be:

  • Setting up shares with sshfs
  • Using git and git-annex for file backups
  • Backing up lvm snapshots while running live
If there are any topics you would like me to consider, feel free to leave a comment...

Tuesday, August 21, 2012

ssh to vboxguests

Setup a Host Only Network in Oracle Virtual Box:

Assumptions:

  • User knows how to setup network interfaces for DHCP in linux
  • User knows how to add services to a default run level
  • User knows how to set up a ssh server

Add a Host-only Network


File --> Preferences --> Network
Click on add icon
New interface is vboxnet0
Machine --> Settings --> Network --> Adapter 2
  • Attached To: Host Only Network
  • Name: vboxnet0  
Revisit the IP settings in the new Host only adapter...
File --> Preferences --> Network screwdriver icon
Note the ip address and the Lower Bound of the DHCP range.

Setup Networking on Guest and Host OS'es


Start your guest OS Set up eth1 on your guest account to use DHCP. The host only adapter has a built in DHCP server. If you need to force an ip address to get the adapter set up for a single session only try:
ifconfig eth1 <lowerbound ip from above>
On the host system set up vboxnet0 as DHCP or with the static ip address in the IPv4 box in the picture above like you would any network adapter. I have had no luck getting it to run before Oracle virtual machine is started (e.g. at the default run level) After configuring the adapter to run as a service on the host system, the adapter can be started after on guest OS is running by typing as root:
/etc/init.d/net.vboxnet0 start

<optional>

Create a script to start the vboxnet0 adapter on the fly:

# echo "/etc/init.d/net.vboxnet0 start" >> /home/<user>/start-vnet.sh
# chmod 770 /usr/sbin/start-vnet.sh
# chgrp vboxguest /usr/sbin/start-vnet.sh

Edit the start-net.sh script and insert:

#!/bin/bash
At the top of the file.
Once the vboxnet0 adapter is started you should be able to ssh into your guest OS:

sudo ssh <username on guest OS>@<ip address from ifconfig eth1 on guest OS>


Happy Computing!!!