DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-02-28 07:58:27

dhub
Member
Registered: 2011-01-01
Posts: 112

Grub as a funplug

I wrote a fun-plug script that acts as a boot selector for other fun plugs kind of like the grub boot loader on the PC.

It puts up a web server on port 8000 that allows selecting the fun_plug script to load.  This makes it easy to try various fun_plug scripts while being able to recover if there is a problem (such as a reloaded script hangs the nas).  After 1 minute it automatically loads the most recently used fun-plug.

Recovering from malfunctioning reloaded funplugs becomes as easy as power cycling and selecting a different fun_plug script (or the default firmware/no script)

In case my attachment doesn't come through, I also put it up on my web server at:

funplug_manager_0.01.tar.gz

Oh and a screenshot to give an idea of what the hell I'm talking about:

http://ipkg.dhub.me/screenshots/fun_plug_manager.png

Last edited by dhub (2011-02-28 08:01:50)


Attachments:
Attachment Icon funplug_manager_0.01.tar.gz, Size: 7,859 bytes, Downloads: 340

Offline

 

#2 2011-02-28 08:16:45

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Oh forgot the source for the C binary that runs the web server that provides the selection interface.

Also available at:
funloader_0.01_src.tar.gz


Attachments:
Attachment Icon funloader_0.01_src.tar.gz, Size: 2,708 bytes, Downloads: 349

Offline

 

#3 2011-02-28 23:05:20

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Just talking to myself, but would it be worthwhile to add an install option to the select screen. 

I.E. another area where the user can single click install various popular fun-plugs and have their stuff set up correctly for the boot loader?  Seems like since fun plugs are pretty much a start script and a directory it wouldn't be that hard to implement.

Offline

 

#4 2011-03-01 05:35:24

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

