Setting correct date & installing other packages?

Posted by ghost_in_black 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Setting correct date & installing other packages?
June 10, 2012 06:28PM
Hey, I've got a couple OpenWRT related questions.

I've got Piratebox .51 running on a TP-MR3020. When I upload files the dates have been in the years 1980 or 1970 (haha). I'd like to set the correct date and time, but for doing that manually OpenWRT wants me to configure a NTP date & time server list. Since the Piratebox isn't normally connected to the Internet that didn't seem like a good idea.

I figured the easiest way to fix the date would be by installing LuCi and manually setting the date in LuCi's gui.
opkg update && opkg install luci-ssl
But with that command, opkg tried to install LuCi onto the MR3020's internal memory (rather than onto UScool smiley and it filled up the internal memory, then returned an insufficient space error. To try to re-gain my internal memory space I ran the out of space script on the OpenWRT OPKG page. When I
df
it still shows the root / directory as being 93% full, and I don't know if that's normal.

And I still don't know how to install LuCi so that it's files go onto the USB drive.

Help? smiling smiley
Re: Setting correct date & installing other packages?
June 10, 2012 07:31PM
Well, the date/time problem is one of my well known problems. Everytime your have a power-loss of the MR3020 you loose your date&time.

Your can set the date via a console command "date". I already thought about saving the current date/time to file & load it on startup, but this will cause a "timelag" after a while, because its not possible to save it every minute, because this will harm your usb-device/flash rom.

Any other ideas?
Re: Setting correct date & installing other packages?
June 10, 2012 08:00PM
Matthias,

Scenario 1
Would it be possible to write a script that when the MR3020 is connected to your router it could grab the correct time from you NTP server?

Scenario 2
When initially setting up the piratebox, you could take the mac address from the configuring computer and save it to a file. when and if you lost power to the piratebox. the user would simply connect to the piratebox ssid with that initial computer, the piratebox would then check the mac address for that computer against some file and sync the time that way.


I think scenario 1 is more doable.

nothing to see here, no longer here.
Re: Setting correct date & installing other packages?
June 12, 2012 07:38PM
Thanks for answering my question about the time/date problem. But what about how to install OpenWRT packages onto the USB drive?
Re: Setting correct date & installing other packages?
June 13, 2012 05:24AM
I developed a bit around it, but it is not able to get a full install from your usb device with all packages.
At first, on the basic openwrt image, you need additional packages to get access to your usb device. So if they are located on the usb device, you wont reach them.
If you can manage to get this USB stuff working, then there maybe additional packages in dependency to piratebox-package.
While installing the piratebox package, several packages a loaded to the usb stick. This are plenty of packages, which I don't want any user to have to do for his own.

What I managed to do, was creating a mirror from the package tree to my computer (or a 2nd. PirateBox). Then redirect downloads.openwrt.org (entry in /etc/hosts) to your mirror and install the packages from your local OpenWRT mirror.

best regards
Matthias
Re: Setting correct date & installing other packages?
June 13, 2012 10:27AM
ghost_in_black Wrote:
-------------------------------------------------------
> Thanks for answering my question about the
> time/date problem. But what about how to install
> OpenWRT packages onto the USB drive?


[wiki.openwrt.org]

Here, have this smiling smiley
Re: Setting correct date & installing other packages?
June 13, 2012 10:38AM
This is like the piratebox-package makes his work.

But installing on and installing from are two different things
Re: Setting correct date & installing other packages?
June 16, 2012 09:02PM
Quote
Matthias
Any other ideas?

Well, I was wondering if it was possible to ask the devices connected to the piratebox the time. Smartphone, tablet or computer are always on the right time, right ? So we just need a way to ask them what time is it.
Re: Setting correct date & installing other packages?
June 17, 2012 11:03AM
Updating time normally works with a NTP-Client & NTP Server.
The NTP Server have to run on a client computer, which is very unusual.

But, you post gave me another nice idea:

A Javascript called by the client's browser which calls a server-side script, which updates the time. After the update the server-side script is disabled until the next reboot. So, The client pushes its time&date to the PirateBox.
Maybe it has to be a combination with a regular running task & the serverside script.

What do you think about that?
Re: Setting correct date & installing other packages?
June 17, 2012 11:41AM
Well actually I was thinking about NTP and came to the same conclusion as you: it need a server on the devices which would besomething rare.

Javascript idea might do the trick but it assumed that the first client to connect got the right time. We can ask all the clients and those who got the same time (within a margin of 5 or 10 minutes ) are the one with the good time.
Re: Setting correct date & installing other packages?
June 17, 2012 04:02PM
Ok, I can understand that. But the problem of this kind of automation is that you open a possibility for a break in point... sad smiley
The idea is good for checking the first 10 clients... but how to differ the clients without tracking data?
Re: Setting correct date & installing other packages?
June 17, 2012 05:16PM
Well I don't think you can, but one single client won't connect 10 times in a row.
You just redirect him to the page where javascript is just when he connects, It would make the javascript and the welcome page 2 different pages so he won't execute the script again, unless he disconnect and reconnect again. Besides asking more than one person is just to make sure that the time he gives us is accurate.

It's not vital though, it' just to make sure we got the right time. It may even be unnecessary.
Re: Setting correct date & installing other packages?
June 17, 2012 05:26PM
Yes, I understand that.
But, how often are encounter a piece of hardware in daily use with a wrong time setting?!
Re: Setting correct date & installing other packages?
June 17, 2012 06:11PM
Matthias,
For security, See my post above is it possible to use MAC address(which never changes) as an authentication method. I don't think the PB should ever connect to the Internet for time.

nothing to see here, no longer here.
Re: Setting correct date & installing other packages?
June 17, 2012 06:43PM
Quote
pabell
it possible to use MAC address(which never changes)

Not true, MAC address is changeable and very easily.
Re: Setting correct date & installing other packages?
August 17, 2014 09:47PM
Here is a bump

Would be great to have some time in the PB.
Files uploaded in 1970 are silly...
But the forum would really benefit from some correct timing.

Also, what is a good way to set the date and time manually until someone figured out an automated way?
Re: Setting correct date & installing other packages?
August 22, 2014 04:34AM
For Fix see here: [forum.piratebox.cc]


This is only my signature.



Edited 1 time(s). Last edit at 08/22/2014 04:36AM by Matthias.