lainchan / Ω

Linux From Scratch & DIY Distros Thread

Miho Iwakura · 2022-10-18 10:42
Talk about your custom distro experiences, ask for advice and share tips with other lainons. I specifically made this thread to ask for advice regarding security build time flags. Do you bother adding them? Major distros make sure to enable security features such as SSP, PIE and RELRO, but smaller tinkerer distros like Slackware or even LFS itself don't use them as often.
Frank Garza · 2022-10-18 14:35
>>64550 >I specifically made this thread to ask for advice regarding security build time flags. Do you bother adding them? Yes. They add some mitigations for common programming errors in C and C++ software. >https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc >https://wiki.gentoo.org/wiki/GCC_optimization If you are new and want to try Gentoo, I recommend you install VirtualBox and create a VM. Follow the Gentoo Handbook (https://wiki.gentoo.org/wiki/Handbook:AMD64). It's step-by-step guide to installing Gentoo (and using the Portage package manager). If you want to add overlays (repositories) like the musl overlay, do not use Layman (it's deprecated). Use eselect-repository instead. Read this Gentoo Wiki page, if you want to use musl as your libc: https://wiki.gentoo.org/wiki/Project:Musl (also, I recommend masking everything in the musl overlay and then enable packages from it when you need to (when/if it fails to compile)). Currently my I have these configs in my make.conf #... # you may need to diable -fstack-protector-all or -fstack-clash-protection for some packages. # either remove them and trust that the developers of Gentoo will set good CFLAGS, # or use https://wiki.gentoo.org/wiki//etc/portage/package.env CFLAGS="-march=native -O2 -pipe -fno-plt -fstack-protector-all -fstack-clash-protection" CXXFLAGS="${CFLAGS}" FCFLAGS="${CFLAGS}" FFLAGS="${CFLAGS}" # using -pulseaudio will give you trouble if you want to use it. Instead enable it by removing the "-". # I recommend you globally disable dbus in your make.conf and enable it in package.use when needed. # The reason for __disabling__ dbus is that it can be used for GUI automation (among other things): # https://www.linuxjournal.com/article/10455 # Also, for most packages, adding dbus support is unnecessary bloat if you don't need it. USE="alsa X unicode verify-sig hardened ssp pie pic crypt ssl system-ssl secure-delete non_root \ -suid -ipv6 -nls -bindist -deprecated -telemetry -pulseaudio -systemd -dbus -bluetooth \ -policykit -kde -gnome -vala -introspection \ -sslv2 -sslv3 -tls-heartbeat -tls-compression" #vesa is good to have as a fallback! #New versions of VirtualBox also use vmware driver. VIDEO_CARDS="vmware vesa" INPUT_DEVICES="libinput" #you may want to have efi-64 here! GRUB_PLATFORMS="pc" #... t. emerging a Gentoo system from Hardened Musl OpenRC stage3 tarball. >LFS I don't think it's very feasible to use it as your daily driver because you have to maintain literally everything yourself. It's much better to instead use something like Gentoo, Slackware, Artix, Alpine, OpenBSD, etc. LFS is great learning experience, however.
Dujour · 2022-10-18 19:35
>>64553 Who's the Gentoo wage slave who thinks that every body just wants to use it or that it's the only/best available option? I fuarrrking hate the gentoo package manager and the fact that it is written in python. It also takes forever to install, that's how bloated it is. Plus, of all the "advanced" distros I've tried gentoo is the one that makes it the most difficult to install without providing much insight for all the loops it makes you jump through.
Shogun · 2022-10-19 04:44
>>64553 >I don't think it's very feasible to use it as your daily driver because you have to maintain literally everything yourself. I stopped using Gentoo because despite all the customization it has, it still felt restrictive. Building my own distro on the other hand is a lot of fun because of all the tinkering, and I had no issues so far running it as a daily driver. I'm currently in the process of overhauling a lot of core packages - which is what made me create this thread - and I'm only doing this because I want to. >>64554 The fact portage uses Python is not the problem - I think it's better to use bash for this - the problem is that portage and the entire system they use is just so overengineered and complicated. Why do they have an API for ./configure make make install It feels unnecessary. Anyway, I've been using CRUX's pkgutils to manage packages, and it's a great tool suite, but I kind of want to write my own package manager since: 1. Everything except for the package building utility is written in C++, which I don't know. 2. You have to use environment variables and empty files to use certain options, and there's no way to execute post-install hooks. I could patch this in myself, but eh. 3. No dependency tracking/resolving, which might seem useless for a custom distro with 1 user, but it'll be useful in case I need to bootstrap a new machine. Of course, that'd require me to modify my build scripts, so I'll finish with all the edits I'm doing now first.
Sabo Engle · 2022-10-19 07:14
>>64554 >Who's the Gentoo wage slave who thinks that every body just wants to use it or that it's the only/best available option? Gentoo is very flexible and it's maintained by a large team. Also, not everyone is the same person! And Gentoo is relevant to the topic in this thread. I have tried many distros and I think that out of all source-based distros, Gentoo is the best and most convenient to use (for example, you can set your USE flags in make.conf and override them in your package.use. This is more manageable than running make or ./configure by hand). Also, instead of just complaining, write why you don't like Gentoo and what you prefer to use (and why you prefer it). >gentoo package manager The only problem with Portage is that it's slow (because of Python) and that you need to learn Portage specific things. In *BSD you have Ports that just uses the standard *BSD tools. If that's what you want, by all means use a *BSD instead. >It also takes forever to install, That's not true. Only calculating dependencies is slow in Portage. >Plus, of all the "advanced" distros I've tried gentoo is the one that makes it the most difficult to install without providing much insight for all the loops it makes you jump through. Read the whole Gentoo Handbook. It tells you everything you need to know (it's literally a step-by-step guide!). Obviously, it's a good idea to read some additional wiki pages or man-pages. But the Handbook tells you everything you must know to use Gentoo and Portage. Here are some pointers: >https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/Portage (this is part of the Gentoo Handbook.) If you are interested in more in-depth info: >https://dev.gentoo.org/~zmedico/portage/doc/man/emerge.1.html >https://dev.gentoo.org/~zmedico/portage/doc/man/portage.5.html (lists important files and dirs. use this as a reference.) >https://wiki.gentoo.org/wiki/Portage >https://wiki.gentoo.org/wiki/USE_flag >https://wiki.gentoo.org/wiki/Ebuild_repository >https://wiki.gentoo.org/wiki/Useful_Portage_tools (I highly recommend installing eselect-repository, eix and gentoolkit!) >https://wiki.gentoo.org/wiki//etc/portage/patches (you can easily apply custom patches) >https://wiki.gentoo.org/wiki//etc/portage/package.env (you can very easily apply different CFLAGS on just 1 package) But you don't necessarily need to know all this. You can set your USE flags in your make.conf and/or package.use (which is all explained in the official Gentoo Handbook). But the point is that it's all documented in the man-pages AND the Gentoo wiki. Of course, you can also always ask for help in Gentoo Forums or IRC.
Hagbard Celine · 2022-10-19 09:17
>>64556 >Why do they have an API for Look at all the soykaf econf does (man 5 ebuild). Thank god we got an "API".