godarch / darch

A tool for building and booting stateless and immutable images, bare metal.
https://godarch.com/
MIT License
832 stars 32 forks source link

AUR - how the hell? #43

Open phunni opened 4 years ago

phunni commented 4 years ago

Having now managed to get a basic build running I'm now trying to work on some further images intended for other computers, but I'm banging my head against a brick wall when it comes to aur packages. I don't really care too much about build times, so I don't want to bother with maintaining and hosting my own pacman repository, but, whenever I try and build a packge in a script, I run into the issue that trizen/makepkg cannot be run as root, but pacman must be. I have pacman enabled via sudo, but, because the script itself is run as root, this then causes other issues. Is anyone else building packages during image builds? How do you handle it?

pauldotknopf commented 4 years ago

Ah, yes, the makepkg issue. They added that after Darch was built, which annoys the shit out of me.

When I was doing Arch builds, I had to run a makepkg.patch file against /usr/bin/makepkg to just remove the check for root. It's harmless.

Check this: https://github.com/pauldotknopf/darch-recipes/commit/2945b2d61c797fd86b9b14c786c0067943fa369c#diff-844c94b0e5d70e755e1d75768823c931

pauldotknopf commented 4 years ago

Also this: https://gist.github.com/pauldotknopf/ff8e986225ab2f264acea1a5bb0c6c5a

phunni commented 4 years ago

Looks like there's been a quite a few changes to makepkg since this - the patch won'y apply as is. Sigh - this is so much harder/more work than it should be - they really should provide an option to allow running as root...

I did try and get trizen to build the package and then install it via pacman, but that just caused other headaches due to write permissions problems among other things...

phunni commented 4 years ago

Might have got it working with a super simple patch that just removes the root check. It's running now and it certainly runs as root, so, unless there are some build implications I'm unaware of, it's looking good.

pauldotknopf commented 4 years ago

they really should provide an option to allow running as root...

Absolutely. I suggested to make it overridable via environment variables, and the maintainers basically said fuck you.

I really hate the Arch community and their collective attitude.

I recommend Ubuntu! :)

phunni commented 4 years ago

Ubuntu would certainly be easier, but it makes too many choices for me that I don't like. That's what I love about Arch - I can set up the system pretty much exactly how I want it. Except when it comes to building things as root apparently... :-/

phunni commented 4 years ago

It seems that whatever I've did to makepkg (literally just removed the root check - or so I thought...) has now caused damage to my system. To be fair, they did warn me... :-( I'm going to reopen this because, even if I never get past it, it's still likely to affect other users. Really frustrated - just about ready to give up with darch. It's a brilliant tool and I really want to have all my systems based on immutable, stateless images, but it's proving too difficult if I also want arch. Which I do. /me sobs quietly into his drink...

pauldotknopf commented 4 years ago

Details on what happened?

phunni commented 4 years ago

I started getting issues with files no longer owned by packages ( which then caused problems with installing/upgrading packages because the files were already there...), or files not being found that should've been. All the problems went away as soon as I booted an image - which you'd expect, but they started to appear again when I ran trizen - which in turn ran my patched makepkg. So, presumably, if I used a vanilla makepkg then I wouldn't have these problems, but then I'd be right back to square one with the issues with makepkg and root...

pauldotknopf commented 4 years ago

Another option is to create a dummy user to build the packages in Darch, using gosu or something.

phunni commented 4 years ago

You can see the script I'm using for the commonly used "common"here
Running makepkg as nobody is what the arch wiki recommends - directing you to this page - which is where I got some of my script from. I'm now failing with

==> ERROR: You do not have write permission for the directory $BUILDDIR (/).

which is completely baffling me - why on earth is the BUILDDIR being set to /? nobody definitely has write permissions on /home/build/trizen

I'm sure this is much harder than it needs to be...

pauldotknopf commented 4 years ago

Lol.

Just use Ubuntu and never have a problem again! ;)

phunni commented 4 years ago

And never have my system how I like it again either 😜

pauldotknopf commented 4 years ago

Honestly, out of curiosity, I'd love to see a detailed breakdown of what customizations you can do in arch that you can't do in Ubuntu.

shadowrylander commented 4 years ago

Ubuntu with Bedrock Linux? 😹

phunni commented 4 years ago

As far as I'm aware Ubuntu won't ever give me a super basic setup after the installation and will always try and install a bunch of packages I don't want.

pauldotknopf commented 4 years ago

Ubuntu will only install a bunch of packages when you install ubuntu-desktop.

You can blacklist then though, like I do here: https://github.com/pauldotknopf/darch-recipes/blob/master/recipes/desktop/blacklist-packages