How to compile stuff for jail?

Status
Not open for further replies.

rocktheroad

Dabbler
Joined
Nov 14, 2011
Messages
11
I went for safe route of adding applications to FreeNAS 8. I have managed to create jail, and install transmission and it works. There was plenty of tutorials here, and they were helpful.

However I have discovered that I've got very old build 2.13, which miss some of stuff more recent versions have. I see that there is 2.41 version (http://www.freshports.org/net-p2p/transmission/), but pkg_add gives me 2.13.

I've tried to change environment variable to point to another location where pkg_add search for packages, without much success. So I guess I have to compile that somehow?

Earlier I've tried to use LCDProc to fire up LCD display, but default version don't have lcdusb driver which also needs to be compiled. When I obtained driver source and tried to compile it within jail I got error that I don't have sources trees.

Am I going in right direction? How I can get sources for jailed instance? How I can get latest version of transmission and add LCDProc & imon lcdusb driver?
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Hello Rocktheroad,

A jail is similar in many way to a real installation, so if you search for a guide, you should be able to compile stuff inside the jail.

The problem you'll have with LCDProc is that you can't install drivers inside a jail, they need to be installed on the host system. One you get it compile, you can mount -uw / on the host system and install your driver, just be aware it will get overwritten during an upgrade of FreeNAS.

If you download the package for transmission to a folder in your jail (using a browser on your pc and copying it inside your jail), then you should be able to do pkg_add filename. I'm not sure how the dependencies will get loaded, but I know you can install it like that.

Hope that helps.
 

rocktheroad

Dabbler
Joined
Nov 14, 2011
Messages
11
OK, just to make clear, in order to compile something, I should focus on FreeNAS host instead jail? Is there way to make things compile somewhere else, my laptop or desktop? Is it possible to make some kind of off-site environment to compile things? I made just one change to original FreeNas, in order to start jail. I would like to make minimum changes to FreeNAS to make it easily upgradeable.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Is there way to make things compile somewhere else, my laptop or desktop? Is it possible to make some kind of off-site environment to compile things?

You can use VMware and install FreeBSD 8.2. You need to make sure the architecture of your build system is the same as your target system (FreeNAS system)(i386 or AMD64). I have a VMware system for both architectures, but right now they're loaded with source and it wouldn't be practical for me to upload them for you as they are quite large.


OK, just to make clear, in order to compile something, I should focus on FreeNAS host instead jail?
You could compile stuff for FreeNAS inside a jail, but yes, the target (the result of your compiling) will be installed on FreeNAS.

Its not really that hard to build FreeNAS once you've done it a couple of times, but be warned, it can take a long time. I have a Core i5 with 8GB of RAM and it takes somewhere between 6-8 hours.

Keep a list of changes you make to FreeNAS and write a cron script to backup what you change. There really shouldn't be that much, I have only 3 or 4 files I copy before upgrading.
 

rocktheroad

Dabbler
Joined
Nov 14, 2011
Messages
11
Sorry for NOOB questions, not just about FreeNAS, but for FreeBSD in general.

If I go that way to make VM machine (amd64) and install FreeBSD with complete sources to be able to compile things, can I just use that for compilation of drivers needed for FreeNAS? Or I have to compile whole FreeNAS, rebuild kernel and deploy whole that package over existing FreeNAS OS?

I just need to compile and install driver in FreeNAS and compile latest transmission. I though that is simple by placing compiled things on existing working NAS and editing some boot info.

Thanks for patience.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
If I go that way to make VM machine (amd64) and install FreeBSD with complete sources to be able to compile things, can I just use that for compilation of drivers needed for FreeNAS?

You can just compile the part you need, the driver for example, and just copy that to your running FreeNAS system. If you build a VM with AMD64 version 8.2 of FreeBSD, you can build for either i386 or x64(amd64), but not the other way. The i386 version of FreeBSD can't build for amd64. There's a post from one of the developers about that, and a link in the FAQ about cross compiling.

