K0LEE.com Sitemap


Home
Aviation
HP FAQs
Other Hobbies
Work


HP MediaVault MV2100 Series "hacking" FAQ

Written by Chris Seto (chris12892-AT-gmail.com), with contributions. Thanks to Lee Devlin for hosting this FAQ!


Please read first -- A warning on "hacking" your MV2

Index
Installing IPKG
startup.sh
Firefly (iTunes) web access
Mount the mobile rack drive as a separate volume
PHP bootup subsystem
Fixing TTY warning and getting the 'more' command to work
Transmission Bittorrent Installation
Netatalk (AFP) Installation
Using the MV2 as a general purpose web server (external link, hosted on an MV2)

Installing IPKG

IPKG may be added to the MV2. See Lee Devlin's IPKG page here. The linked method uses the Unslung repository.

Startup.sh

One way to start scripts and applications is to use a startup script. The MV1 had this feature, and the way it worked was that a script named "startup.sh" was inserted into the root of Volume1. The MV2 does not currently support this feature by stock, but a PHP script in /etc/init.d may be modified to check for, and execute startup.sh . The instructions for this modification are here.


Mount the mobile rack drive as a separate volume

By default, the mobile rack drive is mounted with the system drive as a JBOD. Nick from the Yahoo group discovered that you can modify the startup scripts to lie and tell the MV that the system only has one drive. You may access the guide here.

Firefly Web Access

It is possible to open the web page for Firefly.  You can see (but not change) the Firefly variables.   Just add port 3689 your Media Vault's web address and it will open the Firefly configuration window.   The user is 'admin' and password is 'mt-daapd'.


PHP bootup subsystem

WARNING: The PHP bootup subsystem is _very_ fragile. Do not edit it unless you know exactly what you are doing, and can risk losing ALL data on your MV2. If you make a mistake when editing these files, you may brick your MV2.

The MV2 uses a PHP based subsystem to boot up. Initially, rcS in /etc/init.d/ is followed. In the script, control is handed off to rc.bootup with is the main PHP file. Functions are defined in .inc files in /etc/inc/.

You may edit the files in init.d and inc, but make sure to reset the files back to their original permissions when you are done. failure to do so may brick your MV2 on the next bootup.

When editing the PHP bootup subsystem files, make sure to check your syntax and form before saving, and rebooting. If you were to typo something, you could brick your MV2 on the next bootup.

Please note that the PHP bootup subsystem is very fragile. You must make sure to do everything correct when editing the files contained in it.

When you edit the files, make sure to do it in these steps

1. Check permissions of the file with SSH
2. Change the permissions to allow editing
3. Edit the file
4. Check syntax, form, and make sure there are no mistakes
5. Save the file
6. Change the file back to the permissions it way on before you edited it.


Fixing the TTY warning and getting the 'more' command to work

The MV2 has an issue when you log in via SSH that generates a TTY warning.  This also prevents the 'more' command from responding properly to a <space bar> so that you can display files.  You can fix it by copying these commands and executing them in this order.  The first command makes a backup of a file and the second one performs a stream edit on the original file.

# cp /etc/udev/rules.d/50-udev.rules /etc/udev/rules.d/50-udev.rules.orig
# sed -i -e '/ttyS0.*SYMLINK="tty"/d; /console.*MODE="0622"/aKERNEL=="tty", NAME="%k", MODE="0666"' /etc/udev/rules.d/50-udev.rules

Then you must reboot for this to take effect.


Transmission Bittorrent Installation

Transmission is a simple bittorrent client that has a web interface. You can run it on the MV2 and access it from anywhere with a browser at the address http://hpmediavault:9091 (assuming your MV2 is named 'hpmediavault'). It's convenient to have the MV2 run a bittorrent client so that when you want to download a large torrent, you don't have to have PC on continuously. Before installing it, you'll need to use the the ipkg instructions on the MV2 hacking page to get ipkg working as explained here. After setting up ipkg, you can just type:

ipkg install transmission

To get it up and running, It is necessary to edit the settings.json file located under this directory:

/.config/transmission-daemon

Specifically, change these two lines to read as follows:

"download-dir": "\/share/1000/Videos",

