News for hackers. Stuff that matters.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by myself248 on Wednesday November 27, 2019 @08:59AM (#21647846)
As I've been playing with Raspi's and Beaglebones and stuff lately, it's been driving me nuts that EVERYTHING I do needs to be apt-gotten off the internet, the base image doesn't even include basics like screen/tmux.

If those repos are inaccessable for any reason, I have a bunch of hardware that's very hard to do anything useful with.

I know there are such things as apt-caches and squid caches and stuff, but I could really use thing that goes through every apt-get I've ever done and the top 50,000 packages on github and stuffs 'em all onto an SD card and shows me how to use them from my commandline.

OP mentions this as a future direction for the project, but I think it's one of the most important.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by iam-TJ on Wednesday November 27, 2019 @09:31AM (#21648084)
On Debian-based distros there are several tools.

squid-deb-proxy can do most of this - it fetches and locally caches lists and packages. Clients install squid-deb-proxy-client which uses multicast-DNS to discover the local proxy.

Packages are fetched and cached by the proxy first time they're requested and thereafter served locally (subject to lifetime/space etc. squid configuration).

There are ways to pre-populate the cache but you're always going to have situations where package updates have to pull from remote archives.

apt-mirror is designed for a similar purpose. It allows creating a sub-set or entire mirror of one or more upstream archives.

Clients can then be pointed at the local mirror which could be on the same host or LAN.

Generally, 'packages' on github will be source-code only so you'd need a quite complex build server, or at least per-package specific links in your local cache rules for pre-built binaries.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by myself248 on Thursday December 05, 2019 @06:22PM (#21717767)
Update: In case anyone finds this later, I just ran across this page of someone else doing EXACTLY what I wanted to do, for exactly the same reason:

https://blog.thelifeofkenneth.com/2018/01/off-grid-raspbian-...

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by ekianjo on Wednesday November 27, 2019 @09:52AM (#21648267)
> it's been driving me nuts that EVERYTHING I do needs to be apt-gotten off the internet,

One solution is to do it once only: grab the base image, install all the packages you need, and then make an image of it so you don't start from scratch again next time.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by myself248 on Thursday December 05, 2019 @06:56PM (#21718004)
But next time I'll be doing something different. That's like saying "the only internet you need is that which is already in your browser history".

No.

What I want is something closer to Kiwix already on an SD card so even if everything is down, I can read about something I've never been interested in before. But for software.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by willis936 on Wednesday November 27, 2019 @10:48AM (#21648824)
This is my plan (in action) for an offline GPS nixie tube clock. I'm not sure about what is the right choice for options. Many are nice-to-have features for people like me, who would be the most likely to want a clock like this (snmp to host drift, jitter, and temperature mrtg logs), but come at the mild cost of security.

Will those who receive this bother to connect it to networks? Should I even enable network/GUI for those who want to tinker easily? How should the password be handled?

I'm considering two extremes:

1. A raspbian lite headless system with all unnecessary peripherals disabled and no network features.

2. A full installation, GUI and all with HDMI and network enabled so it's easy for people to play with it if they want.

I'm leaning towards 2 because I think it would be nice to have a clock that auto updates leap seconds and the tzdata db. If I go for 1, that opens up the possibility of using a raspi zero (non-W) for a real BOM and power savings.

As for the password: I'm thinking of having something short and simple other than "raspberry" that the user can/should change. This seems like standard practice with many enterprise systems.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by stjohnswarts on Wednesday November 27, 2019 @08:35PM (#21653952)
This is what I do, and it works well.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by nextlevelwizard on Thursday November 28, 2019 @12:25AM (#21654798)
>the base image doesn't even include basics like screen/tmux.

Easily arguable that RPi isn't made with such use cases in mind. I'm all in favor of removing unnecessary bloat if only a small percentage of user base is ever going use it, especially when the software is readily available.

>If those repos are inaccessable for any reason, I have a bunch of hardware that's very hard to do anything useful with.

How so? They are just Linux boxes, you can just download the source code and compile the binaries you need. Pre-built packages are not necessary for functional OS.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by SmellyGeekBoy on Thursday November 28, 2019 @06:38AM (#21656435)
> How so? They are just Linux boxes, you can just download the source code and compile the binaries you need. Pre-built packages are not necessary for functional OS.

What about dependencies? If you have the internet access required to download the source code I'd say you'd be better off just using the repos.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by taneq on Thursday November 28, 2019 @04:51AM (#21655915)
Download the source code, from the repos?
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by q3k on Wednesday November 27, 2019 @10:04AM (#21648402)
NixOS solves all of these problems.

a) define your entire system state and dependencies in a single, declarative file

b) prebake an image based on this file

It's all done and ready, available now, no hacking around required.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by KirinDave on Wednesday November 27, 2019 @10:30AM (#21648651)
This is precisely what every linux distro does. Nix isn't providing novel functionality for bootable OS images.

But a bigger question for the ergonomics of NixOS: Are NixOS and Nix prebuilding for ARM now?

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by q3k on Wednesday November 27, 2019 @11:04AM (#21648983)
> This is precisely what every linux distro does. Nix isn't providing novel functionality for bootable OS images.

None of them provide native, single-source-of-truth declarative configuration that is easy to reason about, pure, and guaranteed to deliver sane results every time (vs. something managed via a classic CM system). Oh, also one that it symmetrical to the way the distribution itself is built and managed.

> But a bigger question for the ergonomics of NixOS: Are NixOS and Nix prebuilding for ARM now?

Yes. https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi

Ports to other ARM devices are also very easy.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by KirinDave on Wednesday November 27, 2019 @01:28PM (#21650513)
> None of them provide native, single-source-of-truth declarative configuration that is easy to reason about, pure, and guaranteed to deliver sane results every time (vs. something managed via a classic CM system).

Firstly: the Nix language isn't pure. And neither are some base Nix library functions.

Secondly: You may find it easy to reason about. Many of us have not had that experience. Trying to do work as a developer, I felt it was absolutely miserable the instant I needed to depend on a new package or a new runtime. Every language had slightly different conventions and rules. You had to relearn how any specific package worked to integrate it with another, because there often wasn't sanity. And if you DID need to somehow interface with something outside of Nix (say, a vendor binary not in Nix) you had to use an unreliable environment hack.

And of course, the tutorials and docs didn't actually cover the majority of concerns on how to add new stuff folks will inevitably have, except for a trivial C executable.

In one case, after spending a week working out how to add a package to enable a Haskell binding to said package correctly, I submitted package updates that took MONTHS to propagate into the main repo, so I had to start pushing my fork of the nix repo from machine to machine via github on my own to manage multiple machines. It was pretty ridiculous and I regretted my choices.

I like the Nix philosophy. I respect a lot of the people on the project. But I am not a fan of the "it is all fine and well-baked and I'm sure you can use it too" approach a lot of Nix proponents decide to take.

You could absolutely arrive at a solid installable image for ANY major Linux distro.

> Yes. https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi

That's great! I'll have to try it again there if it has packages I want for SDR work that are not comically ancient.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by chme on Thursday November 28, 2019 @02:23AM (#21655273)
I really like the idea of NixOS and Guix and tried NixOS for half a year on my laptop. Then I changed back to ordinary package based distributions. (Arch, Debian and Gentoo)

The issue with NixOS for me was probably quality control. When I did an update and instead of fetching the files from the binary cache it starts to build stuff on its own, I could be reasonably sure that some build error happens. Coupled with sparse documentation, I was very often at a loss at how to fix it and just had to remove the package for a while and try again a couple of days later.

Another point is NixOSes path mangling... Do we really need that? Can we not try to use namespaces and OverlayFS etc. to let each process assume it has a normal FHS file-hierachy while in real its 'root' is cobbled together from multiple package installation directories? Instead of patching the paths of every package, letting the kernel do the path calculations seems to be less intrusive.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by huevo5050 on Thursday November 28, 2019 @05:18AM (#21656040)
You are wrong with build stuff in NixOS, their pure functional approach make easy to guarantee that builds that passed in CI will pass in your machine.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by chme on Thursday November 28, 2019 @03:26PM (#21659973)
In theory you are right, but somehow changes made it into their channels that weren't cleared by the CI and therefor the binary caches didn't have the artifacts in them and I had to build it myself which failed.

So in practice updating a Gentoo system is more reliable than updating NixOS.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by dfc on Wednesday November 27, 2019 @10:19AM (#21648540)
(A) is also possible with Debian. OP could just make a pressed file for debinstaller.

(B) is probably accomplished with any OS.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by pjc50 on Wednesday November 27, 2019 @10:26AM (#21648612)
.. but if you discover you need something, you have to go back to (a).
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by q3k on Wednesday November 27, 2019 @11:28AM (#21649263)
Your prebaked image will contain the definition (a), and you can incrementally continue building upon it, then regenerate yet another image if needed.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by qubex on Wednesday November 27, 2019 @02:41PM (#21651245)
Yes, software accessibility is an issue in the most pronounced disaster scenarios. But anybody who looks at a device of such exquisite craftsmanship, which is evidently already set up to function, and frets about downloading software after some apocalyptic scenario has missed at least half the point.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by m463 on Wednesday November 27, 2019 @05:35PM (#21652840)
Since these are small devices, I think a minimal image is a necessity. What you will use is not what someone else will use.

As to caching, I tried setting one up and found out a few things.

I originally tried apt-cacher-ng:

https://www.unix-ag.uni-kl.de/~bloch/acng/

but had trouble (can't remember exactly what) and muddled through polipo instad.

I found out:

- it was a lot easier and faster than copying cached packages around

- when doing "apt-get update; apt-get upgrade" the cache really sped up multi-machine updates. The first machine was slow, the rest were fast.

- By far, the majority of cache traffic was for updates to base stuff. foo-1.2, foo-1.2.1 foo-1.2.2, etc.

- second was prerequisites for packages I needed.

- the few specialized packages I used were not updated as frequently.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by granra on Wednesday November 27, 2019 @02:24PM (#21651070)
You may want to look at debos for pre-baking debian/ubuntu images.

https://github.com/go-debos/debos

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by AnIdiotOnTheNet on Wednesday November 27, 2019 @01:15PM (#21650371)
Yep, big problem with the repo model that Linux insists on using for everything. Offline is a 5th class citizen because of course everyone lives in SV or a university dorm.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by franga2000 on Wednesday November 27, 2019 @02:01PM (#21650856)
I see the repo model as the closest we've come to a solution. Not only are there mirrors in case the main repo drops, because all software is in one repo it's extreme easy to cache/sync/download. Offline mirrors are even an officially supported use case with many package managers. Have enough space? Mirror the whole thing. Not? Select only the interesting package groups. Missed one? You can probably get it from another machine it's installed on.

Want to have an offline copy of software on Windows? Go download all of the installers from their respective sites. Want it to constantly update - that's gonna be about 100 lines of Python code. And better make sure they're the "offline" installers, not those idiotic stubs that just dl the latest version for a server. Also don't forget about all of the 20 different VC++ runtimes that are sometimes not packaged in the installer.

I have a feeling it would be even harder on macOS.

(all of this is of course ignoring the legal issues of distributing those files - which is generally not an issue on Linux)

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by AnIdiotOnTheNet on Wednesday November 27, 2019 @02:23PM (#21651059)
> because all software is in one repo

All software is most definitely not in one repo. If it were, people wouldn't have to use PPAs or compile from source and deal with all the problems those things cause.

> better make sure they're the "offline" installers, not those idiotic stubs that just dl the latest version for a server

Oh, you mean the ones that aren't just acting like apt.

> I have a feeling it would be even harder on macOS.

Depends, but MacOS software that uses Application Bundles should be fine. Even a lot of Windows software works fine if you just copy the installer contents to a directory. Self-contained application directories (or single files) are an old as dirt concept that Linux communities never got behind, preferring instead to use overly complicated schemes like package management that come with a bunch of their own problems. So many, in fact, that people are now often distributing applications in Docker images.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by franga2000 on Wednesday November 27, 2019 @03:35PM (#21651837)
I had a feeling PPAs would come up, but I've never had more then maybe 7 PPAs on any of my Ubuntu machines, which is still better then each program coming from a different site and with a different installer. Including PPAs in caches/backups is trivial.

The way I see it there are 2 different use cases here: 1. You want a few individual apps kept safe on a USB stick in case you need them offline - installers on Win, AppImage on Linux 2. You want a constantly updated cache of the programs you use in case of the apocalypse - pain in the ass on Win, trivial on most Linux

Windows only seems superior here because no. 2 is barely possible, so everyone has gotten good at no. 1.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by AnIdiotOnTheNet on Wednesday November 27, 2019 @04:12PM (#21652185)
> AppImage on Linux

Oh, if only there were more than a handful of applications on Linux distributed as AppImage, and any support given to them at all by file browsers, life would be so much simpler. Linux community hates desktop so much they completely ignored an embedded ELF icon standard and have consistently poo-pooed every non-repo way of dealing with applications ever.

> You want a constantly updated cache of the programs you use in case of the apocalypse

Why would I want that? So I could discover that something I rely on was broken by a recent update only after I have no ability to do anything about it? Well, lets assume so. On Windows this is relatively simple, just keep a copy of Program Files and most applications will still work fine. It's not ideal, but I'll take it over package managers not even being able to install an application to a different disk.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by SmellyGeekBoy on Thursday November 28, 2019 @06:43AM (#21656472)
> just keep a copy of Program Files and most applications will still work fine

In some mythical parallel dimension where the Windows system directory, user profile directories and the registry don't exist, sure.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by AnIdiotOnTheNet on Thursday November 28, 2019 @11:04AM (#21658232)
Applications rarely copy dlls to the system directory these days, as that led to horrifying DLL hell just like Linux has, where conflicts abound unless some central authority carefully manages everything. I routinely run about a hundred different applications portably from a thumb drive. Try that shit with Linux (it only works with AppImage!).

User profile and registry are for settings. You can easily keep backups of those as well, but it isn't really necessary unless you have highly tweaked configurations or something.

Have you not touched Windows since 1995?

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by nextlevelwizard on Thursday November 28, 2019 @12:29AM (#21654819)
As oppose to which OS that gets new software while being offline?
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by SmellyGeekBoy on Thursday November 28, 2019 @06:40AM (#21656448)
Linux repos can be hosted on a local disk. Or you can order a CD/DVD through the post with mirrors of the repos.

Which OS handles this better, in your opinion?

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by AnIdiotOnTheNet on Thursday November 28, 2019 @11:07AM (#21658264)
DOS, classic MacOS, NeXT, RiscOS... Single file or folder applications that are entirely portable was the norm in those OSs.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by Already__Taken on Wednesday November 27, 2019 @04:26PM (#21652275)
Or just not behind an enterprise proxy it seems.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by esotericn on Wednesday November 27, 2019 @10:47AM (#21648807)
FWIW providing you have the kernel and firmware basically everything can be built from source.

I've built most of the base repository of Arch Linux on my RPi4 without cross compiling. I'm buying a few more so that I can go 'full Gentoo' and pretty much rebuild the world.

Have a recording of a container booting from a rebuilt userland: https://asciinema.org/a/283303

It might feel like the ARM packages are somehow special but really only the blobby bits like the RPi firmware is. Everything else is just your bog standard armv7/aarch64 ELF.

So yeah, back up a GCC binary or bootstrap, I guess? I can probably email you a tmux binary in a pinch, plus I have a full local mirror of the repo for the apocalypse? :P

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by pjc50 on Wednesday November 27, 2019 @10:27AM (#21648626)
Debian provide a physical artefact containing all the packages that could be used without internet access. I don't know whether this also works for Raspian: https://www.debian.org/CD/
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by rubenbe on Wednesday November 27, 2019 @11:08AM (#21649037)
This is why projects like yocto and buildroot exist.

They help you maintain a stable software stack over time. And generate a fully contained software image that can be flashed without needing the internet afterwards. (All downloads happen during compilation)

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by myself248 on Wednesday November 27, 2019 @11:19AM (#21649148)
Thank you for filling in a gap in my understanding!

I'm pretty severely on the noob end of the scale when it comes to software, so I don't know if maintaining a new distro for myself would make sense, since all the tutorials I'm following assume I have Raspbian and all its built-ins available to me.

But maybe in the post-apocalypse, some hero with a prebuilt Rasp-yocto will rescue all our useless boards.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by ppf on Thursday November 28, 2019 @06:09AM (#21656274)
How often are the repos inaccessible? I've come around to the opinion that, unless you have a very specific use case, networking is an essential element of any (Linux) computer system. Once you have that, you can benefit from a world of free software, with updates all handled automatically.

Personally I find it almost magical that I can install and update almost any software I need with a short command.

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by mister_hn on Wednesday November 27, 2019 @10:14AM (#21648485)
You can build your own image/rootfs

Imagine that you can build your rootfs is a docker container and export it to IMG

Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by stjohnswarts on Wednesday November 27, 2019 @08:35PM (#21653945)
I don't think I've ever seen the rpi apt repository offline, so I'm not sure why you're so worried. Embedded computers tend towards lean rather than heavy and that is the mindset you're going to encounter.
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by pnutjam on Wednesday November 27, 2019 @11:06AM (#21649017)
Can't you rsync down your own repository?
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by nextlevelwizard on Thursday November 28, 2019 @12:29AM (#21654820)
Why would you even want to do that?
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by pnutjam on Saturday November 30, 2019 @07:12AM (#21669635)
to keep a local copy to work from
Re:Off-Grid Cyberdeck: Raspberry Pi Recovery Kit by swiley on Wednesday November 27, 2019 @02:10PM (#21650934)
Most of the important stuff is in busybox and gcc (maybe Python.) Cache those and their dependancies and you have most of what you want.