I got the install option written and I think it will work (still haven't had a chance to test it yet.  Here's a quick screenshot of what it looks like (I wrote 2 proof of concept install scripts, one for Alt-F 0.1B6 and one for FFP 0.5)
http://ipkg.dhub.me/screenshots/funplug_manager_3.png

Offline

 

#5 2011-03-03 13:48:40

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Ok, just built a new package, it adds the following features:
1. Ability to install fun_plugs, 2 example scripts included to install fonz fun plug and alt-f (reloaded).  This feature hasn't been tested very heavily so use with caution.
2. Ability to boot directly to a specific fun_plug script a single time without prompting.

The new version is at: http://ipkg.dhub.me/funplugs/funplug_ma … .17.tar.gz

Offline

 

#6 2011-03-03 14:50:13

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Another new version, fixed a stupid bug that was keeping the web interface from working.

I also added two scripts:
/mnt/HD_a2/fun_plug.d/bin/funplugs - Displays a list of the installed fun_plug scripts
/mnt/HD_a2/fun_plug.d/bin/rebootinto - Reboots the nas and immediately runs the specified funplug script

The new version is at: funplug_manager-0.19.tar.gz

Oh and a quick dump of using the new scripts to reboot the nas into a different fun-plug:

Code:

# /mnt/HD_a2/fun_plug.d/bin/funplugs  
Alt-F-0.1B6
debian_squeeze-0.11
dlink-firmware
fonz-0.5
# /mnt/HD_a2/fun_plug.d/bin/rebootinto Alt-F-0.1B6
Connection closed by foreign host.

Last edited by dhub (2011-03-03 14:54:39)

Offline

 

#7 2011-03-06 20:55:08

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Another new version:

1. A few bug fixes so the rebootinto and funplug commands run correctly if run under alt-f.
2. Web interface will now try to redirect to the normal web interface after 10 seconds
3. Prettier output
4. Changed to zip archive, to make installing easier.

New install instructions:
1. Optional: Back up your existing fun_plug script
2. Download funplug_manager-0_20.zip
3. Unzip to Volume_1 of your nas
4. Optional: Put your original funplug script with a descriptive name in fun_plug.d/funplugs
5. Reboot

Offline

 

#8 2011-03-07 12:47:57

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

There was a bug in the web service on the last version that caused the web interface to not start.  Now fixed.  The new version is:
funplug_manager-0_21.zip

Offline

 

#9 2011-03-07 13:35:44

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Oh, Sources for the most recent version are at funplug_manager-0.21.src.tar.gz

(I really need to get this moved to github)

Offline

 

#10 2011-03-10 01:41:01

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

As a side note, if you're using this the firefox "Try Again" plugin is really useful since you can just put in http://mynasip:8000 and tell it to keep trying until the funplug_manager comes up.

Offline

 

#11 2011-03-15 17:29:38

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

New version http://ipkg.dhub.me/funplugs/funplug_manager-0_24.zip

This version will attempt to redirect to the web interface of the funplug after starting it.   In order to facilitate this, a new comment in the funplug in the following format is used to specify the amount of time to delay before redirecting:
#REDIR 90

Last edited by dhub (2011-03-15 19:18:45)

Offline

 

#12 2011-03-15 18:25:51

samfree
Member
Registered: 2011-03-12
Posts: 10

Re: Grub as a funplug

Hi dhub

Your new project looks really cool... thanks for sharing it.
I hope to get a chance to play with in a few weeks when I get some other things cleared away.  FYI the link in your last project points to your local network.

Offline

 

#13 2011-03-15 19:19:36

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Doh, that's what I get for trying to post something right before I have to go to work.  Link has been fixed in my previous post.

Offline

 

#14 2011-03-23 20:13:57

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

New version http://ipkg.dhub.me/funplugs/funplug_manager-0_25.zip

Install:
   1. Unzip the package to the root of the Volume_1 disk
   2. Reboot the DNS-323 using the dlink gui firmware
   3. Keep reloading http://nasipaddr:8000 until the funplug loader starts

Changes:
   1. Fixed a few minor bugs
   2. Fixed the install functionality, installing Fonz FunPlug 0.5 and Alt-F Reloaded 0.1B6 has been tested and is working.  The debian reloaded install may work but hasn't been tested and things like the web management gui and fan control (fan defaults to max speed on my Rev C1 unit with no way to slow it down) aren't complete in the current debian image I'm using.
   3. Much smaller, the entire zipfile is 26k :-)

Issues:
   1. Currently the install scripts don't provide any feedback in the web interface.
   2. Installed scripts show up in the boot manager screen without their Full name/Version.

Offline

 

#15 2011-03-23 20:45:28

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Just a quick note the debian reloaded install from the manager screen doesn't work :-(

Offline

 

#16 2011-03-29 16:14:06

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

New version http://ipkg.dhub.me/funplugs/funplug_manager-0_107.zip

Install:
   1. Unzip the package to the root of the Volume_1 disk
   2. Reboot the DNS-323 using the dlink web interface
   3. Keep reloading http://nasipaddfir:8000 until the funplug loader starts

Changes:
   1. Fixed a few minor bugs
   2. Updated the funplugs command to provide the funplug name and version in addition to the filename
   3. Updated the funplugs and rebootinto commands to work better when run in the Alt-F firmware
   4. Install scripts provide some feedback during the install instead of performing a blind install.
   5. Updated the Alt-F install script to install Alt-F 0.1B7

Last edited by dhub (2011-03-29 16:15:42)

Offline

 

#17 2011-04-04 22:34:26

bodbod
Member
Registered: 2007-11-22
Posts: 109

Re: Grub as a funplug

I feel bad for you man smile no answer to your monologue in here ! smile
thanks for the efforts in your project, i am sure some will use it later !

Offline

 

#18 2011-04-06 21:43:17

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

This is only part of what I'm working on (getting debian to safely reload and run properly without flashing the firmware).  I believe in releasing early and often and since the funplug_manager is useful I try to do regular updates in the event others find it useful (and in part so I can recreate my configuration if I blow it away and restart).

