use Windows to download Raspian Jessie packages


21 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: 77
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: 6565
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: 2157
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: 77
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: 328
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: 2157
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: 328
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: 459
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: 77
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: 328
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: 77
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: 328
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: 77
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: 10581
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by Emanuele » Fri Mar 24, 2017 5:40 pm
I had the same problem a few years ago.

At that time, I used apt-offline and it worked very well. It was two trips to the library: 1) apt-get update 2) apt-get upgrade (+ apt-get install). In each case, I was getting a list of URLs that I post-processed to generate a CMD with a list of wgets. Each time you go back to Linux, you can point it to the directory where the downloaded files are.

However, apt-offline is not itself in raspbian and it requires a few dependencies on its own. Not that many, especially compared to samba, but still... IMHO, apt-offline should be in raspbian (even in the lite version). I'd suggest you to also add the dependencies of apt-offline to your list, just in case the plain --print-uris gives you problem.

https://debian-administration.org/artic ... nt_for_APT
User avatar
Posts: 170
Joined: Wed Aug 03, 2011 5:28 pm
by squakie » Fri Mar 24, 2017 7:00 pm
Crap. So what you are saying is I basically need to get everything up to date first - the same as running apt-get update (update the repositories) and apt-get upgrade to fetch and install the newest packages? Everytime I've done that in the past when I had other Debian systems there were a LOT of packages in that alone

I was #hoping# that the Raspian Jessie I downloaded a couple of weeks ago now was also current in the repositories.

This may be getting more time consuming for me that what I really want. Maybe I"m being "forced" into getting a net connection somewhere. It will require me taking a step back as I currently run the initial booting from from sd card and everything else is from hard disk. I'll need to change cmdline.txt to use only the sd card, run all the updates and install samba and a couple of others I'd like. Then I can bring it home and do the whole clone to hard disk and change cmdline.txt again. Maybe I can find somewhere other than the library that has free WiFi.

Since it looks like that's what I'll be doing and that I've never done the share internet connection thing, could some one give me a simple step by step?

Thanks for all the replies.
Posts: 77
Joined: Fri Jul 26, 2013 8:55 pm
by Emanuele » Fri Mar 24, 2017 7:15 pm
AFAIK, raspbian is tracking jessie (stable), so you might be lucky and nothing has changed since then, but, yes, if you don't update first you might encounter problems.

For "apt-get update", I usually used my phone. I didn't want to use it for the downloading of the actual packages as these can become quite large, but the repositories are just a few megabytes and it will save you a trip. On android is very easy and it works out of the box, If you can tether:

1) Connect USB

2) Android: Enable USB tethering.

3) Raspberry: dhclient usb0

That's it.
User avatar
Posts: 170
Joined: Wed Aug 03, 2011 5:28 pm
by squakie » Sun Mar 26, 2017 4:54 am
Unfortunately I just have a $79 LG phone using Walmart StraightTalk. There's no way to connect to my phone.

I did download the packages tonight, but I also noticed the samba package is at a higher release than the apt-get showed. I suppose when I go to install it from the USB stick it will want the newer versions of everything.

Can't try tonight - will try on Sunday.

Thanks!
Posts: 77
Joined: Fri Jul 26, 2013 8:55 pm
by tweak42 » Sun Mar 26, 2017 10:55 am
squakie wrote:This may be getting more time consuming for me that what I really want. Maybe I"m being "forced" into getting a net connection somewhere. It will require me taking a step back as I currently run the initial booting from from sd card and everything else is from hard disk. I'll need to change cmdline.txt to use only the sd card, run all the updates and install samba and a couple of others I'd like. Then I can bring it home and do the whole clone to hard disk and change cmdline.txt again. Maybe I can find somewhere other than the library that has free WiFi.

Since it looks like that's what I'll be doing and that I've never done the share internet connection thing, could some one give me a simple step by step?

Thanks for all the replies.


squakie wrote:
Since it looks like that's what I'll be doing and that I've never done the share internet connection thing, could some one give me a simple step by step?

Thanks for all the replies.


This is a combination of two parts. 1) setting up a Pi headless and 2) sharing/bridging a internet connection.

Make sure you have Bonjour for Windows installed.
Format clean SD card with Raspbian and add "ssh" file to boot partition.
Connect Pi to laptop ethernet and power up. Wait for it to auto resize home partition and reboot.
Both devices will try to request dhcp address, eventually time out, then auto assign 169.254.x.x. IP addresses to their respective interfaces.
At this time you should be able to ping and ssh into 'raspberrypi.local' but no internet access for the Pi.

Next setup internet connection sharing. This guide explains how in Windows 7 other versions of Windows should be very similar.
With ICS enabled, the laptop ethernet interface will assign a 192.168.x.x address and start listening for dhcp requests.
In a minute or two the connected Pi will request a dhcp lease and windows will grant it a 192.168.x.x IP.
After that you should be able ping and ssh into the Pi and sudo apt update etc.

Edit: any place you can get wifi should work, but in public I would put your Pi in a case, I've only been asked what my Pi was when circuit board and blinking LEDs were visible plus a multitude of wires connected.
Posts: 459
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California
by squakie » Tue Mar 28, 2017 9:31 pm
Success! Turns out I missed 2 packages when I did the manual downloads over the web, and just those 2 missing packages triggered all kinds of messages. I downloaded those 2 packages to add to the rest, used dpkg to install everything and samba is running just great! No need to move the Pi anywhere - just manually downloaded them all via windows. Without the information for apt-get with the print and a package name I would never have known some of the packages I was looking for initially are actually in other folders.

Thanks everyone for the help!
Posts: 77
Joined: Fri Jul 26, 2013 8:55 pm