Port Firefox installation taking a very very long time

As mentioned earlier, I have some limited experience with Linux, but I'm very new to FreeBSD, so I probably don't have a good understanding of everything that is occurring on my screen.

I decided that I wanted to use the Ports method to install some drivers for my graphics hardware, but before I did that, I decided to test out how the Ports process works by installing Firefox as a test.

I started out by issuing the following command as su: # pkg install git

Next I used the below command to download the nessary files: # git clone https://git.FreeBSD.org/ports.git /usr/ports

At this point everything seemed to be proceeding correctly, so next I entered the below command to install Firefox:
cd /usr/ports/www/firefox/ && make install clean

Well, it has been almost eigtheen hours since I invoked the above command to install Firefox, and right now the information displayed in my terminal doesn't seem to indicate that this process is going to end at anytime soon. I'm assuming that this cannot be normal, so I tried using Ctrl+C to try and stop it, but that didn't have any visible effect.

Should I allow this to continue for a few more hours? What would happen if I simply close the terminal before this process is complete? If I interrupt this process will my system become unbootable? Would running fsck possibly fix it afterwards?
 
Freshport Firefox installation
Freshports is "just" a website. It's a website that provides lots of convenient information about FreeBSD ports and packages, but that's it, it provides information. It does not host or provide any ports or packages.


I started out by issuing the following command as su:
su(8) is a tool to 'substitute user', and you typically switch to the 'root' user. "su" is not a user, so running as 'su' is not the correct way of looking at it.
I decided to test out how the Ports process works by installing Firefox as a test.
As a test you start with one of the bigger builds? Maybe pick something 'simpler' as a test?

I'm assuming that this cannot be normal,
It is normal when you realize this also triggers building of all its (build, run and library) dependencies (if they aren't installed yet).
so I tried using Ctrl+C to try and stop it, but that didn't have any visible effect.
You've sent a ctrl-c to the process that was running at that time. It doesn't stop the entire process, just this one that happened to be active. Smash ctrl-c a couple of times and the entire process will quit.

What would happen if I simply close the terminal before this process is complete?
The building stops.

If I interrupt this process will my system become unbootable?
Firefox (or any of its dependencies) have nothing to do with the system booting, so no.

Would running fsck possibly fix it afterwards?
fsck(8) fixes (certain) filesystem errors. A build that's broken off doesn't create filesystem errors.
 
You've sent a ctrl-c to the process that was running at that time. It doesn't stop the entire process, just this one that happened to be active. Smash ctrl-c a couple of times and the entire process will quit.
Thanks for the above info. I'm thinking that at this point I will just let it run in order to see how long it takes to finish. Apparently I'm one of those people who has to learn everything the hard way.
 
Well, after about twenty-seven hours of continous information scrolling through my terminal, I reached the conclusion that Firefox wouldn't be finished anytime soon, so ended the process by tapping Ctrl+C until it stopped. Now I'm wondering how I can remove all of the junk files this failed attempt must have created?

(Update)
I removed about 1.3 GB worth of stuff under /usr/ports/distfiles/ and from what I can tell, that seems to be the only changes which were made during my attempt to install Firefox.

Also, I may have to face the fact that FreeBSD may be just a bit beyond my skill level, but I'm going to take one more stab at my original plan to use the Port method to install the drivers for my graphics hardware in a few more days. If that goes well, then I will try to move forward with putting FreeBSD onto my main desktop. However, if I cannot handle that, then it is probably time to swallow my pride and to raise the white flag.

I guess that this particular thread can be considered solved.
 
Remove the port work directory to clean the firefox build and 'make clean' cleans all dependent ports too.
Does it include the llvm dependendy of Firefox? That would explain the build time. Maybe just pkg install llvm??, in that case? Type make run-depends-list in the firefox port dir to see which version you need.
 
It might have installed a few dependancies as well, though, so just cleaning the ports might not have done the trick? Might need to look in /var/log/messages and see if you need to do any pkg delete commands.

Does FF pull in rust these days? That's another beast (alongside llvm).

I don't think this will teach you a lot, apart from maybe don't do it? I do not mean that rudely, it's just such a huge resource-intensive exercise; most likely in futility, and you end up with a messy system (in terms of a mix of ports & packages).

I don't think you can entirely get away from ports as you originally said, for the graphics drivers, but otherwise best avoided if you can (certainly for huge applications like Firefox.)
 
Firefox relies on a lot of prerequisites, such as rust, wasi-compiler (which itself relies on llvm16 from port), among a lot of other ports. These prerequisites, dependencies in FreeBSD lingo, are used to build firefox. And, they must be built and installed first before it even "thinks" of building firefox. If you're building from scratch the dozens of prerequisites must be first, then firefox. LLVM itself can take the better part of a day to build. Similarly rust. Finally firefox could take an hour or two, or three.

Just to illustrate this the firefox dependencies just needed to build, install, and run firefox is...

Code:
slippy# make all-depends-list | wc -l
     946
slippy#

946 prerequisite packages. On a brand new system this would take days.

Packages are the preferred approach. Even for those of us who do build our own -- i.e. I run 15-CURRENT and as a developer building my own makes most sense -- I build mine using pouidriere (ports-mgmt/poudriere) on a build server, letting it run for a few days, then pkg upgrade (or pkg install) on my own infrastructure. This BTW is how binary packages built by FreeBSD.org are built (on a cluster of multi-core machines).

Not to discourage you, try a simpler port. Try something like shells/bash or shells/zsh. Both will require many prerequisites but either will finish in a relatively short period of time.
 
Is there enough free RAM while compiling?
Depending on installed RAM some machines may use some swap space for active paging. It's not a big deal if a) this isn't a common everyday occurrence and b) the system is spending more time paging than doing real work (thrashing).
 