(On my MV2, "/share/1000/Videos" is a valid directory, yours may be different, check to make sure since that number 1000 can change if you've been adding or removing drives.)

and

"rpc-whitelist": "192.168.*.*,127.0.0.1",

(Unless you add 192.168.*.* it will not allow logins from other computers on the network, it generated a 401 error. This assumes your internal network is on address 192.168.*.*, if not, modify accordingly.)

Then you'll need to set up these environment variables which, for testing purposes, you can do from the command line:

export EVENT_NOEPOLL=1
export TRANSMISSION_WEB_HOME=/opt/share/transmission/web/

Then to start it:

/opt/bin/transmission-daemon -f

The -f option will run it with a text output on its status to your SSH window and help you to see if it's working. If it works, then it will just be a matter of putting those commands in a startup file to allow it to run automatically on startup. Otherwise, it will stop running when you log out of the SSH session.

To test it, open a browser and navigate to http://hpmediavault:9091 and see if you get a window. If you do, use a service such as mininova.org to find a valid URL for a torrent and paste it into the URL window to see if it works.

I added the lines to the end of /etc/init.d/rc.bootup that make it check for startup.sh as explained here.

Inside startup.sh put these lines to set the environment variables and launch Transmission during boot up:

export EVENT_NOEPOLL=1
export TRANSMISSION_WEB_HOME=/opt/share/transmission/web/
/opt/bin/transmission-daemon


Netatalk (AFP) Installation

With the introduction of Lion Mac OS X (10.7) Apple broke the compatibility of using Time Machine with the SMB file sharing capabilities of the MV. I first noticed that SMB stopped working when I upgraded to Snow Leopard (10.6.8) so if you've been using your MV2 to back up your Macs with Time Machine, you may find it stops working when you update the OS. In the case of the MV2, it's possible to use the Optware IPKG installer to install Netatalk, an open source implementation of Apple's AFP and thus make Time Machine work again with your MV2.

The Itsy package manager (IPKG) is covered as a separate topic of this FAQ and it is necessary to install it first, so please do that if you haven't installed it already. The installation of IPKG is explained here. After setting up ipkg, you can just type:

/opt/ipkg update

/opt/ipkg install netatalk

/opt/ipkg install libgcrypt

Provided everything installed cleanly, you'll need to edit a few lines in two configuration files before launching netatalk. I am assuming you know how to use the nano or vi editors on the MV2. In /opt/etc/netatalk, edit the file called afpd.conf and add this line to the end of it:

- -udp -noddp -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword

Then, in the same directory, edit the file AppleVolumes.default and add this line to the end of it:

/share/3595/BackupTM "BackupTM-AFP" allow:lee,lee2 cnidscheme:dbd options:usedots,upriv,tm

In my case, I had set up an SMB share called BackupTM and user lee on the MV2 so match those fields accordingly depending on which MV Share name and user name you intend to use for Time Machine. I appended the letters AFP since you can mount the SMB share or the Apple File Protocol share, and for Time Machine, it can only use the AFP method. Having distinct names helps me keep track of the way that Volume gets mounted in /Volumes. I am going to create a new user called lee2 later, hence that's why I added lee2 as a user. The numbered directory on my MV2 (3595) was set up by the MV2 using some random sequence and yours will likely be different. You'll have to look under the /share directory and find where the share you want to use for the AFP connection is located. I also found it necessary to open up privileges on the folder 3595 for all users like this:

chmod 777 /share/3595

Time Machine needs a user/password login on the MV2 and I created one by adding a user in the MV2's web user interface. You'll find that this creates a user in the file /etc/passwd file, but the user's password is not stored there and the shell defaults to /bin/nologin. The /etc/passwd file looks like this:

# more /etc/passwd
root:$1$2.bH9TLX$Zoyy6sTNJjsEVuAdvu2rt.:0:0::/:/bin/sh
nobody:x:99:99:Nobody:/:/bin/nologin
postgres:x:500:500:DB User:/:/bin/nologin
_ntp:x:501:501:NTP User:/:/bin/nologin
lee:x:502:502:Linux User,,,:/:/bin/nologin

Please note how user lee appears to have no password and no shell for login. We will need to fix this. To place the password for user 'lee' in the /etc/passwd file, you can use the passwd command like this:

passwd lee

You will be prompted for the password to set for user 'lee' and you should make it the same as password you chose in the MV2's admin web user interface, just to make it easier to remember. It will encrypt it and so don't expect to find the password in the clear, but rather a cryptic looking string in the second field. Next you'll edit the file and change the /bin/nologin to /bin/sh. When you're done, the user entry should look something like this:

lee:$1$$TWOx47x1ulv6VemPiLD4p/:502:502:Linux User,,,:/:/bin/sh

During the next reboot, all that work will get undone because the MV2 re-writes the /etc/passwd file on each bootup. So copy that last line into its own file and give the user a new name. I called my new user lee2. Similarly, I called the file lee2 and stored it in /etc. We will need this file to fix the /etc/passwd file on each boot from the startup.sh script. Next we need to get netatalk running. The commands to do that are:

/opt/sbin/afpd -D

/opt/sbin/cnid_metad

We will need to put those commands in the startup.sh file so that netatalk starts automatically. When you type 'ps -ef', you should see /opt/sbin/afpd -D and /opt/sbin/cnid_metad running. We will need to add the lee2 user to /etc/passwd during each startup, so your startup.sh should have these lines:

cat /etc/lee2 >> /etc/passwd
/opt/sbin/afpd -D
/opt/sbin/cnid_metad

The first line adds a new user, lee2 on to the /etc/passwd by appending a line to the end of the /etc/passwd file. This user doesn't exist in the MVs database, but it will have permissions to access the AFP share as configured in AppleVolumes.default file.

Add that line to /etc/passwd manually by executing the command:

cat /etc/lee2 >> /etc/passwd

Now you will have to create a sparse bundle file on your MV2 that your Time Machine will be able to use to login to an AFP share. The instructions for setting up a sparse bundle on your Mac and copying it over to the share are basically the same as the ones given for the SMB share as explained here.

To mount this afp volume, open up the Finder on your Mac and use the K command to bring up a connect to server menu. In the server text box, type in afp://hpmediavault.local (use the actual name of your Media Vault in the event you changed it from its factory default name). It will prompt you for your username and password. Use the user/password that will be appended to the /etc/passwd file. Check the box to store it in your local keystore. Incidently, the procedure to unmount the AFP volume is to look in /Volumes with the terminal, and unmount it with the umount command, i.e., umount /Volumes/BackupTM-AFP. I had to do this a lot of times while I was experimenting.

If everything is working properly, when you launch Time Machine on your Mac, you should see the MediaVault's share available as a destination for a backup location. Go ahead and select it and confirm it can backup to it. Once this has been done, Time Machine will be able to find it again on its own.

This web page has had 15941 visits.