How to correct package update issues in a manual IOCAGE JAIL

saviodesign

Dabbler
Joined
Apr 7, 2017
Messages
21
How to correct package update issues in a manual IOCAGE JAIL



Note: Always take your time, and remember that updates tend to have bugs.

Be sure to save your current OS version by setting the Keep flag in Systems > Boot Environments prior to updating, this way if things don't work how you'd like after an update, you can simply rollback to your previous OS by setting your previous OS version to active, then rebooting the machine.



Sometimes you’ll notice that your application version is behind and what to update manually, in some cases the iocage jail decides to disagree and tell you your version is up to date. You do your due diligence and research the web a bit, including GitHub, Fresh Ports, and even Free BSD ( ) and you’ve come to find that you are version locked, and cannot update your system; this is not completely true, as the configuration files which dictate where to look for your ports and their updates are set incorrectly ( by default, and probably with good reason to secure the jails for novice users).


To correct this we need to tell the modify the config files to tell the jail that we’d rather police ourselves.

Note: If you’re looking to update an icoage plugin created jail, please click here:
https://forums.freenas.org/index.ph...pdates-issues-in-an-iocage-plugin-jail.72517/

How to Log into an iocage jail

To log into the jail, first, you'll need to find your jail name by entering:
iocage list


You’ll see something similar to the following:
+-----+----------+-------+--------------+------+
| JID | NAME | STATE | RELEASE | IP4 |
+=====+==========+=======+==============+======+
| 3 | plex | up | 11.2-RELEASE | DHCP |
+-----+----------+-------+--------------+------+
| 2 | tautulli | up | 11.2-RELEASE | DHCP |


Next log in by entering:
iocage console jailname

e.g. iocage console plex , iocage console tautulli



Step 1: Grab an easy text editor, Disable default Repo, and Establish Alt Repo locations w/quick access


- Install Nano text editor (usually easier than navigating through VI editor) by running:
pkg install nano


- Create a new alternate port repository directory:
mkdir -p /usr/local/etc/pkg/repos


- Create shortcuts to get to these files in your home directory, we’ll label them repo1 and repo2

ln -s /etc/pkg ~/repo1
ln -s /usr/local/etc/pkg/repos ~/repo2



- Navigate to the current repo with the shortcut we created earlier
cd ~/repo1

- Open the config file with the text editor we acquired earlier (Nano)
nano FreeBSD.conf

Note: We never want to remove this file, only modify it


- Modify the URL line from:
url: "pkg+http://pkg.freebsd.org/${ABI}/latest",
to
url: "pkg+http://pkg.freebsd.org/FreeBSD:11:amd64/quarterly/",

hit ctrl+x to exit, then y for yes, then hit the enter key to save.


- Force update to change to a legacy repo
pkg update && upgrade

You should see something similar to the entries below:
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD has a wrong packagesite, need to re-create database



Once the update has finished let's edit the file and disable the default configuration
nano FreeBSD.conf

change the line “enabled: yes” to “enabled: no
hit ctrl+x to exit, then y for yes, then hit the enter key to save


Your entries should look similar to the entries below:

FreeBSD: {
url: "pkg+http://pkg.freebsd.org/FreeBSD:11:amd64/quarterly/",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: no
}




Step 2: Create a New configuration and Forced update

Let’s navigate to the alternate repo you created earlier
cd ~/repo2

This time we’ll tell the editor to create the configure file for us after we submit our text entries
nano FreeBSD.conf


copy and paste the following:

FreeBSD: {
url: "pkg+http://pkg.freebsd.org/${ABI}/latest",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: yes
}

hit ctrl+x to exit, then y for yes, then hit the enter key to save

- Finally, run forced updates
pkg update && upgrade



Your iocage jail should now be able to install from ports and accept updates.
- To test, try installing nano again and watch as the update occurs
pkg install nano



If update fail, please check your network connections ( ping pogle.com), review the steps above, or remove and install and start from scratch
 

mow4cash

Contributor
Joined
Jan 20, 2017
Messages
132
What is the difference between the way you show and this?
Code:
iocage exec plex "mkdir -p /usr/local/etc/pkg/repos"
iocage exec plex "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
297
What is the difference between the way you show and this?
Code:
iocage exec plex "mkdir -p /usr/local/etc/pkg/repos"
iocage exec plex "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"

Same end result. This is just using iocage to exec commands inside the jail instead of running from the jail console.

I use iocage exec for one or two commands but usually just login the jail console if I'm doing more. As far as I understand there should be no difference it's just if you want to use the jail console or not. I think, in other words iocage exec is for convince.
 

saviodesign

Dabbler
Joined
Apr 7, 2017
Messages
21
What is the difference between the way you show and this?
Code:
iocage exec plex "mkdir -p /usr/local/etc/pkg/repos"
iocage exec plex "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"


This question seems more like "trolling" than an actual inquiry.

As @tprelog mentioned, same end, different result.

This is simply a difference in navigation plus the "correct" way to perform functions and navigation within a jail.
To perform these steps externally (from the parent host) may not cause problems, but could eventually create confusion for more novice users.

In other words, it's usually better to show people how to do it the right way before providing shortcuts, and since we have no way of gaging everyone's experience level, it's usually better to provide safe, verbose instructions rather than quick ones.
 

mow4cash

Contributor
Joined
Jan 20, 2017
Messages
132
This question seems more like "trolling" than an actual inquiry.

As @tprelog mentioned, same end, different result.

This is simply a difference in navigation plus the "correct" way to perform functions and navigation within a jail.
To perform these steps externally (from the parent host) may not cause problems, but could eventually create confusion for more novice users.

In other words, it's usually better to show people how to do it the right way before providing shortcuts, and since we have no way of gaging everyone's experience level, it's usually better to provide safe, verbose instructions rather than quick ones.

It was not "trolling" but I can see how it could look that way. At first glance my command looks like it's missing something or not done correctly. Having two repositories and linking the files was confusing me with only a quick read.

Upon closer look these are differences I don't understand. When I run my command it seems to override the default in /etc/pkg so is disabling even needed? You also have "mirror type", "signature type", "fingerprints" , "enabled". Are there any repercussions for not having them in my command or is it just a better practice?

I switch a bunch of my jails over to the latest repo so I want to make sure I'm not doing something wrong that will cause problems down the road.
 

Husker619

Cadet
Joined
May 23, 2019
Messages
1
I followed these instructions exactly on 5-23-2019, and still works great with FreeNas 11.2 U4.1 This is exactly what I've been looking for. Mostly wanted to get a newer version of Plex Media Server for my newly created jail! Thank You! As of today I was able to get PMS-pass ver 1.15.5.994
 
Top