
Modern Linux in an ancient PC - yeokm1
http://yeokhengmeng.com/2018/01/make-the-486-great-again/
======
icefox
When build stuff on a real slow platform a trick I have used is to setup
distcc on the slow computer and at least one real fast computer with a
compiler set to the slow computer's arch. Set the slow computer distcc to 0 so
it compiles nothing locally, but it does do the configure/linking/etc. This
avoids almost all the cross compilation issues you might run into while
getting many of the fast benefits.

~~~
cesarb
Isn't linking the step which needs the most memory?

~~~
rhaps0dy
Yes, but you can't easily avoid doing linking in the local machine, because
the output of linking depends on what system libraries there currently are.
Also, it doesn't need _that_ much memory. You're still doing all the CPU-
intensive parts on the powerful machine, thus saving time and likely keeping
the non-powerful machine from overheating.

------
badsectoracula
This is neat, i think i have a laptop with a 486 somewhere around here so i
might try this at some point. The only trouble is that said laptop only has
infrared for I/O (not even floppy) :-P. Also i have one with a Pentium
although that is a bit faster, obviously.

However i wonder if it would be faster if you went with a Linux From Scratch-
like approach and used some lightweight init system and only installed minimal
stuff - perhaps replacing the some of the more heavyweight GNU tools with
alternatives from suckless [1].

[1] [https://core.suckless.org/](https://core.suckless.org/)

~~~
djsumdog
I'd recommend trying to cross-compile the binaries on another machine to save
your sanity.

I built an LFS back around 2002 when I was in University and used it for over
a semester and a half. It made me appreciate package management. :-P

I use Gentoo myself these days, which is pretty much LFS + package management.

~~~
badsectoracula
Yes, i forgot to mention that the build should be done from a more powerful
system :-).

------
danieldk
I wonder how well a BSD, such as OpenBSD runs, since they have supported more
ancient architectures. I remember having a quite low-end 486 laptop in ~2000.
Linux was pretty much unusable, but OpenBSD ran great on the hardware.

~~~
yeokm1
I don't mind giving this a shot once I have the time for it! :)

~~~
krylon
Please do!

------
chrissnell
I was confused about the 11-minute bootup--my old 486/66 running Slackware
took maybe 3-4 minutes to boot in 1994--but then I watched the video: it's
everything that we've added to Linux systems since 1994 that makes the startup
slow. It's mostly post-kernel services and tasks that are slowing things down
on this old PC. I wonder if he could speed things up further by removing some
of the modern conveniences and going back to a basic system that didn't run
much beyond inetd, getty, and crond.

~~~
yeokm1
With Gentoo, it is possible to reduce the startup services I guess. I just ran
with the default configuration suggested by the Handbook.

~~~
exikyut
I note that the INIT line appears 30 seconds after decompression.

Ultimately you don't really need anything initialized to have a working
system.

------
aninteger
Great work! I love this. Unfortunately, "Science projects" like this are the
first thing you have give up when you're married with children.

~~~
moron4hire
I've not found my two kids and wife to be such a burden on me. What I can't do
is watch television all night, or go out drinking all night. But productive
stuff, that's pretty easy to fit in.

------
yeokm1
You can see the video demo:
[https://www.youtube.com/watch?v=4qSziR6sD8Q](https://www.youtube.com/watch?v=4qSziR6sD8Q)

Detailed install instructions: [https://github.com/yeokm1/gentoo-
on-486](https://github.com/yeokm1/gentoo-on-486)

~~~
ValentineC
Not the OP, but here's their hackathon presentation as well:
[https://www.youtube.com/watch?v=w-RN0EkxWxA](https://www.youtube.com/watch?v=w-RN0EkxWxA)

(Disclosure: I'm one of the organisers.)

~~~
yeokm1
Have to mention this blog post is extended work based on knowledge gained from
that hackathon

------
Cyphase
Just yesterday I installed Lubuntu 17.10 on an old Athlon XP computer. Firefox
kept crashing, so I did a bit of research; turned out it was because the CPU
doesn't support SSE2. Turns out most browsers these days require SSE2 (not
that I blame them). The only modern-ish looking browser that's worked so far
is NetSurf[0], but lots of sites have issues with it.

[0] [http://www.netsurf-browser.org/](http://www.netsurf-browser.org/)

~~~
mmsimanga
I have been down a similar path. I have an old HP laptop that used to run
Windows XP. Its about 2005 model and has 1G of RAM. LXDE is only desktop that
will give reasonable performance. Despite claims at being light I found Xfce
based desktops slowed computer to a crawl.

The second thing I found was that all modern browsers literally consumed all
resources on the computer making laptop unusable. I tried Netsurf which was
fine on sites on which it worked. In the end I have found is best to use text
based browsers. I use links2.

------
edent
OMG! I stopped into Super Silly when I was in SG a few weeks ago (I was there
with Kai) and wondered what you were doing with that ancient kit. What a
brilliant idea.

~~~
yeokm1
Thanks! You have to thank my teammate Hui Jing for that too

------
yincrash
I wonder how much of the slowness is due to disk swapping since the RAM
capacity is so low.

~~~
icedchai
For the era, 64 megs was considered incredible.

For comparison, my first Linux box (a 386SX, 20 mhz) had only 4 megs of RAM.

~~~
yeokm1
My first 486DX PC also only had 8MB of RAM until my parents through it out
when I was a kid. I was personally shocked as well when I saw that this 486 PC
had 64MB.

~~~
u801e
The 486 computer I had back in 1992 could support up 16 MB of memory IIRC. It
was clocked at 25 MHz, but I did get the math-coprocessor and upgraded it to a
DX4 75 Mhz. I knew of some models that could support up to 32 MB of RAM, but I
wasn't aware of any that would support 64 MB of RAM (which was quite expensive
at the time).

------
spapas82
I remember running slackware 3.6 on an 8 mb ram 486 dx 100 (100 was the cpu
mhz) before ~ 20 years. The linux kernel was 2.0.36 or something like that.

Everything run great back then!

------
anthk_
NetBSD could run much better.

~~~
martin1975
So could MS-DOS ;)

~~~
anthk_
But MS-DOS just brings fun, boring fun with FreeDOS and ScummVM adventures:D
NetBSD gives you Cataclysm DDA over SSH.

------
yeokm1
I rebooted my server but it seems like crash again. Let me adjust adjust my
Digital Ocean droplet.

~~~
jjoe
Do you often find yourself having to adjust capacity when under traffic
spikes? Would be happy to help smooth out the traffic using off server caching
( see [https://www.cachoid.com](https://www.cachoid.com) ). Fremium plan would
work well. Feel free to email me joe@

------
ce4
The demo is complete. Get rickrolled at 17mins :)

------
jhallenworld
Wow it's a lot slower now than it is with 1992 Linux. I remember a key
benchmark was how long it takes to compile the kernel (and was astonished at
how fast Pentium-Pro was when it came out).

~~~
srett
Out of curiosity I recently installed Debian Stretch on my Pentium Pro 200
(dual CPU). The text based installer warned that my 128MB of RAM wouldn't be
enough for it to finish, but luckily it still succeeded. The system boots
within a minute or so and is fairly usable. Running X on s3fb with i3 as the
WM, the selection of usable GUI programs is rather limited then admittedly.
Still, I guess we really came a long way from 486 to PPro. :-)

~~~
kbutler
I had a stack of ~25 floppies that I used to download linux with X and some
programs to run on a 486.

Software has gotten much bigger...

------
dmitrygr
Finally an inter PC safe from Meltdown and Spectre. About time.

~~~
exikyut
The 486 has both branch prediction and a cache, but I'm not sure if it's
vulnerable.

Reference:
[https://gist.github.com/ErikAugust/724d4a969fb2c6ae1bbd7b2a9...](https://gist.github.com/ErikAugust/724d4a969fb2c6ae1bbd7b2a9e3d4bb6#gistcomment-2311162)

Potential patch:
[https://gist.github.com/ErikAugust/724d4a969fb2c6ae1bbd7b2a9...](https://gist.github.com/ErikAugust/724d4a969fb2c6ae1bbd7b2a9e3d4bb6#gistcomment-2311156)

~~~
yeokm1
I just Googled to double check. The 486 does NOT have branch prediction.

Source 1:
[https://books.google.com.sg/books?id=MLJClvCYh34C&pg=PA122&l...](https://books.google.com.sg/books?id=MLJClvCYh34C&pg=PA122&lpg=PA122&dq=486+branch+prediction&source=bl&ots=gcMvZFz2Pz&sig=FJ9fEmH426N7eoHxLupu5x2ZrdQ&hl=en&sa=X&ved=0ahUKEwi7k5aCucXYAhUHQY8KHcgACkUQ6AEILjAB#v=onepage&q=486%20branch%20prediction&f=false)

Source 2:
[https://books.google.com.sg/books?id=QzsEAAAAMBAJ&pg=PA59&lp...](https://books.google.com.sg/books?id=QzsEAAAAMBAJ&pg=PA59&lpg=PA59&dq=486+branch+prediction&source=bl&ots=LCXnhUpS83&sig=g59BBBuiCx-
qM6bOjRW5mkq1Nug&hl=en&sa=X&ved=0ahUKEwi7k5aCucXYAhUHQY8KHcgACkUQ6AEIPDAD#v=onepage&q=486%20branch%20prediction&f=false)

~~~
exikyut
Wow. So the 486 cores used for the Intel ME are completely Spectre-resistant.

That is hilarious.

------
vermaden
I always wonder ... why 'waste' so much time with cross-compiling #Linux when
#FreeBSD [1] supports such 486 computer out of the box along with binary
packages even in latest to date 11.1-RELEASE version?

[1]
[https://www.freebsd.org/releases/11.1R/announce.html](https://www.freebsd.org/releases/11.1R/announce.html)

------
AzzieElbab
It is not like pc unixes ran blazingly fast or were terribly useful back in
the days of 486. Solaris and sunos/386 were probably least stable, followed by
next(not x86) and netbsd. They may have seen fine to play around with but
would crash horribly under any heavy use like cad or mathematica

------
burlesona
Wow. This is a LOT of effort to play around with old hardware and OSes, but
it’s interesting to see that it’s possible. “Science Project,” indeed!

~~~
yeokm1
Haha. I spent several weeks of sleepless nights on this :)

------
notaplumber
This is kinda funny, because you can still install OpenBSD/NetBSD on a 486
machine today using their floppy installers.

------
FullyFunctional
This is neat and I have some older systems (like the Transmeta based Gateway
Connected Touch Pad) that I'd like to get back up and running and there are
some good ideas in there. However, calling a 486sx "ancient" is a bit of a
stretch... (my oldest working computer is from 1981 and that's far from
ancient).

~~~
exikyut
Oh wow, nice.

There appear to be no decent photos of this thing on the internet, btw.

~~~
FullyFunctional
By "this thing", you mean the GCT? Googling for "Gateway Connected Touchpad"
and looking at images brings up ~ 8 images. My "other thing" is a Nascom 2.

(The GCT would be a lot more appealing if the LCD display was better, but it's
DSTN and pretty horrible compared to modern displays).

------
amelius
I wonder how fast the 486 (its logical design) could run if Intel produced it
today, i.e. with modern fab technology.

~~~
wilun
They do, and it's what runs the Intel ME.

~~~
amelius
Interesting, now I wonder why they don't let ME share a core (or parts of it)
with the main CPU. That could impact performance a little, which could be
detectable, but I mean, it's a "Management Engine", not a "Spying Engine",
right?

~~~
monocasa
They have that idea too in "System Management Mode", which is separate from
the Management Engine.

------
digi_owl
Yeah the kernel does a great job in maintaining backwards compatibility, the
rest of the stack not so much...

~~~
yeokm1
Kernel yes. Another yes to the GCC compiler.

Probably Yes and no for the rest. The fact that Git, Python 3, SSH and nginx
worked fairly ok implied they probably did some testing too.

~~~
cesarb
> The fact that Git, Python 3, SSH and nginx worked fairly ok implied they
> probably did some testing too.

Or it's a simple side effect of them being portable software. Since the same
code has to work on very different ISAs like 32-bit x86 and 32-bit ARM, any
architecture-specific code has to be cleanly separated, with a portable
fallback. As long as the compiler can still target the "486" architecture,
they'll work.

It's a different story with anything which depends on lower-level platform
details, like the kernel or glibc's pthread.

~~~
yeokm1
> The kernel does a great job in maintaining backwards compatibility, the rest
> of the stack not so much... reply

No disagreement. But so far I did not encounter any issues with other parts of
Linux other than the kernel. So the rest of the stack seems to do quite well.

------
m3kw9
Is probably more expensive to procure 486s than mordern low end chips now a
days

~~~
yeokm1
I don't disagree. In fact, even the Raspberry Pi is more powerful than this
PC.

------
grover_hartmann
This is why I will always use GNU/Linux on my computers, the freedom to use
your own hardware for as long as you want outweighs anything Microsoft or
Apple has to offer.

~~~
yeokm1
But one day, the 486 will be deprecated. Just like the 386 was...

~~~
exikyut
Yeah, I was kinda sad when the arch that got Linux going was removed.

------
krylon
This is awesome!

I, too, have a soft spot for old hardware, so this makes me smile!

------
partycoder
I completely forgot about good old LILO boot.

------
nas
That's one way to avoid Spectre.

~~~
exikyut
Maybe, maybe not.

[https://news.ycombinator.com/item?id=16088830](https://news.ycombinator.com/item?id=16088830)

------
ghostbrainalpha
Cool project, but at some point we have to move past the "Make XXX great
again" joke.

------
jankotek
It should be able to run X server as well, Xvesa with ATerm and Fluxbox should
work fine.

~~~
yeokm1
Sounds like a plan!

~~~
exikyut
Possibly look into the resurrected tinyX project from tiny core linux. It may
(?) run better than stock Xorg.

~~~
yeokm1
I tried Tiny Core Linux on this PC. It wouldn't boot from the install disc. It
kept doing the reboot loop.

------
bdcravens
I ran Slackware on a 486 (DX133 I think) with 8mb of RAM in 1999.

~~~
dmead
me too!

~~~
djsumdog
Same here. I still have my Slackware 3.5 CDs. 4 Disc set!

(Edit: mine was just a 486/DX66 though. After that I got a PII-333Mhz).

~~~
dmead
cds? you must be rich.

i was downloading that on a stack of floppy disks

------
ebikelaw
Why does this thing take 12 minutes to boot? I think this software must be
built incorrectly. I have an AMD Geode system, which admittedly is more of a
pentium-class processor running at 233 MHz, but it boots in about 5 seconds.

When the Pentium first came out a 486 DX2 was just about equivalent for most
purposes. Many people ran linux on the 486 in those days, building the
software on the host, and nobody would have tolerated 11 minute boot times.
And again, I'm running _modern_ linux on a Geode and it's not anywhere near
that slow.

~~~
djsumdog
I had Gentoo running on an old PPC (old grey Mac) back around 2010 and it
booted in just a minute or two.

If you watch the video, it gets past the kernel boot stage in under a minute.
OpenRC seems to be stalling for a bit on calculating/caching dependencies.
That really shouldn't take that long. I wonder how many services he has
enabled or if there's some regression introduced there.

Then it takes forever to mount certain things like shared memory, cgroups,
SELinux, etc.

Granted I didn't have cgroups, SELinux or most of this stuff back when I ran
Gentoo on that PPC. I kinda wish my dad hadn't thrown it out. I wonder what it
would be like to put modern Gentoo on it. I wonder if I'd get similar
slowdown.

If you tweeked this init system, or ran a more embedded distribution, the boot
time would only be about a minute.

~~~
exikyut
My guess is CF slowness.

~~~
yeokm1
The CF card is a Sandisk Extreme with up to 120MB/s read speed. My guess is
the PATA interface on that motherboard is also a bottleneck.

I did a disk speed test with "dd if=/dev/zero of=/tmp/output bs=8k count=2k"

I only got 720KB/s.

~~~
exikyut
TIL! Interesting benchmark.

I'd recommend trying bs=256k, which is what Linux is optimized for FWIW. 8k
may induce overhead, but I can't say for sure how much of a difference 256k
would make.

I just briefly poked eBay to find out the price of ISA disk controllers, and
found a reasonable number of options within the <$30 bracket.
[https://www.ebay.com/b/ISA-Internal-Disk-Controllers-RAID-
Ca...](https://www.ebay.com/b/ISA-Internal-Disk-Controllers-RAID-
Cards/90715/bn_2785081?rt=nc&_sop=15&_fcid=180)

The nice thing is that Linux will (almost certainly?) have no problem no
matter what card you buy, so the question is what the fastest chipset is.

I also just found
[https://wiki.68kmla.org/SCSI_hard_disk_replacement_options#I...](https://wiki.68kmla.org/SCSI_hard_disk_replacement_options#IDE_and_Flash)
which may prove relevant.

~~~
yeokm1
Ok I can give 256K a shot next time.

Actually won't the ISA controllers be even slower? I'm not sure what bus the
PATA controllers on this PC are connected to but isn't it connected "natively"
so to speak? It might even compete for bandwidth with the sound and network
card.

~~~
exikyut
Very, very good point. I'm not sure.

Don't quote me, but I think the onboard PATA controller is connected via ISA
as well.

~~~
yeokm1
Very likely the onboard PATA controller is connected via ISA. I had to enable
the ISA PATA support during the kernel configuration for Linux to recognise
it.

In this case, there probably won't be any benefit of having additional ISA
controller cards.

~~~
exikyut
This is very very possible.

What I wonder is whether the onboard chipset is slower than the ISA bus - and
whether using an external card would eke out a tiny bit more performance.

Apparently the ISA bus can stably run at up to 8MHz.

It's not on-point but I found this thread that discussed SCSI controllers that
was kind of interesting:
[http://www.vogons.org/viewtopic.php?t=36001](http://www.vogons.org/viewtopic.php?t=36001)

This project is really awesome btw.

------
milankragujevic
The site died, WordPress overloaded...

~~~
pttrpttrwttr
It works for me.

~~~
milankragujevic
It didn't work when I posted that comment.

------
pizzapill
Now try to run Crysis trough wine ;)