If you follow the directions in the HowTo section about building the kernel, you won't need to worry about which/how to download the correct sources, the build script for FreeNAS grabs the ones it need automatically.

So probably the easiest way to start is to get an ISO image of FreeBSD 8.2 (amd64, if you have a 64bit system), create a VMware system, install the CD, update the installation (I don't mean to version 9 or anything, just whatever updates there are for 8.2), create another virtual disk ~8GB and mount it at /usr/local/freenas, that will give you room for the sources and compiling, and off you go. I wouldn't get fancy with the FreeBSD installation and install x11 or desktop and all that, just stick with the command line.
 

rocktheroad

Dabbler
Joined
Nov 14, 2011
Messages
11
I've started with easier route. I have created VMware image with same architecture (amd64), booted from cd.iso version and I've got full version of FreeBSD. I have updated all ports and I was ready for the first task to compile Transmission.

I wanted to have just transmission daemon 2.41 compiled, so I went to /usr/ports/net-p2p/transmission-daemon and compiled with "make install clean". Than I realized that I need to make package, as I had no idea what to do with installation. I discovered that "make package" is way to go, but on the end it didn't do a job as it had just transmission-daemon without dependencies. Than I found examples of running:

Code:
make config-recursive
make package-recursive


but it didn't help a lot, there was few missing packages:
1) transmission-web.2.41
2) libevent2-2.0.16
3) libiconv-1.13.1_1

then I found another example:

Code:
make clean
make deinstall
make depends		
make install
make package-recursive


with same results. So I had to manually install missing libraries with pkg_add.

I found missing libraries already compiled in appropriate ports folders in VMware machine. Finally transmission installed, but... two libraries were older. So I had to remove them, and all libraries dependent on them (ca_root_nss-3.12.11_1 , curl-7.21.3_2 ), and then add again same newer libraries from VMware build.

And it finally was installed. But... there has to be easier way to compile and make package with all dependencies within. I am tempted to give up on whole thing, as this is so frustrating. I have to write all steps down, so I can have that ready when new version of transmission came up.

Before trying to do same thing for LCDProc, drivers for LCD display, etc.. does anyone has any hint what I am doing wrong.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
You can use pkg_add -rv <package name> That will download, and install the package and it's dependencies, no compiling...

LCDproc *might* be pre-compiled, you'd need to check the FreeBSD ports list (just search for freebsd ports and you can search by package name from the main page)

I haven't compiled any packages like you are trying to do, just the OS.
 

rocktheroad

Dabbler
Joined
Nov 14, 2011
Messages
11
OK, I've managed to make more suitable setup. Instead of having jail instance with FreeBSD base build, I have added source tree to that build with csup, and I got ports sources so I am able to compile stuff inside jail. That works better than having plain base installation, and make compilation on full FreeBSD build in VMware image. I don't care much about jail size, as I have separate HDD where jail is mounted.

Right now I have setup that I am pleased with. FreeNAS 8 on USB stick, jail with FreeBSD base+sources instance on zfs HDD volume, and 4 HDD in ZFS raidz volume.

I have compiled new Transmission 2.41, installed Sick-Beard branch for torrents, everything under jail. All what is changed in FreeNAS is to make jail visible. And everything is running smooth, TV shows are monitored with Sick-Beard, downloaded with Transmission, renamed, sorted, moved and archived to raidz. Mostly raidz is in sleep mode, as it is woken up just when something is fully downloaded.

One thing I would like to add is to put "working" HDD where jail reside in sleep mode as well, when not used. I am not sure is it possible, as I have done what I could with GUI enabling that HDD to enter sleep after 30 min of inactivity. But it seems that FreeBSD instance in jail is preventing sleep mode. Is there way to find out what keeps that drive active?

And I didn't had luck with driver compilation. Driver for imon LCD is made for 5-6 FreebSD versions, it doesn't compile at all for 8 :(
 
Status
Not open for further replies.
Top