Skip Navigation

How install a package/program with all the dependencies tree to an offline devices ?

Hi,

I have an air gaped[^1] device. ( Devuan )

How do you manage to install packages/software on off-line[^1] device ?

I've heard of apt-offline but it seem to bug and I don't know if it's still maintained (last release two years ago)

of course I've tried manually but the dependencies relations are too crazy to do that fully manually

Any ideas ?

Thanks.

[^1]: air gaped, off-line
\ https://en.wikipedia.org/wiki/Air_gap_(networking)

16 comments
  • You might want to consider using Docker. You can build an image on your normal machine, export it as a file onto a USB stick, and then transfer it to your air-gapped machine, import it there. Then running it is just docker run --rm my_image

    You can do this for a whole bunch of programs in one image, or a separate image for each one.

  • If this is for a user programs rather than system components that must be managed by apt, you could use Nix.

    By its nature, it keeps track of all dependencies in a queryable format and Nix stores are actually quite portable; you can just

     undefined
        
    nix copy /nix/store/6gd9yardd6qk9dkgdbmh1vnac0vmkh7d-ripgrep-14.1.1/ --to /mnt/USB-drive/
    
      

    and that will copy that store path aswell as any dependency (including transitive deps) to e.g. a USB drive.

    You'd then do the inverse in the target environment to do the opposite:

     undefined
        
    nix copy /nix/store/6gd9yardd6qk9dkgdbmh1vnac0vmkh7d-ripgrep-14.1.1/ --from /mnt/USB-drive/
    
      

    And then /nix/store/6gd9yardd6qk9dkgdbmh1vnac0vmkh7d-ripgrep-14.1.1/ aswell as its entire runtime dependency tree would exist in the air-gapped system.

    Because Nix store paths are hermetic, that's all you need to execute e.g. /nix/store/6gd9yardd6qk9dkgdbmh1vnac0vmkh7d-ripgrep-14.1.1/bin/rg.

    You'd obviously just adjust your $PATH accordingly rather than typing all of that out and typically would install this into what Nix refers to as a profile so that you have one path to add to your $PATH rather than one for each package.

    I used a single package here but you could build an entire environment of many packages to your liking and it'd be the exact same as far as Nix is concerned; it's all store paths.

    You do need /nix/ to exist and be writeable in the target environment for this to work though.

16 comments