I finally got Debian Squeeze to properly install and boot via funplug_manager in both single disk and raided configuration.  So I imagine I'll be changing my focus to making debian work better on the dns-323 in another week or two once I finish testing that I can fully rebuild a dns-323 with funplug_manager and all the funplugs (Alt-f, fonz ffp and debian squeeze).

Offline

 

#19 2011-04-08 21:37:52

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

The debian reloaded install now seems to be working correctly, just need to tweak it a bit to work better (want to have it install dropbear instead of openssh and some other minor things to free up some precious memory.

Offline

 

#20 2011-04-11 00:46:26

tinybilbo
Member
Registered: 2011-04-02
Posts: 36

Re: Grub as a funplug

Hi,

I'm going a bit nuts here struggling to get this to work...

I've got 2 boxes,

One on dlink 1.10b6 and the other Alt-f 0.1b7, both Rev C. boards.

This appears to be simple to install...
All I should really do is,

1) Copy contents of the zip to the root of my 1st drive (HD_a2 or sda2 - depending on which on which firmware is flashed).
2) Make sure fun_plug is executable (0777).
3) Reboot.
4) Go to NAS-IP:8000 (in my case 192.168.1.81:8000) in my web browser.
5) Keep reloading untill I see BootManager webpage.

If I use your just your default .zip contents - I should see something.... should'nt I?

Both boxes just boot it's firmware.

I wanted to have a look at your Debian reloaded install script...

Any help would be appreciated... smile

Last edited by tinybilbo (2011-04-11 00:49:05)

Offline

 

#21 2011-04-11 09:13:32

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

I haven't had issues with the web interface not coming up for quite a while.  It is possible there is an issue with the 1.10B6 firmware, although I can't think of anything that would cause an issue.

