use Windows to download Raspian Jessie packages


15 posts
by squakie » Mon Mar 20, 2017 11:24 pm
The only internet access I have is at the library. I have a couple of Pi's at home one of which I use as a file server using samba. Well, the sdcard went belly up so I downloaded a new image at the library. Installed it to that Pi only to find that I need to download several packages for Samba. I have a "local" network (no internet) at home so my wireless devices can all talk to the server. After loading with the new image and running the config I then used ssh to access that pi from my laptop. In that window I tried that apt-get install samba samba-common-bin so it would show all the packages I need. I did a print-screen on my laptop then used libreOffice on the laptop (Windows 10) to print out the image so I could take it to the library and download the packages.

Found a raspian site of some sort with a ton of packages, but I quit checking it when some of the first packages I need aren't even on that site.

So, is there a repository site I can log on to using my Windows 10 laptop at the library and download these packages? I know I can put them on a USB stick and install them from that on the Pi (not exactly sure at this point - dpkg?).

Any help would be greatly appreciated!
Posts: 72
Joined: Fri Jul 26, 2013 8:55 pm
by W. H. Heydt » Tue Mar 21, 2017 4:35 am
When you are at the library, do you connect your laptop to the internet using WiFi? If so, set up the library WiFi credentials in wpa-supplicant on your Pi and take it, and a PSU along. Once there, bring up both your laptop and the Pi. Use your favorite program (e.g. PuTTY) to ssh into the Pi (you can set up your laptop so that you can connect using the host name, so you don't need the IP address...see the recent blog post on this) and you can now--in the ssh session--do the update and (dist-) upgrade and install all the packages you need.

If you can't plug in the Pi's PSU at the library (crying on the librarians shoulder if this isn't generally allowed may help...), you could get a decent sized "power bank" and use that to power the Pi.

Once you have the Pi system fully set up the way you want, take a backup copy of the SD card on your laptop. Then you can write a new SD card whenever you need to.
Posts: 6303
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)
by stderr » Tue Mar 21, 2017 5:00 am
squakie wrote:So, is there a repository site I can log on to using my Windows 10 laptop at the library and download these packages? I know I can put them on a USB stick and install them from that on the Pi (not exactly sure at this point - dpkg?).

There are various programs to help you do all this stuff but the use of apt-get, see the man page, will get you started:

sudo apt-get --print-uris update
sudo apt-get --print-uris dist-upgrade

The first line should give you the files and urls you need to get to give to your system so it can then tell you with the second command which urls to download and then add to the system. Each example will give you a lot of urls, so you want to put those into a script, powershell in win10, to download them.
Posts: 2088
Joined: Sat Dec 01, 2012 11:29 pm
by 321a » Tue Mar 21, 2017 7:55 am
Another way which might be an option, is to mirror a repository, if your library net access is fast enough and they dont limit how much you download, and you have the storage space.

If that is an option, then you can download all or some of a repository, ie limit to different versions of linux (Wheezy/Jessie) and other options.

Theres some threads on the subject which you can search for.
This link maybe a starter. https://www.raspbian.org/RaspbianRepository
And this one maybe a starter. https://www.raspberrypi.org/forums/view ... =66&t=7180
Posts: 56
Joined: Fri Mar 17, 2017 11:07 pm
by squakie » Thu Mar 23, 2017 4:08 am
Can't do the pi at the library thing - the pi is not wireless. I have it hard wired to the router at home so the throughput won't hit the collision it might on the wireless side. This also mean I can't do any of the apt things. I've know for a long time about generating a script from the package manager, but have never found it to generate any thing I can use in Windows to do the downloads. If a still had a Linux-only box (beside the Pi's) then I could.

I have looked at the online repositories that raspian keeps in their directory trees - but there is a problem:

- just samba-common-bin alone requires:
python-crypto
python-ldb
python-ntdb
python-samba
python-tdb
python-common-bin

I quit looking at the repositories they list for raspian Jessie when I could only find python-crypto - the others weren't in the list (at least in the "p's". Didn't even bother to try searching for those for the samba package as it does me no good for missing dependencies.

It's on the right track for what I want to do but I can't find all the packages to be installed - and that makes it fruitless. Perhaps someone can tell me if I need to look for some of these python packages in somewhere other than the "p" branch in the directory tree at raspian.
Posts: 72
Joined: Fri Jul 26, 2013 8:55 pm
by allfox » Thu Mar 23, 2017 4:28 am
Here is a BIG text file containing all packages and their storage path in Raspbian repo: http://archive.raspbian.org/raspbian/di ... f/Packages

However, I think stderr's idea is better. Apt has super cow powers, we shall use it.
User avatar
Posts: 289
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China
by stderr » Thu Mar 23, 2017 5:58 am
squakie wrote: This also mean I can't do any of the apt things. I've know for a long time about generating a script from the package manager, but have never found it to generate any thing I can use in Windows to do the downloads. If a still had a Linux-only box (beside the Pi's) then I could.

The pi supports running apt and it's a linux machine. Run:

sudo apt-get --print-uris update

You should get back a list of the needed files to download that you take to the library and download. These are the files that you need to give to apt-get on your machine so it can then be run with the following command:

sudo apt-get --print-uris dist-upgrade

This will then give you the urls that you take back to the library, the second trip, and download your updated deb files with, which you then bring back to the pi.
Posts: 2088
Joined: Sat Dec 01, 2012 11:29 pm
by allfox » Thu Mar 23, 2017 6:46 am
An Ubuntu wiki article about offline apt: https://help.ubuntu.com/community/AptGe ... /PrintUris
User avatar
Posts: 289
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China
by tweak42 » Thu Mar 23, 2017 7:36 am
squakie wrote:Can't do the pi at the library thing - the pi is not wireless. I have it hard wired to the router at home so the throughput won't hit the collision it might on the wireless side. This also mean I can't do any of the apt things. I've know for a long time about generating a script from the package manager, but have never found it to generate any thing I can use in Windows to do the downloads. If a still had a Linux-only box (beside the Pi's) then I could.


Your Pi doesn't need wireless if your laptop has a ethernet port. You can share wifi internet library access to the Pi using a ethernet cable.
https://www.hackster.io/Anwaarullah/sha ... ble-ae1f44

You will need Bonjour for Windows installed so you can find the address for raspberrypi.local (or use Advanced IP scanner) Once you have the address you can ssh in and start running apt.
Posts: 436
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California
by squakie » Fri Mar 24, 2017 3:45 am
I probably should have clarified something earlier to have avoided part of these messages. I ran apt-get install of both samba and samba-common-bin (since samba requires it). This gave me the list of the packages I would need to install, so I already had that. Searching in the Raspian site tree list for the packages I have packages that showed in the apt-get install lists but have not found in the Raspian site tree list. So indeed I know I can run apt from my Pi. What I don't know, and I guess I'm going to find out, is if the request apt actions shown are possible on a pi that is offline. If so, I can go that route.

I don't really want to be taking my pi to the library. Too many questions from staff who don't understand the answers.

So I'll try the apt actions shown in the post and see if they work offline. I truly hope that the list given is in the Raspian tree online. So far my results are not all there, which leads me to question if the Raspian site has every package in the tree list.
Posts: 72
Joined: Fri Jul 26, 2013 8:55 pm
by allfox » Fri Mar 24, 2017 4:51 am
squakie wrote:I don't really want to be taking my pi to the library. Too many questions from staff who don't understand the answers.


This reminder me that once upon a time, I wanted to send an original Raspberry Pi B to Austria. My local post office looks like never known a small computer like Pi, neither sent anything to Austria. So they educated me 15 min about how could sending a computer like this would threaten national security. Then they roll the Pi into a roll of white toilet paper, telling me that using newspaper as the shock buffer could make the foreign custom house nervous. And executed the EMS service. My Pi arrived in Austria in whole piece fluently.

So maybe all it needs is the patience to listen to the security lecture for 15 min. :D
User avatar
Posts: 289
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China
by squakie » Fri Mar 24, 2017 5:04 am
The apt-get --print-iris update just simple shows the repository locations. Whe I do apt-get --print-uris dist-upgrade it simply shows 0 upgraded newly installed to remove and not upgraded.
Posts: 72
Joined: Fri Jul 26, 2013 8:55 pm
by allfox » Fri Mar 24, 2017 5:13 am
sudo apt-get --print-uris --yes install samba should tell you where to download what you need for samba.
User avatar
Posts: 289
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China
by squakie » Fri Mar 24, 2017 5:37 am
Thank you!! That's exactly what I needed!! Hopefully I can get this all done over the weekend now.
Posts: 72
Joined: Fri Jul 26, 2013 8:55 pm
by rpdom » Fri Mar 24, 2017 5:57 am
The problem here is that the Raspbian repository only hold the latest version of each package for each supported release, unlike the Debian repositories (which are a lot bigger), which keep all the old versions as well.

When you use the --print-uris option it lists the details for the version that your Pi knows about. If that package has been updated on Raspbian you won't be able to download the old version any more.

If connected to the internet, that isn't a problem, as running apt-get update will update your package indexes.

It is something that I have looked at in the past. It involves running the "apt-get --print-uris update" and downloading the files listed by that and saving them to /var/lib/apt/lists.
(There might be an extra step here, but I can't remember it.)
Then you can run the "apt-get --print-uris dist-upgrade" and go back to the Library and download all of the files listed. When you get back you put those files in /var/cache/apt/archives and then run "apt-get dist-upgrade" and it should use the downloaded files instead of trying to get new ones.

It does mean two trips to the Library, ideally on the same day, but should work (assuming your library's computer policy allows you to use a computer twice on the same day. Ours do, but you are limited to a total of 60 minutes usage a day, unless you ask nicely and there isn't a waiting list for the computers - or you can take your own laptop an use the library wifi)
User avatar
Posts: 10441
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK