Installing driver from offline repository

I need to know how to save the xf86-video-ati, sddm and plasma5-sddm-kcm files to cd/dvd/usb in a kind of offline repository. That way when I install FreeBSD I install them from my offline repository instead of having to connect to the Internet and download them. Does anyone know how to do this?
 
Do the ports need to be downloaded before using synth? I entered synth just-build myrepository.list at command line. The file contains these lines:

ports-mgmt/pkg

x11-drivers/xf86-video-ati

x11/sddm/sddm

deskutils/plasma5-sddm-kcm

The error message I get is: It seems that a blank PORTSDIR is defined in /etc/make.conf
 
Yes, in order to build from ports, you need a copy of the ports tree. I use portsnap to do this. I do have a separate machine for this purpose though.
 
Didn't get a chance to elaborate last night: I have the configs necessary to have one machine build packages and serve them to a second machine. Here is my set up:

Ports builder machine:

1) FreeBSD 12.0-RELEASE with ports-mgt/synth and www/nginx installed, nothing else.

nginx config snippet. I probably don't need the part about "autoindex" but wanted to be able to run a browser and see the what the contents of the site were. Not visible outside my LAN so it's fine. www/nginx is used to serve the packages to the machine using them.

Code:
server {
    listen       80;
    server_name  bigzbox.sevendogs.net;
    #charset koi8-r;
    #access_log  logs/host.access.log  main;
    root /var/synth/live_packages;
    location / {
        autoindex on;
    }

No configuration for ports-mgmt/synth is necessary except if you want to use tmpfs, then it picks that up automatically.

2) PC being served packages to:

Needs 2 config files and these will depend on your particular set up in terms of names you have for your build machine:

Under /usr/local/etc/pkg/repos/, the following 2 files are needed: FreeBSD.conf and myrepo.conf. The "myrepo.conf" can be named whatever - I just used the example from the howto on ports-mgmt/poudriere.

FreeBSD.conf:

Code:
FreeBSD: {
  enabled: no
}

myrepo.conf:

Code:
myrepo: {
  url: "http://bigzbox.sevendogs.net"
  enabled : yes,
  mirror_type : NONE
}

That's it for the set up. On the build machine, I feed ports-mgmt/synth with a text file list of ports I want to build: synth just-build <insert your file name here> and let it go. After the build is complete, if no errors, run synth rebuild-repository and after it completes, the repository is ready to go.

On the machine that is going to use your new repository, you can just do normal package installs. For the FIRST time when I switched to this process and had packages installed from the official FreeBSD repository, I ran pkg delete -afy which will delete ALL of your packages installed. Not sure if this is necessary but it worked for me. Then bootstrap pkg so it installs from your repo and you are good to go. Make sure you have ports-mgmt/pkg in your list of ports to be built.

About once a week (or 2), I run portsnap on the build machine to update the tree, then re-run the build process and rebuild the repository. The only ugly part about this is setting the port specific configurations using make config-recursive in each port directory that I am going to use. Might be a better way to do this but I only have 30 or so ports so I just did it manually. I have only had to do this once. I THINK the configs stay when you run portsnap fetch and portsnap update but someone with a whole lot more experience may correct me :)

The only thing I don't like about this set up is that I don't think ports-mgmt/synth can provide cryptographic validation of a repository using keys. ports-mgmt/poudriere does. I asked the synth dev but have't gotten a response.
 
Phishfry linked to an article that showed how to create a repository.

pkg create -a

I copied the files created to a usb drive and mounted it on the target machine. I disabled the base FreeBSD repository as indicated in the article that Phishfry linked to. But is there a way I can make the system realize that this is what I want to use?

The article said that the new repo had to be made active and showed these commands:

echo 'REPONAME: { url: "http://REPO_URL"}' > /usr/local/etc/pkg/repos/REPONAME.conf
pkg upgrade

How would I modify the echo command above to have it use the files stored on my usb? Modify the url?
 
Last edited:
I've never installed packages that way but I think you can use "file" as a protocol. Here is a reference from the ports-mgmt/poudriere HOWTO:

A better way to use the packages is to use the pkg remote repository feature (see pkg-repository(5)) by creating a repository configuration file /usr/local/etc/pkg/repos/myrepo.conf and specifying the repository address as a file:// URL (to use the local file system) in this configuration file.

Code:
myrepo: {
    url             : "file:///usr/local/poudriere/data/packages/releng112amd64-default",
    enabled         : yes,
    mirror_type     : NONE
}

I suppose you could reference the usb drive this way but I have never done that.
 
You would just have to remember to have the usb drive mounted, and the mount designation be consistent if you are going to use it in a configuration, before you ran pkg update or another command, or it would error out.
 
What I found that seems to work is to change to the directory on usb containing my repository and simply type: pkg add *.*

I read in the online manual pages that add is used when installing from a local package instead of fetching from remote. This solved the problem except that the pkg program itself has to be installed already. This requires connecting to the Internet if FreeBSD was installed from the img dowload file. I suspect that pkg is on the dvd but I don't have a dvd drive attached to the target machine and can only install using usb.

Do you know a way to determine which FreeBSD iso's might contain pkg already? It's not a big deal but it would mean I could install my repository without connecting to the Internet at all.
 
Phishfry, if I understand you correctly, I could have simply used pkg add pkg.txz from my usb repository and then pkg add *.*? I didn't need to download pkg from the online repository?
 
Thanks Phishfry. I'll try pkg-static add pkg.txz and then pkg add *.* on a fresh install tomorrow. This last detail should complete the entire process of creating and using offline repositories.
 
pkg-static add pkg-1.10.5_5.txz if using latest packages.
This after cd 'ing into your usb stick mountpoint with package txz files.

Any repo settings are not needed with this method.
Checkout pkg fetch -d to grab the packages on your connected machine.
 
I tried the pkg-static add pkg-1.10.5_5.txz but it doesn't install. I changed to the usb directory containing the repository.
 
I know many people already answered but I'm sort of ignoring all that because I cannot help but think that programs such as Synth are serious overhead for what the OP is asking.

I need to know how to save the xf86-video-ati, sddm and plasma5-sddm-kcm files to cd/dvd/usb in a kind of offline repository.
It's actually really easy, and you don't need much else besides the base tools. You can simply download the individual package files and then use # pkg add to add those to your other system. However... keep well in mind that some packages have specific dependencies which you're also going to have to satisfy, otherwise things don't work:
Code:
root@psi:/usr/local/etc # pkg search -d xf86-video-ati
xf86-video-ati-18.1.0,1
Comment        : X.Org ati display driver
Depends on     :
        libXi-1.7.9_2,1
        xorg-server-1.18.4_10,1
        mesa-libs-18.1.9_4
        libdrm-2.4.96,1
        libpciaccess-0.13.5
So if you don't make sure that you also include these packages as well then you'll eventually run into problems. Fortunately there's an easy solution: let the package manager sort it all out for you. We do that by "installing" the package (which would also pull in its dependencies) but without actually installing.

To avoid problems we're also going to download those packages into another, separate, directory. We can learn about these options by studying /usr/local/etc/pkg.conf:
Code:
root@psi:/usr/local/etc # grep -i cache pkg.conf
#PKG_CACHEDIR = "/var/cache/pkg";
That option specifies where the downloaded packages get stored. And if you take a look at pkg-install(8) you'll notice a few interesting options: -F ('fetch only') and the fact that we can use environment variables to override some options in pkg.conf, including the cache directory.

SO...

Code:
root@psi:~ # mkdir pkg
root@psi:~ # set PKG_CACHEDIR=/root/pkg
root@psi:~ # echo $PKG_CACHEDIR
/root/pkg
root@psi:~ # pkg install -qyF xf86-video-ati
Note that I used set because I'm using the default csh shell, on Bourne based shells (sh or bash) you'd probably want to use export. I also used -qy for demonstration purposes only, you can easily stick with -F if you're using this interactively.

Problem: I seem to be experiencing a bug or I'm overlooking something obvious because even though pkg.conf(5) tells me that the environment variable should override any (default) settings in pkg.conf my experiences are different. In the above situation everything got downloaded to the default directory of /var/cache/pkg and I have no idea why that is so right now.

So worst case scenario: edit /usr/local/etc/pkg.conf, set the variable PKG_CACHEDIR to point at your directory and use the command above.

Now, the install command doesn't only pull in dependencies from xf86-video-ati, it recurses this operation; so it also pulls in dependencies from the packages that the 'ATI package' depends on. This could be a good thing of course, but if you only want to concentrate on the direct dependencies of these packages then use this:
Code:
root@psi:/var/cache/pkg # ls xf86*
xf86-video-ati-18.1.0,1-9deda9fb07.txz  xf86-video-ati-18.1.0,1.txz@
root@psi:/var/cache/pkg # pkg info -dF ./xf86-video-ati-*txz
xf86-video-ati-18.1.0,1:
        libXi-1.7.9_2,1
        libdrm-2.4.96,1
        libpciaccess-0.13.5
        mesa-libs-18.1.9_4
        xorg-server-1.18.4_10,1
root@psi:/var/cache/pkg # mv xf86-video-ati*txz libXi-1* libdrm* libpciacc* mesa* xorg-serv* /root/pkg
root@psi:/var/cache/pkg # ls /root/pkg
libXi-1.7.9_2,1-2d0ca2f640.txz          mesa-dri-18.1.9_3.txz@
libXi-1.7.9_2,1.txz@                    mesa-libs-18.1.9_4-629a58ec07.txz
libdrm-2.4.96,1-9af5283799.txz          mesa-libs-18.1.9_4.txz@
libdrm-2.4.96,1.txz@                    xf86-video-ati-18.1.0,1-9deda9fb07.txz
libpciaccess-0.13.5-ed1d77b50e.txz      xf86-video-ati-18.1.0,1.txz@
libpciaccess-0.13.5.txz@                xorg-server-1.18.4_10,1-ac7f448db9.txz
mesa-dri-18.1.9_3-47dab7e4fd.txz        xorg-server-1.18.4_10,1.txz@
Ok, so this also copied the symlinks but you can easily get rid of those: find /root/pkg -type l -delete.

And now you only have the 'ATI package' plus its direct dependencies. On the new system you can use # pkg add /root/pkg/* to actually install all those packages. Of course you don't have to include the dependencies if you don't want to, but I suggest that you do because otherwise you'll run into problems.

Hope this can help.
 
I found an old post from 2013 in which Beastie gave this link: [URL]https://wiki.freebsd.org/PkgPrimer[/URL]
The code is below:

tar xf ./pkg-1.2.1.txz -s ",/.*/,,g" "*/pkg-static"

./pkg-static add ./pkg-1.2.1.txz

I switched to the usb containing my repository and executed the above as root. Then, remembering SirDice's advice that extensions were not necessary, I typed pkg add *. So far everything seems to work fine. Thought I'd put this out there again in case no one saw Beastie's post but has this same problem.
 
Last edited by a moderator:
Back
Top