Announcement

Collapse
No announcement yet.

My Kubuntu 26.04 LTS System Keeps Hanging; When it Recovers, I Get a Memory Shortage Avoided message from the kernel

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    My Kubuntu 26.04 LTS System Keeps Hanging; When it Recovers, I Get a Memory Shortage Avoided message from the kernel

    I have a kubuntu system currently running 26.04, upgraded from 25.10

    On both releases, the system would hang from time to time. Often when it finally recovered I'd see a message like this

    Click image for larger version

Name:	Screenshot_20260616_003541.png
Views:	34
Size:	197.9 KB
ID:	692724

    Today by the time it recovered I had 3 of these messages.


    AFAIK, Linux is a demand paged operating system. Given this, it did not run out of *memory*, it ran out of virtual memory. Put another way, it ran out of swap space.

    I presume therefore that the initial installation of Kubuntu made a bad decision about the total amount of swap space to configure, and *if* linux has a way to add swap space dynamically (and automatically), that ability was not turned on by the installation.

    If this analysis is correct, (1) how can I fix the swap space configuration and (2) how do I report the presumed problem with the installation process?

    Can it be fixed at all without reinstalling from scratch. (I don't recall whether I was even given an option to configure how my SSDs/disks would be used.)

    Alternatively, my knowledge of the linux kernel is out of date, and the old OOM system I knew and didn't much like a decade ago has been replaced with something even worse, such that the amount of RAM in the system effectively limits the amount of swap space usable. I understand that MacOS and iOS compress user process memory in preference to paging it to disk, though MacOS can then page out the compressed memory; iOS on the other hand cannot page out individual pages - it's whole process or nothing. I don't know the motivation for the MacOS variant, but the iOS variant is intended to protect SSDs with a limited number of write cycles available. (The compression mechanism is also faster than paging, but I don't think any user is going to notice.) Perhaps Linux has implemented something similar, now that SSDs are overwhelmingly popular?

    Finally, is it just that linux is no longer good at running on "low end" hardware? I "only" have 32 GB of RAM, which I would have expected to be enough, even with a job lot of firefox tabs trying to call home to get more ads, even though they aren't currently on screen. Maybe linux is even more bloated than MacOS, where a 16 GB system only started misbehaving in a similar way about 2 years ago, after the horrible OS upgrade that caused me to start moving from MacOS to linux. (And it just randomly kills the web browser once or twice a week, without a hang, whereas Kbuntu got 3 processes this time, including both Firefox and my mail client.)


    #2
    Thinking a bit more: if the system has a plague of processes (ab)using mlock, or really huge in-kernel-memory data structures representing the virtual memory associated with each bloated process, the problem really could be physical memory. (In the limiting case, the data structures don't need to be huge if we're looking at a swap space a sufficiently large multiple of system memory. With 32 GB of main memory, and typical per-page data structures (64 bits per page), and the use of 4K pages, I'd expect trouble of that sort at a swap space size around 256 GB. Not what we have here.)
    Last edited by DinoNerd; Jun 16, 2026, 02:24 AM. Reason: Fixed my typo, and my bad arithmetic.

    Comment


      #3
      Finally, is it just that linux is no longer good at running on "low end" hardware? I "only" have 32 GB of RAM,
      not at all , i have a dual core machine from 2010 with 4Gig ram and it runs 26.04 like a champ
      i have zram and a swapfile but the swapfile is basically never even being used

      Click image for larger version

Name:	Screenshot_20260616_230622.png
Views:	22
Size:	273.7 KB
ID:	692731
      ʟɨռʊӼ ʄօʀ ʟɨʄɛ

      Comment


        #4
        output of these ?
        Code:
        free -h; swapon --show
        Code:
        journalctl -b -1 -g "oom\|Out of memory\|Killed process"
        Code:
        journalctl -u systemd-oomd -b
        Code:
        inxi -Fzxx
        ʟɨռʊӼ ʄօʀ ʟɨʄɛ

        Comment


          #5
          Originally posted by die.boer View Post

          not at all , i have a dual core machine from 2010 with 4Gig ram and it runs 26.04 like a champ
          i have zram and a swapfile but the swapfile is basically never even being used

          Click image for larger version

Name:	Screenshot_20260616_230622.png
Views:	22
Size:	273.7 KB
ID:	692731
          That's a lot more the kind of thing I was expecting. Clearly something specific is wrong with my system, or how I use it.

          Comment


            #6
            Originally posted by die.boer View Post
            output of these ?
            Code:
            free -h; swapon --show
            Code:
            journalctl -b -1 -g "oom\|Out of memory\|Killed process"
            Code:
            journalctl -u systemd-oomd -b
            Code:
            inxi -Fzxx
            I spent much of today vigorously applying OneTab to reduce the suspected source of load on my system. If that was the right workaround, it's in better shape as I report these results.

            Code:
            $ free -h
            total used free shared buff/cache available
            Mem: 30Gi 13Gi 2.4Gi 5.9Gi 21Fi 17Gi
            Swap: 511Mi 503Mi 8.9Mi


            Code:
            $ swapon --show
            MAME TYPE SIZE USED PRIO
            /swapfile file 512M 503.1M -1
            Code:
            $ journalctl -b -1 -g "oom\|Out of memory\|Killed process"
            - - No entries - -
            Code:
            journalctl -u systemd-oomd -b
            - - No entries - -

            Code:
            inxi -Fzxx
            Command 'inxi' not found, but can be installed with:
            sudo apt install inxi
            By the looks of things, and guessing a bit what the commands did, it looks like (a) the workaround behaved as I expected and (b) logs wrap around fast, and were gone by the time I tried this.

            This also doesn't look like an absurdly low amount of swap space for a system with 32 GB of RAM.

            I OneTab'd 109 separate tabs from Safari on the 16 GB MacOS system with similar symptoms. The version of OneTab available for Firefox doesn't give me a count, but the list is of a similar length. I also outright closed a bunch of tabs on both systems, but more on the Kubuntu system.

            At a guess, my habit of leaving lots of tabs around "to get back to later", is creating an awful lot of load, far more than I'd have expected. There may also be an issue with Protonmail (memory leak? enthusiastic use of mlock? keeping too much in memory when confronted with huge mailboxes? - I'm as prone to not deleting emails as I am to opening 100s of tabs).
            Last edited by DinoNerd; Jun 16, 2026, 09:25 PM.

            Comment


              #7
              Originally posted by DinoNerd View Post
              At a guess, my habit of leaving lots of tabs around "to get back to later", is creating an awful lot of load, far more than I'd have expected. There may also be an issue with Protonmail (memory leak? enthusiastic use of mlock? keeping too much in memory when confronted with huge mailboxes? - I'm as prone to not deleting emails as I am to opening 100s of tabs).
              My choices right now seem to be:

              - wait and see whether the problem has gone away, in which case I'll conclude that my tab habit is/was pathological, at least on modern browsers/modern web pages.
              - re-open all the tabs now saved in OneTab, wait for the problem to recur. If this doesn't make it recur within a week, something even stranger is happening.

              Either way, if/when the problem recurs I try to gather the above statistics when the system is as close to the recurrence as possible. (This time I couldn't even get my commands echoed in an ssh client window, so there will be some delay.)

              I'm inclined to go with the lazy choice - presume use of OneTab has solved my problem, and don't try to replicate it.

              FWIW, I was already looking for a solution to my tab proliferation. It has other unwanted side effects. Some of them were less problematic on MacOS, so my switch to linux had put "do something about this" on my agenda. It just hadn't previously got to the top of my list.

              Also, if the problem recurs, and the OOM system picks ProtonMail as its target, that suggests some combination of reducing surplus emails and consulting its provider, as well as gathering data on it specifically.
              Last edited by DinoNerd; Jun 16, 2026, 09:23 PM.

              Comment


                #8
                $ inxi -Fzxx
                System:
                Kernel: 7.0.0-22-generic arch: x86_64 bits: 64 compiler: gcc v: 15.2.0
                Desktop: KDE Plasma v: 6.6.4 tk: Qt v: N/A wm: kwin_wayland dm: SDDM
                Distro: Kubuntu 26.04 LTS (Resolute Raccoon) base: Ubuntu
                Machine:
                Type: Mini-pc System: System76 product: Meerkat v: meer6
                serial: <superuser required> Chassis:type: 35 v: meer6
                serial: <superuser required>
                Mobo: Intel model: NUC11TNBi5 v: M11904-404 serial: <superuser required>
                part-nu: BNUC11TNHi50000/1/2/5 Firmware: UEFI vendor: Intel
                v: TNTGL357.0054.2021.0316.1417 date: 03/16/2021
                CPU:
                Info: quad core model: 11th Gen Intel Core i5-1135G7 bits: 64 type: MT MCP
                arch: Tiger Lake rev: 1 cache:L1: 320 KiB L2: 5 MiB L3: 8 MiB
                Speed (MHz):avg: 400 min/max: 400/4200 cores:1: 400 2: 400 3: 400 4: 400
                5: 400 6: 400 7: 400 8: 400 bogomips: 38707
                Flags-basic: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
                Graphics:
                Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics] driver: i915 v: kernel
                arch: Xe ports:active: DP-1,HDMI-A-1 empty: DP-2,DP-3,DP-4 bus-ID: 00:02.0
                chip-ID: 8086:9a49
                Display: wayland server: Xwayland v: 24.1.10 compositor: kwin_wayland
                driver:gpu: i915 d-rect: 7680x2160 display-ID: 0
                Monitor-1: DP-1 pos: right model: ASUS VG289 res: 3840x2160 hz: 60
                dpi: 157 diag: 708mm (27.9")
                Monitor-2: HDMI-A-1 pos: primary,left model: Dell S2722QC res: 3840x2160
                hz: 60 dpi: 163 diag: 685mm (27")
                API: EGL v: 1.5 platforms:device: 0 drv: iris device: 1 drv: swrast gbm:
                drv: iris surfaceless:drv: iris wayland:drv: iris x11:drv: iris
                API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 26.0.3-1ubuntu1
                glx-v: 1.4 direct-render: yes renderer: Mesa Intel Iris Xe Graphics (TGL
                GT2) device-ID: 8086:9a49 display-ID: :0.0
                API: Vulkan v: 1.4.341 surfaces: N/A device: 0 type: integrated-gpu
                driver: mesa intel device-ID: 8086:9a49 device: 1 type: cpu
                driver: mesa llvmpipe device-ID: 10005:0000
                Info:Tools:api: clinfo, eglinfo, glxinfo, vulkaninfo
                de: kscreen-console,kscreen-doctor wl: wayland-info x11: xdriinfo,
                xdpyinfo, xprop, xrandr
                Audio:
                Device-1: Intel Tiger Lake-LP Smart Sound Audio driver: snd_hda_intel
                v: kernel bus-ID: 00:1f.3 chip-ID: 8086:a0c8
                API: ALSA v: k7.0.0-22-generic status: kernel-api
                Server-1: PipeWire v: 1.6.2 status: active with:1: pipewire-pulse
                status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
                Network:
                Device-1: Intel Wi-Fi 6 AX201 driver: iwlwifi v: kernel bus-ID: 00:14.3
                chip-ID: 8086:a0f0
                IF: wlo1 state: down mac: <filter>
                Device-2: Intel Ethernet I225-LM driver: igc v: kernel pcie:speed: 5 GT/s
                lanes: 1 port: N/A bus-ID: 58:00.0 chip-ID: 8086:15f2
                IF: enp88s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
                Bluetooth:
                Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
                speed: 12 Mb/s lanes: 1 bus-ID: 3-10:3 chip-ID: 8087:0026
                Report: hciconfig ID: hci0 rfk-id: 0 state: down
                bt-service: enabled,running rfk-block:hardware: no software: no
                address: <filter>
                Drives:
                Local Storage:total: 7.28 TiB used: 1.6 TiB (21.9%)
                ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 980 PRO 2TB size: 1.82 TiB
                speed: 63.2 Gb/s lanes: 4 serial: <filter> temp: 57.9 C
                ID-2: /dev/sda vendor: Samsung model: SSD 870 QVO 2TB size: 1.82 TiB
                speed: 6.0 Gb/s serial: <filter>
                ID-3: /dev/sdb vendor: Seagate model: Expansion SW size: 3.64 TiB
                type: USB rev: 3.2 spd: 5 Gb/s lanes: 1 serial: <filter>
                Partition:
                ID-1: / size: 1.79 TiB used: 756.46 GiB (41.3%) fs: ext4 dev: /dev/nvme0n1p2
                ID-2: /boot/efi size: 299.4 MiB used: 10.7 MiB (3.6%) fs: vfat
                dev: /dev/nvme0n1p1
                Swap:
                ID-1: swap-1 type: file size: 512 MiB used: 500.2 MiB (97.7%) priority: -1
                file: /swapfile
                Sensors:
                System Temperatures:cpu: 82.0 C mobo: N/A
                Fan Speeds (rpm): N/A
                Info:
                Memory:total: 32 GiB available: 30.97 GiB used: 14.41 GiB (46.5%)
                Processes: 339 Power:uptime: 19d 1h 54m wakeups: 0 Init: systemd v: 259
                default: graphical
                Packages: 2846 pm: dpkg pkgs: 2834 pm: snap pkgs: 12 Compilers:
                gcc: 15.2.0 Shell: Bash v: 5.3.9 running-in: konsole inxi: 3.3.40


                Comment


                  #9
                  Originally posted by DinoNerd View Post

                  Code:
                  $ swapon --show
                  MAME TYPE SIZE USED PRIO
                  /swapfile file 512M 503.1M -1
                  This also doesn't look like an absurdly low amount of swap space for a system with 32 GB of RAM.
                  I totally misread the above, the first time around. All I noticed was that 512 is a lot more than twice 32.

                  When I read the units as well as the numbers it does seem extremely small, at 1/64th of system memory.

                  ...

                  Obviously I don't have a feel for current linux swap space requirements, but I remember a rule-of-thumb of twice system memory for most/any *nix system. I think we were still using that with FreeBSD the last time I worked with it. Linux' memory management has always been a bit different from other *nixes, presumably due to some very basic decisions made long ago, so my heuristic may never have fit linux. (My ignorance is showing here.) But if it didn't, I don't see why.

                  Many *nix processes use the design pattern "read the whole thing into memory, however large, and let the kernel's paging system deal with it." In modern times, they may simply mmap the whole file. No problem if the file is mapped in such a way that changes to the process' mmap area are written back to the file. (Swap space won't be used, as the file is its own backing store.) More trouble if the app doesn't want changes saved unless/until the user tells them to do so. (It needs swap space in the meantime.) And loads of trouble if the app decides to improve its performance by mlocking as well as mmaping the whole thing, and someone feeds it a really large file.

                  Emacs would be an example that traditionally read the whole file into (virtual) memory. On an ancient system with small memory and large files, that would trigger lots of paging activity.

                  I've no idea how many other *nix/linux tools behave the same way, but I strongly suspect ProtonMail of being one of them, given what little I understand of its design, based mostly on its known features.

                  FWIW, I also use emacs as my text editor of choice, but I haven't had it read in anything huge - just the kind of .txt or .html file that's actually typed by a human, or could be.

                  ---
                  Also, on my third reading I see that most of this swap file is in use, even with most of my tabs gone, and the system behaving properly.

                  Leaving stuff in swap once it's been paged out is normal. There may also be a swap space reservation process in the linux kernel. So having 503 Mb of 512 MB of swap in use is not problematic with 13 G of main memory available.

                  But it does suggest it has been pretty much totally full up.

                  Of course for all I know to the contrary, the swap file might grow and shrink dynamically. My knowledge is so very much out of date, and more general *nix than specifically linux.
                  Last edited by DinoNerd; Jun 16, 2026, 09:52 PM.

                  Comment


                    #10
                    the swap is extremely small for a 32gb system , and firefox with LOTS of tabs open + two 4K monitors will eat up ram .
                    the swap size for you should be 8bg or 16gb...
                    let me know if you want to increase the swap
                    ʟɨռʊӼ ʄօʀ ʟɨʄɛ

                    Comment


                      #11
                      Originally posted by die.boer View Post
                      the swap is extremely small for a 32gb system , and firefox with LOTS of tabs open + two 4K monitors will eat up ram .
                      the swap size for you should be 8bg or 16gb...
                      let me know if you want to increase the swap
                      I think that would be a good idea.

                      The 4K monitors won't be going away, and even if I use OneTab religiously, I'm sure to find some other activity that will use lots and lots of memory. (As one possibility, I suspect dosbox of having been involved in previous system slowdowns, perhaps as the last straw that was too much for an overloaded system.)

                      Comment


                        #12
                        I can't imagine FF even as a snap would eat up 32GB of RAM unless it has a huge memory leak. I'm using Vivalidi with 50ish tabs open using only 3.7gb. I would do some more testing before making changes.

                        I would start by opening Konsole (after a reboot) and enter "free". Then, leave Konsole open, launch FF, and enter "free" again. Note the amount of available RAM. Then open System Monitor > Applications tab and see what FF is using. Then use FF as normal but keep System Monitor so you can see it and watch the RAM usage.

                        I suspect you either have a buggy FF, or bad swap file (or partition?). Also, with 32GB RAM you should reduce swappiness to minimum. IME, no need to swap at all with that much RAM.
                        Last edited by oshunluvr; Yesterday, 10:46 AM.

                        Please Read Me

                        Comment


                          #13
                          You can check current swappiness by entering sysctl vm.swappiness in Konsole. If it's not one, you should reduce it to that. Edit /eetc/sysctl.d/99-sysswappiness.conf and edit "vm.swappiness=" to equals 1​

                          Please Read Me

                          Comment


                            #14
                            Originally posted by oshunluvr View Post
                            You can check current swappiness by entering sysctl vm.swappiness in Konsole. If it's not one, you should reduce it to that. Edit /eetc/sysctl.d/99-sysswappiness.conf and edit "vm.swappiness=" to equals 1​
                            yes i agree ,the swappiness should be 1 or even 10 is ok, but i meant the swapfile is way to small to be of any use ,when needed
                            Last edited by die.boer; Yesterday, 12:49 PM.
                            ʟɨռʊӼ ʄօʀ ʟɨʄɛ

                            Comment


                            • oshunluvr
                              oshunluvr commented
                              Editing a comment
                              Agreed.

                          Users Viewing This Topic

                          Collapse

                          There are 0 users viewing this topic.

                          Working...
                          X