However, I have noticed there is sometimes an issue where some web browsers will silently switch to reloading the previous web page (I have had both firebox and chrome do it to me, so it's not just one browser either). 

So if you have the dlink firmware page up on 192.168.1.81 for example.  Install funplug manager, reboot and go to 192.168.1.81:8000 and keep hitting refresh, the browser would for some reason intermittently switch to loading the previous 192.168.1.81 address without the port (8000) and since funplug_manager times out and boots the most recent funplug after 90 seconds it's quite possible to not realize the browser switched to loading the wrong url before funplug_manager times out.

As a result, a couple of days ago I switched to killing the dlink web server and replace it with the fun_plug manager web server (it then restarts the dlink server when it's done).  This way funplug_manager runs on the same port as the normal one.    If you downloaded a funplug_manger_current.zip in the last few days you probably got one that has the new behavior (so you would never see it come up on port 8000)

Under the new behavior after rebooting just keep reloading the normal web IP address, the dlink web interface will come up, if you keep reloading after about 30 seconds the funplug_manger web server will come up and redirect to the main funplug_manager page.  It makes more sense if you see it.

I am pretty sure the debian reloaded functionality won't work with the 1.10b6 firmware btw.  The reloaded function is kernel specific and I've never loaded that firmware and I'm pretty sure there isn't a reloaded module compatible with that firmware's kernel as a result.

The install script is in funplug.d/funplugs/install/debian-reloaded and it now works well for me (tested on two Rev C1 DNS-323s with 1.09 firmware)

Note, I tested the funplug_manager/debian-reloaded install on windows today. 
The method I used was:
   1. Downloaded the funplug_manager-current.zip
   2. Extracted all files to \\nasname\Volume_1
   3. Logged into the dlink web interface and went to tools->system->restart
   4. Keep hitting refresh on the dlink web interface screen until the funplug_manager loaded
   5. Clicked on "Debian-Reloaded" in the install section
   6. Went and got a coffee
   7. Noticed it was still going, went for a walk
   8. Logged into debian on the nas via putty (root password is set to deb323, although it also copies the admin user from the flash into the debian password/shadow file so you can log in with your normal nas admin user/password)

The first boot is a pain since it downloads the most recent debian kernel module packages, which rebuilds the initrd image (which is a pretty slow operation on the dns-323)

Offline

 

#22 2011-04-11 09:27:15

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Since I seem to have debian working for me, here's a new version http://ipkg.dhub.me/funplugs/funplug_manager-0_134.zip

Install:
   1. Unzip the package to the root of the Volume_1 disk
   2. Reboot the DNS-323 using the dlink web interface
   3. Wait, after the 120 second countdown the dns-323 should show the funplug_manager menu

Changes:
   1. Moved the funplug_manager service to the normal web port, it now kills the dlink web service and restarts it when done
   2. Added a function to not reboot into the most recent fun_plug if it failed to start previously.  This requires a supporting funplug script and currently only works with the debian-reloaded funplug.
   3. Fix to set the execute bit on funplugs prior to executing them.
   4. Added syslog support for funplug scripts.  This allows funplug scripts to log their startup output to a syslog server over the network (makes troubleshooting reloaded scripts much easier)
   5. Debian-Reloaded install script now is working on DNS-323 Rev C1 hardware with 1.09 dlink firmware in both single disk and raid configuration.

Offline

 

#23 2011-04-11 20:02:52

tinybilbo
Member
Registered: 2011-04-02
Posts: 36

Re: Grub as a funplug

dhub wrote:

Install:
   1. Unzip the package to the root of the Volume_1 disk
   2. Reboot the DNS-323 using the dlink web interface
   3. Wait, after the 120 second countdown the dns-323 should show the funplug_manager menu

Changes:
   1. Moved the funplug_manager service to the normal web port, it now kills the dlink web service and restarts it when done.
   ....
   4. Added syslog support for funplug scripts.  This allows funplug scripts to log their startup output to a syslog server over the

Thanks for the help dhub,

However, I still can't get this to work...
*Using just one box/firmware to avoid confusion.*
I have flashed the box back to dlink original firmware 1.09,
Formatted the single hardrive (ext2),
and reset factory settings. (Just to make sure).

I have then unzipped the latest version (in windows),
and used windows explorer to transfer the files to the root of my Harddrive (\\DLINK-xxxxx\Volume_1).
I then checked with my ftp program that fun_plug is execuable (0777).

I then rebooted the nas and used firefox to go to the login page, which is now just the IP, and no longer port 8000.
(Killing the dlink webpage and then running yours after, is much clearer).

I then boot back into the dlink firmware/webpage, and I then keep refreshing my firefox link (which is the actual IP link),
waiting for the manager page to come up.
The manager page still just does'nt come up, and no log file is created.

Fonz fun_plug does load as well as some other fun_plugs, (I just got stuck on an endless loop/reboot with a badly edited fun_plug).
So I know that fun_plugs are working.

Any ideas on what I'm doing wrong?

Thanks

Last edited by tinybilbo (2011-04-11 20:07:53)

Offline

 

#24 2011-04-11 22:39:20

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

I have no idea, the only difference between what you are doing and how I install is that I tell zip to extract directly to \\nasname\Volume_1 via smb.

The only thing I can think of is that ftp is setting the permissions differently than SMB does.

What are the permissions of the files in the funplug.d/bin directory?  They all need to be executable (especially webselect which is the webserver)

I really need to make the thing a self extracting archive...

Offline

 

#25 2011-04-11 22:57:57

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Grub as a funplug

Just a quick note if anyone runs into this...

The Debian reloaded functionality's first boot script can fail to install the mdadm package which is a problem since the install of the linux-modules package causes a rebuild of the initrd image and if mdadm isn't installed the resulting boot image lacks support for booting off a raid mirror :-(

I'll add a debian-reloaded failsafe boot option that uses the initrd image I tested with on the next version, so it's is easier to recover from than extracting the initrd image from the install archive.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB