Live data from Hacker News

Stali: A new static Linux distribution

sta.li

191–200 of 233 posts

Re: Stali: A new static Linux distribution

#191
post #49

Earlier quoted context omitted.

Many applications only use parts of libraries, then the linker can throw the unnecessary parts away.

How do I get it to do that? $ cat test.c #include int main() { printf("Hello, World!\n"); } $ gcc -o test1 test.c && ls -lgG test1 -rwxr-xr-x 1 6712 Sep 28 10:24 test1* $ gcc -static -o test1 test.c && ls -lgG test1 -rwxr-xr-x 1 800904 Sep 28 10:24 test1*

I always use dynamic linking but I thought it'd be fun to try making a small, static hello-world. The following assumes x86-64 Linux (and is a total hack that "works for me" NO WARRANTY!).

    $ cat test.c
    static int sys_write(int fd, const void *buf, unsigned long n)
    {
        asm("mov $1,%rax; syscall");
    }
    
    static void sys_exit(int status)
    {
        asm("mov $60,%rax; syscall");
    }
    
    void _start(void)
    {
        char s[] = "Hello, World\n";
        int r = sys_write(1, s, sizeof(s) - 1);
        sys_exit(r == -1 ? 1 : 0);
    }
    $ gcc -nostdlib -static -o test test.c && ls -lgG test
    -rwxr-xr-x 1 1480 Sep 28 11:47 test
More to the point of your question, if you want to see the effect you're looking for, I think you need to link to a libfoo.a library that includes some module.o that your program doesn't use.

Re: Stali: A new static Linux distribution

#192

Earlier quoted context omitted.

They built many. runit, s6, nosh, bsdinit, openrc. But yeah, it is being blamed for bloating init, because for one thing, cron isn't init's job. And that's just the start.

> cron isn't init's job. Which is why other platforms started moving from cron to init years ago? OS X: > Note: Although it is still supported, cron is not a recommended solution. It has been deprecated in favor of launchd. [1] Solaris: > cron has had a long reign as the arbiter of scheduled system tasks on Unix systems. However, it has some critical flaws that make its use somewhat fraught. [...] cron also lacks val…

Okay, so I got that one wrong. I still think it's a bad idea, but I did get that point wrong, true enough.

However, the other points I've made are still correct and accurate.

Re: Stali: A new static Linux distribution

#193

Earlier quoted context omitted.

That's a loaded question, and I'm only qualified to answer from my perspective and experience. My biggest gripe with it has always been that it is alpha-quality software, even today, that has a central role in an otherwise mature OS ecosystem. It has been widely adopted (some would say forced or tricked into adoption by a few distros) and therefore all the major Linux distributions are now running at an alpha level w…

Out of curiosity, what were you using to measure the speed of the various operating systems you mentioned?

For CLI stuff (compiling, file operations etc) it's the time command, for video decode/encode it's built into ffmpeg, and for graphical stuff it's mostly subjective. There's honestly not a ton of difference on most of the CLI stuff since the hardware is the same, but it is measurable. As for the DE, let's just say that Xfce under Slackware and OpenBSD is quick and peppy while Xfce under Debian-based distros is anything but. Ubuntu seemed to be the slowest for that test, and Elementary's Pantheon desktop is a mixed bag. I have considered running the Phoronix test suite for a more accurate result.

Also note that I did have to tweak OpenBSD a little to get it on par with Slackware on the desktop, though the stock install is still faster than the more "modern" Linuxen for most tasks.

And for those who wonder why I do all of this: It's a hobby. It's more fun than watching TV on my off days, and it keeps me up to date on the latest goings-on in the OS world.

Re: Stali: A new static Linux distribution

#194
post #189

Earlier quoted context omitted.

Ignoring the fact that this implies you have to be a programmer that knows how to read C to verify the integrity of the downloads, and that the lines of code in C often correlates directly to complexity of the solution being expressed, this also assumes that an attack vector would be something obvious upon reading the code, and not hidden as a subtle bug which is hard to spot.

> Ignoring the fact that this implies you have to be a programmer that knows how to read C to verify the integrity of the downloads Don't ignore it, that's the practically the point. This is the perfect example of "don't trust me, trust the code". From http://dwm.suckless.org/ > Because dwm is customized through editing its source code, it’s pointless to make binary packages of it. This keeps its userbase small and e…

> This is the perfect example of "don't trust me, trust the code".

But it's not that. It's "don't trust me, trust the code as long as you're part of the select group of people that can read and understand the code given the language we use, which by the way happens to be well known to be hard to vet for subtle logic errors, which because of the nature of the language often result in segfaults (at best), or remote code execution (at worst)." Why not write it in brainfuck? They'll only change their audience by a minuscule amount compared to the original audience they could have appealed to, and they will be even more "small and elitist".

I originally translated "This keeps its userbase small and elitist. No novices asking stupid questions." as "We're a tight knit group of assholes, and if you didn't take the same path in life we did there's no point in talking to you." It may be unfair to assume that's their intention, but I think it is fair to say that's what they are doing in practice.

Re: Stali: A new static Linux distribution

#195

Earlier quoted context omitted.

I take the attribution in the first link (references to "Führerbunker" and "Führer") to mean that the author is comparing Lennart Poettering to Hitler. That's not funny, it's just very, very inappropriate.

I didn't write the linked content, nor did I choose the links. If you feel strongly about this, consider contacting the authors of the story.

I didn't mean to imply that you did; sorry if that came out wrong.

Re: Stali: A new static Linux distribution

#196
post #25

Earlier quoted context omitted.

> Since when were politicians even comparable to programs? Since people learned the power of the metaphor. > Do we "elect" a init system For some distros? Sure. By its nature, Linux, GNU and the open source software that goes into the ecosystem allows people to create new distributions, or choose one of the many that exist. This choice is, in some small way, like a vote. If systemd was really that bad, enough people…

I do retract my complaint about comparing politicians to programs. In its place, I complain about the process of electing a President being different from voting on an init system. The most important point here is that distributions vote on which init system they elect. We are not all electing one init system to rule them all, across Linux. Distributions are nation-states of varying size that follow similar but somet…

All metaphors and similes are leaky. The point is to focus on the ways it works and doesn't work, because each has the possibility to expand your thinking on a topic. The original comparison could have only worked in a singular facet, yet that would still make it a valid, correct and possibly useful simile. Here you've expanded on some ways the two things are different, which is also generally the point of using an analogy, in that it promotes that thinking as well.

> You can't fork the US or an individual state in the same way you can download a different distro to your Raspberry Pi.

Well, you can (in that you can fork the rules and structures), it's just finding the resources (people and location) to make use of this new government is hard, because we are currently resource constrained. In the past, when land was plentiful, this happened. It happened to some extent with the Pilgrims (although it mostly a separation from the prior church, not the government, although I don't doubt it was also viewed as a partial separation from the government due to the distances involved). If we start colonizing Mars at some point, I'm pretty sure there will be some more separatist movements and forking of governments.

Another way to look at this is that you can fork the government right now, you just can't supercede the rights of the current government you are part of. To follow the resource and forking metaphor, you can virtualize governments to your heart's content, but in cases where your rules conflict with the host government, you can emulate the result but you can't enforce it. That is, Ring 0 doesn't care what you think you can do, the rules are the rules.

Re: Stali: A new static Linux distribution

#197
post #155

Earlier quoted context omitted.

My Windows system currently has 21 copies of zlib1.dll on it, each shipped by a different program. While I have no doubt that Windows programmers have heard of DLLs, they clearly haven't grasped the idea of shared libraries.

The problem in that case is developers not putting their DLLs in a system directory! Windows will use WinSXS to avoid problems with different versions (DLL hell). Once loaded into memory, DLLs save loading the same code twice. See http://www.ksyash.com/2011/01/dll-internals/

But no one uses them like that any more. Because we remember back when people dropped all kinds of shit into system directories, and the result was awful.

Re: Stali: A new static Linux distribution

#198

"FHS sucks" - and then they make an even worse hierarchy. at least modern distros moved all distro-contents to a single /usr (possibly read-only, snapshoted, etc) mount point. #suckmore

I don't know what a good hierarchy is, but with symlinks it should not be so important where the mountpoints are. So why not keep opportunities to split distro contents into convenient directories living under "/"? Also separating writable from read-only content, or having volumes with different performance characteristics, makes sense in certain situations. Why not have these mountpoints directly under "/"?

When distro-packaged content is in /bin and /sbin (and /lib, /usr etc), you can't easily have those 4 directories in a single image that you can atomically handle (upgrade, snapshot, mount, share, etc) and you must have them together on the /.

That's why Android has /system, and Linux has /usr now. (https://www.freedesktop.org/wiki/Software/systemd/TheCaseFor...).

Ideally, and we are getting there, / should be tmpfs/rootfs, it's populated with the needed structure by the initramfs, the distro is mounted on /usr (readonly squashfs perhaps?), user data is /home, system data is /var, configuration is /etc. And the system should boot with empty /home /var and /etc ideally. Soon...

Re: Stali: A new static Linux distribution

#199
post #191

Earlier quoted context omitted.

How do I get it to do that? $ cat test.c #include int main() { printf("Hello, World!\n"); } $ gcc -o test1 test.c && ls -lgG test1 -rwxr-xr-x 1 6712 Sep 28 10:24 test1* $ gcc -static -o test1 test.c && ls -lgG test1 -rwxr-xr-x 1 800904 Sep 28 10:24 test1*

I always use dynamic linking but I thought it'd be fun to try making a small, static hello-world. The following assumes x86-64 Linux (and is a total hack that "works for me" NO WARRANTY!). $ cat test.c static int sys_write(int fd, const void *buf, unsigned long n) { asm("mov $1,%rax; syscall"); } static void sys_exit(int status) { asm("mov $60,%rax; syscall"); } void _start(void) { char s[] = "Hello, World\n"; int r…

I like this one even better:

    $ cat test.c
    void _start(void)
    {
        __asm__(
            "movabsq $6278066737626506568,%rax\n\t"
            "movq %rax,-32(%rsp)\n\t"
            "movl $1684828783,-24(%rsp)\n\t"
            "movw $10,-20(%rsp)\n\t"
            "movq $1,%rax\n\t"
            "movq $1,%rdi\n\t"
            "leaq -32(%rsp),%rsi\n\t"
            "movq $13,%rdx\n\t"
            "syscall\n\t"
            "movq $60,%rax\n\t"
            "movq $0,%rdi\n\t"
            "syscall");
    }
    $ gcc -nostdlib -static -Os -o test test.c && strip test && ls -lgG test
    -rwxr-xr-x 1 864 Sep 28 14:22 test
864 bytes! :)

Re: Stali: A new static Linux distribution

#200
post #144

Earlier quoted context omitted.

That's a loaded question, and I'm only qualified to answer from my perspective and experience. My biggest gripe with it has always been that it is alpha-quality software, even today, that has a central role in an otherwise mature OS ecosystem. It has been widely adopted (some would say forced or tricked into adoption by a few distros) and therefore all the major Linux distributions are now running at an alpha level w…

Boo hoo, systemd makes users happy, works perfectly, easy to configure, I love it on my ArchLinux server, etc etc, but it's NOT THE UNIX WAY SO IT SUCKS AND WE MUST KILL IT WITH FIRE. Who knew - UNIX way is outdated and shit, so doing something like systemd makes Linux a better OS. Screw unix way init systems, and screw unix way /usr/bin, /usr/local/bin, /bin, /sbin and any other bin folders scattered everywhere, it'…

Please don't post like this here. We ask that you comment civilly and substantively or not at all.
Post reply on HN