Saturday, September 28, 2013

A NAS with a Raspberry Pi: Part 1 - the drives

First, this isn't going to be linux standard.  I have constraints, 1)  NTFS formatted external drives, 2) only one partition per physical drive, and 3) a mixed OS network.


my steps:

1) upgrade everything first. optional, but it's my preference

sudo apt-get update && sudo apt-get upgrade && sudo reboot

2) install ntfs drivers.

sudo apt-get install ntfs-3g

3) find my external drive 

sudo fdisk -l

gives info including :

  Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    62333951    31105536   83  Linux

 

and 

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048  1953523711   976760832    7  HPFS/NTFS/exFAT


The last one is my external drive.  

4) find the serial for the drive

sudo udevadm info -a -q all -p $(udevadm info -q path -n /dev/sda1)
 

yields:

E: ID_SERIAL=ST31000528AS_9VP500HC

which becomes 

ENV{ID_SERIAL}="ST31000528AS_9VP500HC "

which is important, especially as I'm using two identical drive models. the serial the cleanest way to differentiate between them.


ls -l /dev/disk/by-uuid

gives (among others)

lrwxrwxrwx 1 root root 10 Jan  1  1970 7420568A205652EA -> ../../sda1
 



create "/home/81-external-drive1.rules"




copy it to /etc/udev/rules.d/81-external-drive1.rules

5) restart udev


sudo /etc/init.d/udev restart 

6) mnt/drive1 should exist and be browsable

7) reboot 

sudo reboot

8) should still be browsable 

9) repeat for drive2.

Wednesday, September 18, 2013

Firefox sync server on a Raspberry Pi running Raspbian

Updated 2/11/2014:
A better way to get weave-minimal running.
This link is to my new post, redone as a streamlined one step install script

I'm leaving the original here for reference purposes.

______________________________________________________________________


Original post from 9/18/2013

This post has good ideas, but it doesn't go far enough to a server that automatically starts after reboot.  The Weave Minimal page has more clues, including a script to stick in into init.d, but it's not quite complete either.

my steps:

1) upgrade everything first. optional, but it's my preference

sudo apt-get update && sudo apt-get upgrade && sudo reboot

2) install python-setuptools 

sudo apt-get install python-setuptools
 
3) install weave-minimal


sudo easy_install -U weave-minimal


4) create the start script in /etc/init.d/weave-minimal from here.  I used a ssh window, opened nano and pasted the content into it.

5) on the line starting with "--port" add "--host=0.0.0.0" before the --port.  
This lets the server respond to any request on any interface, not just the localhost. 

(Understand, that there may be good reasons not to allow this. In my case, the server isn't actually hosted on the internet, just internally, with multiple firewalls in place.  YOYO applies)

6) set the permissions

 sudo chmod 755  /etc/init.d/weave-minimal

7) add to the runlevels.

sudo update-rc.d weave-minimal defaults

the command will respond:

update-rc.d: using dependency based boot sequencing
insserv: warning: script 'weave-minimal' missing LSB tags and overrides


 however, it works.

8) sudo reboot

The rest of the setup is in firefox.  Your sync server is the pi's ip address and port 8080. (id. http://pi-ip:8080/)  Browsing directly will result in "Not Implemented The server does not support the action requested by the browser."
 
 

Monday, August 19, 2013

A response to Cygwin's "setup.exe" requiring administrator privileges



Shaddy Baddah in his message setup.exe now requires administrator privileges identifies a problem.  For reasons that escape me Cygwin, in a departure from the minimalistic intrusive installs of the past, now demands administrator rights. Tired of granting Admin rights to everything, I decided that there must be a better way. Starting from the following screenshot, let's fix this.

Notice, that the windows security badge is there... 
Opening up the file with a hex editor you get...


changing that to this by spacing out the line
 
results in
 

 which seems to install without any problems, and also makes me question the windows security paradigm.  Seems strange to also point out that the decisions made to require higher privileges appears to be an unnecessary overreach of rights.

Afternote: I only saw Yaakov's response before running off to find this solution.  If you read through all the message tree, the original poster tried to replace the line with a different line.  This was unsuccessful, as I'm sure that the change altered the binary in a minor way.  Having had to execute similar changes to Java Class files, for which the source was misplaced, I was careful not to alter the length, simply replace with spaces and save in hex.

Wednesday, June 19, 2013

Clone Cygwin packages.

I've come to depend on having a specific set of cygwin packages installed when working on systems.  The simple way to make sure it has what I expect is to install it.



I set this up to run regularly, which is why the filenames are timestamped.

Credit for inspiration to use /etc/setup/installed.db goes to http://cygwin.com/ml/cygwin/2011-09/msg00079.html

xmission is one of the closest sites, pick the appropriate one for you at http://cygwin.com/mirrors.html

Monday, June 17, 2013

Windows Explorer to current Bash prompt

There are times when it's just faster to do some things from Windows Explorer, than from Bash.  I know, this is sacrilegious to say, but it's usually when doing Windows specific things, so give me a pass here.

I've seen many ways to do this, but I'm partial to this way. 

I used nano to save this file to /bin/x, chmod 700 and done.

It's small and simple.

Unix philosophy anyone?

Friday, March 22, 2013

Colorize ls - cygwin Tweak #1

My cygwin tweek #1 can be added a number of places, but I typically add to /etc/profile because it's set for every user.