What Happens When Booting Linux with Low Memory

2024 ж. 11 Сәу.
54 728 Рет қаралды

In this video I will demonstrate how Linux reacts when it boots with too little memory.
Documentation used in video:
Kernel Docs - SysReq: docs.kernel.org/admin-guide/s...
Wikipedia ASLR: en.wikipedia.org/wiki/Address...

Пікірлер
  • I used to host my router and homelab server on an OG Pentium machine with 32 MB running Debian (Potato, then Woody) until around 2004-2005. Worked like an absolute charm. 20 years later you need 64 MB just to boot the kernel.

    @taldmd@taldmd19 күн бұрын
    • Bloat.

      @elendil354@elendil35419 күн бұрын
    • Compile your own kernel then

      @Tart0p0mme78@Tart0p0mme7819 күн бұрын
    • You can still run Linux with less memory than this, but not with all the kernel modules enabled

      @Diamonddrake@Diamonddrake19 күн бұрын
    • security

      @rian0xFFF@rian0xFFF19 күн бұрын
    • First hard drive I ever had was 20mb - I remember talking to a friend about if video would ever be available online, we both agreed the resources required would be stupid and that it would never happen and yet... Here we are.

      @Mmouse_@Mmouse_19 күн бұрын
  • The source code looks so simple. In every startup you would have 70 abstractions and the strings would never be in the code itself but in some translation lookup table.

    @GnomeEU@GnomeEU18 күн бұрын
    • I'm always surprised at how seemingly simple yet complex the Linux kernel is. it seems like you can understand pieces without understanding the whole, which is something that can't be said of a lot of programs and probably something to strive for.

      @KingJellyfishII@KingJellyfishII16 күн бұрын
    • I find myself reading the linux kernel when i want to underatand how to do certain things. And then i also find myself reading some third party linux drivers and my god it's a night and day difference

      @gwentarinokripperinolkjdsf683@gwentarinokripperinolkjdsf68315 күн бұрын
    • ⁠Linus Torvalds still personally checks every merge request, and it shows. Say about the man what you want, but he has zero tolerance for bad code.

      @teldrah@teldrah9 күн бұрын
    • @@teldrah I think a lot of things he is criticized for are actually positives and he is successful because of those "issues", not in spite of them. Particularly his "rudeness"

      @gwentarinokripperinolkjdsf683@gwentarinokripperinolkjdsf6839 күн бұрын
    • @@gwentarinokripperinolkjdsf683 Eh, I wouldn't say so, he literally took a break at one point because he himself recognized this as an issue, because it was more than just being slightly "rude". You can be strict about kernel code quality without being a toxic asshole

      @maybenat@maybenat3 күн бұрын
  • Feeling a bit old :-) Ran linux, compiled kernel and even ran X window with netscape in 4Mb of RAM and 4Mb or swap (1995). Later (2003) we had 'big machines' in a 19" rack with 256Mb of RAM, plenty for linux AND a few Java JVMs!

    @MeriaDuck@MeriaDuck19 күн бұрын
    • something i wonder is why even the most simple and trivial of processes on a system nowadays seem to use at least several mb of ram to run, when obviously that would have been too much for machines of 70s,. 80s, and some in the 90s, so surely processes back then must have used less ram than they do now, yet when i compile my own program that does nothing but sit an in infinite loop forever, it takes 1 mb of ram to sit there and do nothing. i just wonder what changed between then and now

      @shallex5744@shallex574419 күн бұрын
    • @@shallex5744 I imagine it's partly going from 32 bit to 64 bit doubled address and instruction lengths along with the libraries used to run everything getting bigger to account for all the different types of hardware they need to run on

      @yourcat8113@yourcat811319 күн бұрын
    • ​​@@shallex57441mb for a program sounds like a stack size allocated by modern OSes. It has to be a constant size. That makes me think that defaults simply increased since then

      @wetfloo@wetfloo19 күн бұрын
    • @@shallex5744 one of the changes is at least moving from 32bit machines to 64 ones I guess. I also assume kernels do more complicated things because in short everything is more complicated, from cpu architectures, to multi threaded and multi process environments, security, etc.

      @sepgh2216@sepgh221618 күн бұрын
    • @@shallex5744 i think libc just different than old times and you could just write bare assembly which infinite loop on `_start` symbol and you could drop the libc but at the end yea i can see what you mean there basic infinite loop takes way more than infinite loop in the past

      @FluffyFoxUwU@FluffyFoxUwU16 күн бұрын
  • Please, start a series on the OS basics.How it actually works, from scratch.

    @dev.rahulgurjar@dev.rahulgurjar19 күн бұрын
  • 0:45 you're misreading the output of free. the 'free' column is how much memory is entirely unused, does not have any role at all. This is the pool that new memory requests will be drawn from first. 'Available' is the column that shows you how much more memory can be used by applications, even though it is technically in use now. How is this possible? Because the linux kernel will use portions of your ram to buffer and cache (hence why there's a buff/cache column) data that isn't it direct use by an application *right now*, but may still be useful in the future. However, if there is no free memory and more memory is required, these caches will be cleared and that memory will be used instead. So at the timestamp provided, the kernel has addressed 45.3 MB of ram. 22.7MB is in hard use by the system or it's applications. 2.7mb has no purpose. 120k is in use by the tmpfs filesystem. 20Mb is tied up in buffers and caches. 13.5 MBs are available for use should an application or the kernel request more memory.

    @realityveil6151@realityveil615115 күн бұрын
  • "Kernel panic" is hilarious to me for some reason. Insert "panik!" Meme here

    @wrathofainz@wrathofainz19 күн бұрын
    • The kernel actually "panics", because it has hit something critical, just like us humans. When we did something critically wrong, we panic.

      @coolguy87r4@coolguy87r414 күн бұрын
  • darn, i didn't about that sys request thing, quite awesome, it's like personally asking the kernel to do something from user space

    @eduardoroth8207@eduardoroth820718 күн бұрын
    • I like the idea that sysrqs are just you telling the kernel "I messed up, help."

      @Epsicronics@Epsicronics15 күн бұрын
  • Wow, that's cool. I also like how you showed the source code to give us an idea of what was happening. I'm not the best at reading code myself as I rarely develop things, but the quick explanation with the relevant code right there was super helpful for me.

    @SyphistPrime@SyphistPrime17 күн бұрын
  • I appreciate the structure of your videos. All the information you need, in a terse straight forward package. Always well done and covering topics I wouldn't likely dig into myself otherwise. Thanks!

    @justinbasinger7728@justinbasinger772819 күн бұрын
  • I honestly don't know why, but seeing you use windows to record this video feels like a betrayal XD

    @bobsock8718@bobsock871819 күн бұрын
    • Yes lol

      @motoochhotoochintoo8406@motoochhotoochintoo840617 күн бұрын
    • I was wondering how they were making sure the key combo was not being intercepted by the host, were they running a different architecture? no it's windows

      @LostieTrekieTechie@LostieTrekieTechie16 күн бұрын
    • @@LostieTrekieTechie handling of the SysRQ key is a parameter you can disable when compiling the kernel. It's enabled by default but labeled as "don't enable this unless you really know what this hack does"

      @pwii@pwii15 күн бұрын
    • Windows is fine, but I got triggered when I saw Edge 😅

      @manhle1582@manhle158215 күн бұрын
  • One of the few channels I turned notifications on, awesome Linux content!

    @Hexnano@Hexnano19 күн бұрын
  • Always high quality content 👌

    @dj.yacine@dj.yacine19 күн бұрын
  • Awesome channel, instant subscription. I have been binge-watching most of your Linux/bash/vim content. Hope this channel gets more subscribers so you can continue making videos.

    @valentin-catalin1859@valentin-catalin185917 күн бұрын
  • Thank you for explaining the acronyms for people that is not full into the subject is extreamly usefull ❤

    @wirytiox1577@wirytiox157716 күн бұрын
  • How cool thanks for teaching about the sys request

    @quintencabo@quintencabo19 күн бұрын
  • I love the "Found nothing?!?!" message in the kernel

    @Problematist@Problematist3 сағат бұрын
  • You can get Linux 6.5.0 to run alongside a minimal distro built with buildroot on an ESP32-S3 microcontroller with 8 MB of PSRAM. IIRC, after logging in, it still had ~3.5 MB free. (And yes, the onboard Wi-Fi does work.)

    @prochazkaml@prochazkaml17 күн бұрын
  • Neat! And the SysRq commands are _very_ useful when fooling around with custom kernel builds and you screw something up...

    @justinnamilee@justinnamilee19 күн бұрын
  • I really like these short kernel videos. Maybe you could do more of this, explain little snippets of code of the kernel (not necessarily error handling)

    @thinkingRN@thinkingRN14 күн бұрын
  • I've booted Linux in 16MB. I understand it can boot in as little as 2MB. Build your kernel without things you don't need. Usually this means disable loadable modules and only compile in drivers for hardware you actually have.

    @joshuahudson2170@joshuahudson217019 күн бұрын
  • i remember trying out alpine once for a CTF game, and i was just amazed at how everything just worked with so little memory

    @whamer100@whamer10014 күн бұрын
  • Damn oveer a decade on linux, but today I finally learned what the sysreq key is good for lmao, good stuff!

    @Jp-ue8xz@Jp-ue8xzКүн бұрын
  • Love your content.

    @sir_enuf@sir_enuf19 күн бұрын
  • We've built a router firmware using kernel 2.6 in a mips hardware, it had 16 megs of ram and 4 megs of SPI flash. the entire system had to be compressed into the flash, only the kernel took 2 megs of flash space, the rest was used for userland tools. Kernel would uncompress itself in memory, taking about 8mb, so we had only 8 megs available for the rest of the system. It was challenging squeeze everything in 2 megs lol.

    @cassianomartin2699@cassianomartin269915 күн бұрын
  • Great info thanks!!

    @zootsuitpenguin@zootsuitpenguin19 күн бұрын
  • My first linux machine had 4mb ram so thats not small :D Not even 4mb is small But still i like your vids! Keep em comming.

    @DIYTechRepairs@DIYTechRepairs19 күн бұрын
  • More vids on exploring the kernel source

    @ronalerquinigoagurto555@ronalerquinigoagurto55519 күн бұрын
  • This should be an exercise in OS courses in universities, nice way to show what happens on a deadlock.

    @markzuckerbread1865@markzuckerbread186518 күн бұрын
  • I love it. just love it. can't believe that key is for that. awesome 👍🏻 😎

    @DanelonNicolas@DanelonNicolas19 күн бұрын
  • 2:22 Double exclamation mark, that's a new one for me. I had to look that one up to make sense of it since it seemed redundant. Basically converts an integer into a boolean by forcing it to be a 0 or 1. Certainly more elegant than a ternary.

    @TheMohawkNinja@TheMohawkNinja14 күн бұрын
    • also known as a "double bang". but don't diss my ternarys!

      @shr4pnel@shr4pnel8 күн бұрын
  • very nice video! btw, its impressive how fast the vim is, how it allows for all of that stuff, so is there any easy tutorial how to setup it and learn? i never used it before, and i think that im missing something big. ive seen there are beautiful themes for it, but never got myself to really trying it out. would love to see instructions for windows or gnu/linux, even tho i currently only main windows :)

    @maciejk2@maciejk215 күн бұрын
    • Check out my "Vim Tips" playlist for tutorials and tips. you can easily get Vim on windows using "winget install vim"

      @nirlichtman@nirlichtman15 күн бұрын
    • @@nirlichtman thank you :)

      @maciejk2@maciejk210 күн бұрын
  • Judging from the stack trace, it ran out of memory unpacking the initrd. How about if you boot without one?

    @-ion@-ion16 күн бұрын
  • I don't know why but this is very entertaining!

    @EdwardChan.999@EdwardChan.99918 күн бұрын
  • The SysRq is only active if configured to be.

    @minefacex@minefacex19 күн бұрын
  • Great video!

    @x4exr@x4exr9 сағат бұрын
  • Perfect!

    @SayaZionGoldTeam@SayaZionGoldTeam18 күн бұрын
  • 😮 wow did not know about the sysrq key

    @Aragubas@AragubasКүн бұрын
  • I am wondering what would happen if you have no swap or very little swap

    @HugoIsThatGuy@HugoIsThatGuy14 күн бұрын
  • Really cool.

    @CocolinoFan@CocolinoFan19 күн бұрын
  • Didn't know you could trigger SysRq by just pressing the key not holding it. I've always just held Alt+SysRq and while doing that pressing a letter to send the command and it has worked every time.

    @markusTegelane@markusTegelane8 күн бұрын
  • very interesting!

    @thinkingRN@thinkingRN15 күн бұрын
  • Could a commodore 64 run alpine linux?

    @MKOFT3N@MKOFT3N3 күн бұрын
  • Fun fact: if you press Alt + Sysrq on Windows 10, 11 it opens Onedrive

    @Son1cSeren1de@Son1cSeren1de15 күн бұрын
  • The SysRq key on Linux is very similar to ‘System Call’ command from an anime called Sword Art Online. Pretty funny.

    @ligmagiga@ligmagiga16 күн бұрын
  • that's so interesting!

    @kipchickensout@kipchickensout17 күн бұрын
  • Cool trick. Which text editor do you use?

    @DegradationDomain_stuff@DegradationDomain_stuff19 күн бұрын
    • Vim

      @nirlichtman@nirlichtman18 күн бұрын
    • @@nirlichtman wow, you're absolute pro at it :)

      @DegradationDomain_stuff@DegradationDomain_stuff18 күн бұрын
  • So neat

    @clivethompson7831@clivethompson783115 күн бұрын
  • Great video, but I have to ask… you know so much about Linux, and you even use DWM, so why use windows as the base system? Is there something missing in Linux for you?

    @ehtrude@ehtrude19 күн бұрын
    • He play roblox

      @gwtar_@gwtar_19 күн бұрын
    • I address this question on my welcome page, but mainly since I like both

      @nirlichtman@nirlichtman19 күн бұрын
    • @@nirlichtman oh, sorry, didn’t see it. Hmm, okay. My experience with windows has always been very buggy and unstable, but I guess it’s not like that for everyone. I do still prefer my OS to be open-source, and Linux has worked quite well for me. Interesting to see other opinions.

      @ehtrude@ehtrude19 күн бұрын
    • @ehtrude In my case at least, as much as I would like to daily drive Linux, my university pretty much runs on Windows and requires it for a lot of applications they use. Microsoft Office is a pretty big component too, so for the time being I need to stick with it (especially in grad school). Windows 11 isn’t awful, but I really do hate that it updates automatically without the user’s permission.

      @rustylasagna@rustylasagna19 күн бұрын
  • Very informative and i dont mean this as a slight, but i find it a bit funny how you're using windows and edge to explain linux

    @Julian_H@Julian_H19 күн бұрын
    • That’s hilarious

      @turolretar@turolretar18 күн бұрын
  • Thank for making video where I cant actually remember stuff

    @galactic_dust42@galactic_dust4219 күн бұрын
  • Would've loved to see you just completely remove the panic and then recompile Alpine.

    @Con-np9yx@Con-np9yx3 күн бұрын
  • i panicked for a second thinking the sysrequest key combination would reboot your host until realising it was winsows...

    @KingJellyfishII@KingJellyfishII16 күн бұрын
  • Linux lite i don't know if more minimal system exist ?

    @gerardzi7930@gerardzi793019 күн бұрын
    • I think Alpine would still be lighter than Linux Lite since I see that Linux Lite is based on Debian/Ubuntu and Alpine is def more minimal than them

      @nirlichtman@nirlichtman19 күн бұрын
    • @@nirlichtman how does it compare to damn small linux?

      @foxmoss_@foxmoss_19 күн бұрын
    • ​@nirlichtman I'm not going to pretend I know this stuff but isn't it kinda weird how minimum base requirements have changed over the years? I saw a guy running gentoo linux with DWM in under 46MB and here we are having 64 MB base requirements for kernel to boot. Sauce: kzhead.info/sun/odSLZNqAg3NubGg/bejne.html at 1:00.

      @jackdrophammer@jackdrophammer18 күн бұрын
  • Crazy how there's CPUs now with enough cache to fit Linux inside

    @SgtRamen69@SgtRamen695 күн бұрын
  • Nice ❤❤

    @dark-ghost4132@dark-ghost413219 күн бұрын
  • how do you grep from vim like that it doesnt work for me:(

    @lucianchauvin8587@lucianchauvin858715 күн бұрын
    • Check out my video about project search in Vim (on my playlist Vim tips), its simply adding a single line to the vimrc (no plugins required)

      @nirlichtman@nirlichtman15 күн бұрын
  • I think it's pretty obvious what happenes, the computer just... forgets

    @thatpolandboi6682@thatpolandboi668218 күн бұрын
  • the code looks really simple, I wonder if I can actually help develop linux

    @dimaryk11@dimaryk1115 күн бұрын
  • The linux logo already tell the fate for someone who fail to fix it lol

    @ambush427@ambush42715 сағат бұрын
  • My first Windows 95 PC worked just fine on 8MB of RAM. Nowadays, a simple text editor would consume more RAM than that. I wonder how Windows 95 could work on such small RAM.

    @typingcat@typingcat19 күн бұрын
    • I had Notepad++ eating about 4 gigabytes a few days ago, so that puts our changing hardware demands really into perspective. Though it depends on what you're editing. Right now it's cruising on 2.4MB, which actually would fit your 8MB of RAM :)

      @Alice_Fumo@Alice_Fumo19 күн бұрын
    • @@Alice_Fumo A lot of the “problem” is programs started trading RAM for performance several decades ago because RAM capacity and speed were both improving much faster than general IOPS and speed were improving. I also doubt the stability of the 8MB Windows 95 machine. Per my recollection Windows 95 needed around 32MB to work well. It was much less picky about processor specs than memory. I had a 66MHz 486DX2 with 48MB of RAM that ran office stuff just fine. It hated doing much else though.

      @Knirin@Knirin17 күн бұрын
  • What's the System Request key?

    @frecio231@frecio23119 күн бұрын
    • Watch the video and you'll know

      @workonfire@workonfire19 күн бұрын
  • My laptop keyboard doesn't have the sysrq

    @user-kk4vy7uq5o@user-kk4vy7uq5o19 күн бұрын
    • It should have, on some laptops you need to press Fn to activate the special keys (notice that SysRq and print screen are the same key so it may be that on your laptop it only says print screen)

      @nirlichtman@nirlichtman19 күн бұрын
    • @@nirlichtmanFor some it can be even weirder, like it can be some weird combo like Fn+S is SysRq on one laptop. You should find out what it is on your model.

      @paulstelian97@paulstelian9719 күн бұрын
    • @@nirlichtman thanks

      @user-kk4vy7uq5o@user-kk4vy7uq5o19 күн бұрын
  • The last time you were able to boot Windows with 64 MBs of memory was in the 90s 😂

    @teldrah@teldrah9 күн бұрын
  • you have 20M of buffer/cache space. you could easily trim this another 15M Disable your initrd, and init=/bin/bash.

    @bowedfloor@bowedfloor3 күн бұрын
  • Cool video :)

    @aleksamrda@aleksamrda18 күн бұрын
  • My dad loves to talk about running Slackware with less than 8mb back in the day... amazing now how 64 mb is the absulute minimum limit lol

    @klingoncowboy4@klingoncowboy416 күн бұрын
  • 3:12 these magic keys help a lot lol

    @vilian9185@vilian918517 күн бұрын
  • Linux is never picky about the lowest of system resources, provided that you don’t use something for too much power of course. Like a desktop environment for example.

    @courtneymertz4596@courtneymertz459615 күн бұрын
  • Cool

    @dv_xl@dv_xl18 күн бұрын
  • Double like!

    @attilapal3786@attilapal378618 күн бұрын
  • 💖💖💖💖

    @ChandrashekarCN@ChandrashekarCN17 күн бұрын
  • I’m still upset I couldn’t get Linux to boot on my 286 with 4mb ram

    @010101110100@01010111010015 күн бұрын
  • Wow, that source code is really readable... I've gotta write some comments.

    @henryfleischer404@henryfleischer40414 күн бұрын
  • cool beans

    @madmax404@madmax40411 күн бұрын
  • 64MB seems surprisingly high to me

    @SomeRandomPiggo@SomeRandomPiggo17 күн бұрын
  • Debian runs literally on anything 1GB ram naaa 512 GB ram debian no issues I can run .

    @arghyaprotimhalder5592@arghyaprotimhalder559218 күн бұрын
  • Bro it's literally glorified msdos. Why would it need decent amounts of ram?

    @PedroBastozz@PedroBastozz15 күн бұрын
    • Because "glorified" is doing a lot of heavy lifting there.

      @icantcomeupwithnames469@icantcomeupwithnames46915 күн бұрын
    • @@icantcomeupwithnames469 it’s all cli. This should be able to run on a ibm pc from like 1987 or something.

      @PedroBastozz@PedroBastozz14 күн бұрын
    • @@PedroBastozz Simply having a CLI says nothing about what you're I'ing with.

      @icantcomeupwithnames469@icantcomeupwithnames46914 күн бұрын
    • @@icantcomeupwithnames469 Having a cli is normal. You should definitely have a terminal app. Not having a GUI is just simply not an option. It wasn’t an option 20 years ago and it certainly isn’t today.

      @PedroBastozz@PedroBastozz14 күн бұрын
  • As soon as I saw the cover of the video I thought: "here’s a video made by a noob to make views with simple stuff," and instead it’s much more than that.

    @hyprodAx_@hyprodAx_2 күн бұрын
  • alpine is linux without GNU

    @werren894@werren89418 күн бұрын
    • Alpine is a tiny distro for containers / embedded. Lack of GNU is just an implementation detail.

      @k2aj710@k2aj71017 күн бұрын
  • Bro why do you use windows even after knowing so much about linux ?

    @rohithkumarbandari@rohithkumarbandari12 күн бұрын
    • I find it more comfortable as my main OS

      @nirlichtman@nirlichtman12 күн бұрын
    • @@nirlichtman Fair enough, great content though. How can we learn more about indepth stuff like this ?

      @rohithkumarbandari@rohithkumarbandari12 күн бұрын
  • Yeah well DOS can boot in less than 640k, so Microsoft still won

    @supercellex4D@supercellex4D16 күн бұрын
    • Can't even compare DOS w/ Linux. DOS does 5% of a basic GNU/Linux kernel/userland environment, it does not even has it's own network stack.

      @cassianomartin2699@cassianomartin269915 күн бұрын
    • @@cassianomartin2699 Society has had a network stack for ages - it’s called the market Just get a floppy disk

      @supercellex4D@supercellex4D15 күн бұрын
    • DOS doesn't work with present-day software and hardware. So no.

      @tigrankhachatryan6119@tigrankhachatryan611915 күн бұрын
  • Now let's see what happens if you boot Windows 10 with low memory... oh right, it's completely useless.

    @UltimatePerfection@UltimatePerfection19 күн бұрын
    • I actually just tried Windows XP and to my surprise it booted and was somewhat usable with 32MB, but 16MB already caused a BSOD on boot.

      @nirlichtman@nirlichtman19 күн бұрын
    • @@nirlichtman Yeah, but I am talking about modern (still supported) Windows.

      @UltimatePerfection@UltimatePerfection19 күн бұрын
  • Linux sucks.

    @rasputindasilva858@rasputindasilva85819 күн бұрын
    • Just like you

      @mrkubax10@mrkubax1019 күн бұрын
    • Skill issue lol

      @shlokbhakta2893@shlokbhakta289319 күн бұрын
    • fr, too bloated

      @Liphi@Liphi19 күн бұрын
    • Skill issue

      @xtan-yt@xtan-yt17 күн бұрын
    • Skill issues

      @cassianomartin2699@cassianomartin269915 күн бұрын
  • Really cool 😮

    @xtan-yt@xtan-yt17 күн бұрын
KZhead