The other consideration is wear and tear of the machine. Even though I have a pretty beefy laptop (Intel i7) I build my ports and packages on one of my machines downstairs. The reason is, I used to build some ports on my previous laptop. The CPU fan bearing wore out creating a lot of noise. I had to replace it. (Also my wife's old laptop CPU fan wore out from day-to-day wear rendering the machine unbootable.) Replacing CPU fans in my machines downstairs is much simpler than pulling a laptop apart to replace some worn out component. And given the constant load I put on those machines I've yet to replace a CPU fan anyway. Just better parts in desktop/server machines.

Also in a previous laptop the keys in the keyboard just above the CPU stopped working. The constant heat produced by the CPU wore out the keyboard keys just above it. Sourcing a replacement keyboard was a bit of a job. This is why I avoid building ports or world on my laptop preferring to pkg upgrade from my poudriere server downstairs and installworld from an NFS share from another machine downstairs.

Laptops are not designed for constant heavy use.
 
Depending on installed RAM some machines may use some swap space for active paging. It's not a big deal if a) this isn't a common everyday occurrence and b) the system is spending more time paging than doing real work (thrashing).
The laptop I was using for this particular task has 8GB of RAM, with some portion of that also being used for graphics. Don't know if it matters, but I created a 4GB swap partition while installing FreeBSD onto this machine. Also, one of the reasons I decided to hit Ctrl+C was because it sounded like my laptop's harddrive had been running constantly for hours, without any end in sight. Well, that is how you learn I guess.
 
Next time you build something from ports, I recommend you to run # make install-missing-packages before you run # make. It will install all dependencies from binary packages, so only the particular port you want to build will be built from source, not the whole software stack.
 
The laptop I was using for this particular task has 8GB of RAM, with some portion of that also being used for graphics. Don't know if it matters, but I created a 4GB swap partition while installing FreeBSD onto this machine. Also, one of the reasons I decided to hit Ctrl+C was because it sounded like my laptop's harddrive had been running constantly for hours, without any end in sight. Well, that is how you learn I guess.
Swap required is a function of the application. Compiling large source files, as in firefox, chrome, llvm, and rust, will chew up a lot of virtual memory necessitating (let me be imprecise and incorrect with the next term) borrowing from swap.

It doesn't borrow from swap -- virtual memory on most operating systems uses the LRU algorithm -- but thinking it as such helps explain it. WRT swap the kernel only reacts to application needs (called working set).
 
Next time you build something from ports, I recommend you to run # make install-missing-packages before you run # make. It will install all dependencies from binary packages, so only the particular port you want to build will be built from source, not the whole software stack.
Thanks for the info. It appears that I have a lot to learn, and I probably should have done some more reading in the handbook before jumping in so blind. Begginers do it yourself complications I guess. At anyrate, I will try and take a break and do some more reading before I move forward. This is turning out to be a little different than I thought.
 
The laptop I was using for this particular task has 8GB of RAM, with some portion of that also being used for graphics. Don't know if it matters, but I created a 4GB swap partition while installing FreeBSD onto this machine. Also, one of the reasons I decided to hit Ctrl+C was because it sounded like my laptop's harddrive had been running constantly for hours, without any end in sight. Well, that is how you learn I guess.
Disable swap and try again.
 
A useful trick is to cd into /usr/ports and run
Code:
make search name=whatever
This will give you a list of b-deps (packages needed to build) and r-deps (packages needed to run) an application. For example, to give a relatively short one, dwm, a small window manager
It gives a few ports all containing dwm in the name, and includes the specific one, the window manager itself. It will give you an idea of how many ports you'll need to compile to install anything, such as firefox (which has a whole lot more of both b and r deps than dwm).
 
Disable swap and try again.
Then it will do oom-kill - which is not helpful in general during compile.
Building llvm on 8GB might work when limiting to only 2 threads. Building the entire fifrefox dependset in that way might then take about 40 hours.
 
  • Like
Reactions: cy@
Disable swap and try again.
Either that will fix my problem, or it will hopelessly break my system beyond repair. Eitherway, I'm very tempted to tinker with it, just because I like to cause problems with my own system. In all seriousness, I should probably learn more about what I'm doing before I try anything else.
 
Back
Top