You are not logged in.

#1 2005-07-10 02:40:49

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Is fakeroot necessary when using makepkg?

I've searched for all the posts here regarding the command fakeroot, and have a couple of questions.  I guess I'm not real clear on what the purpose of fakeroot is...from the sticky page makepkg/abs tutorial, I followed the directions to set up a group named abs, then set the ownership of the /var/abs/local directory to the group and chmoded it to 755.  Then added myself into the abs group and went on my way.  The only documentation I've read that says more than simply "You'll need fakeroot!" was the new stuff that Dibble is working on.  I had always assumed that since there was a setting under the makepkg config file to use fakeroot, that it was all done automatically.

For the package I made, there wasn't any issue when I used makepkg (but thinking about it now, it was a Java package that didn't need compiling).  I'm away from my Arch box right now, so I can't try it out, but is the point of fakeroot to allow compiling?   The abs group already has all the rights it needs in the /var/abs/local directory, so that shouldn't be the driving force.  Will I get an error if I'm a normal user (not using fakeroot) and I try to run makepkg on a non-Java package, even though I'm in the abs group?

Sorry if I'm a bit retarded with all of these questions, but perhaps, since I have a newbie perspective, I'll write up a bunch of concrete example pages for the new wiki on how to do a lot of these things (once I figure them out for myself, that is).   big_smile Thanks in advance!

Offline

#2 2005-07-10 02:51:43

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Is fakeroot necessary when using makepkg?

I believe fakeroot just allows proper root ownerships when making the package. If fakeroot is not installed and the package is made, it could result in non-root ownership, which would be bad.

Offline

#3 2005-07-10 03:13:02

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Is fakeroot necessary when using makepkg?

close.

Fakeroot allows you to build as a normal user with root permissions. The reason this is a good thing in building packages is that it prevents the package from accidentally writing something to the root filesystem.

For example, if you screwed up the PKGBUILD and it installed to /usr/bin instead of $startdir/usr/bin, then files would be installed to /usr/bin when you ran makepkg if you ran it as root. If you ran it as a user in fakeroot, you would get an error.

That's a blatant example, but there are many subtler reasons as well.

Dusty

Offline

#4 2005-07-10 03:31:12

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Is fakeroot necessary when using makepkg?

ah, I was wondering about that. Thanks for the clarification Dusty smile

Offline

#5 2005-07-10 04:36:16

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: Is fakeroot necessary when using makepkg?

fakeroot is a very good thing ... unless you want lots of schwunt on your drive accidentally. It can even help alert you to a buggered build which makepkg would otherwise not notice.

Once you have the bugs out of your builds it is not really needed.


AKA uknowme

I am not your friend

Offline

#6 2005-07-10 09:26:46

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Is fakeroot necessary when using makepkg?

my docs don't say you must use it - just that you should use it - cos you should really - it's good sense

Offline

#7 2005-07-11 00:47:47

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Is fakeroot necessary when using makepkg?

I've messed around with things a bit and am starting to get it.  The doc I was refering to was the new AUR User Guidelines, that states:

It is suggested you use fakeroot to build pkgs so having manually confirmed the integrity of the files run fakeroot and then run makepkg, the source files will be downloaded, verified and built as normal

When actually, it looks like you never actually have to run the fakeroot command on the CLI when doing makepkg...it's taken care of automatically, as long as the option is set in the makepkg.conf file (which I believe it is by default).  The first line shown when I run makepkg is:

==> Entering fakeroot environment

So, the documentation should just say: "If you want to build packages as a normal user (which is the preferred method for security reasons), make sure to install fakeroot beforehand, and then you will be able run makepkg without problems..." or something along those lines.

Offline

#8 2005-07-11 02:52:06

max_sipos
Member
From: Ithaca, NY
Registered: 2004-10-31
Posts: 106
Website

Re: Is fakeroot necessary when using makepkg?

I'd *really* recommend using fakeroot, especially if you are going to post your PKGBUILD to AUR, I've seen at least 1 package which was completely borked up, installing everywhere around the system except in $startdir/pkg...
if the packager had used fakeroot, this problem wouldn't happen, now all users who download the PKGBUILD from AUR will "mess up" their otherwise clean systems. (I've notified the packager and he has updated the package since)

Offline

#9 2005-07-11 03:48:07

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Is fakeroot necessary when using makepkg?

Does anybody know if fakeroot is invoked if you run makepkg as root anyway? I was told to run makepkg as a normal user. Tried that and makepkg said that really sucks cause fakeroot wasn't installed... so I installed it, and I always run makepkg as a normal user.

Dusty

Offline

#10 2005-07-11 04:10:42

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Is fakeroot necessary when using makepkg?

Dusty wrote:

Does anybody know if fakeroot is invoked if you run makepkg as root anyway? I was told to run makepkg as a normal user. Tried that and makepkg said that really sucks cause fakeroot wasn't installed... so I installed it, and I always run makepkg as a normal user.

Dusty

Looking at the code it appears not. It checks for the user id and if not 0 (root) it uses fakeroot else continues on as normal.

Offline

#11 2005-07-11 07:39:58

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Is fakeroot necessary when using makepkg?

i always build stuff as root and could never figure out why fakeroot wouldn't work - now i try to remember to build as a user

dog - that is a good point about the docs - i'll do that

Offline

#12 2005-07-11 09:29:25

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Is fakeroot necessary when using makepkg?

OK - i added some more about fakeroot - how's that now?

Offline

#13 2005-07-11 20:56:19

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Is fakeroot necessary when using makepkg?

It's looking great Dibble...you are missing an 's' on "unless" and some more puncutation could make it a bit clearer, but it's a huge improvement!

Offline

Board footer

Powered by FluxBB