zram defaults not found

  • This topic has 8 replies, 5 voices, and was last updated May 30-8:19 am by Xecure.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #60193
    Member
    banned

      Ok, I was using the zram skript as it says in the file itself. Works basicly. I have not done nothing with /etc/rc.local, there is just exit 0. See this post:

      https://www.antixforum.com/forums/topic/getting-the-zram-script-to-work-solved/

      The script is making a zram in % of the free ram. So of course it depends, what other appilcation you are running in the moment you start it. After reboot I got this:

      
      $ cat /proc/swaps
      Filename				Type		Size	Used	Priority
      /swapfile                               file		2097148	0	-1
      /dev/zram0                              partition	199496	544	100
      

      But with the command given in the zram script I got this:

      
      $ lsmod | grep zram
      zram                   18355  1
      

      So what means 18255? Not the size? It comes from /sys/module/zram/coresize

      Then I tried to change the default like it says in the zram script:

      “Copy this script (as root) from /usr/local/bin to /etc/init.d and then #update-rc.d zram defaults

      I don’t get any output, if I run this with sudo:

      
      antix@antix1:~
      $ sudo update-rc.d zram defaults
      [sudo] password for antix: 
      antix@antix1:~
      

      What is it doing? I can not find a file or directroy rc.d. Where is it?

      Then I tried to find the default settings for zram, as it is in the code from zram script:

      
         # Cumulative size of zram swapspace expressed as a percentage of available memory
         # Option, a value specified in /etc/default/zram overrides a value specified below
         # Examples
         #   PERCENTAGE=30
         #   PERCENTAGE=10
         # Default, PERCENTAGE=25
      

      But I could not find such a file. Or what /etc is it? Not the one in the root?

      And just a idea. Wouldn’t it also be helpful to have the option of specifying the zram size in MB and not as a percentage of the free ram?

      #60196
      Anonymous
        Helpful
        Up
        0
        ::

        $ apropos zram

        ^—v

        man zramctl

        What is it doing? I can not find a file or directroy rc.d. Where is it?

        $apropos rc.d

        ^—v

        update-rc.d

        >>> What is it doing?

        leafpad /etc/init.d/zram
        (or, beforehand, leafpad /usr/local/bin/zram)
        If the inline comments are not sufficient for a given step (line) within the script, lookup the manpage for the command(s) which the line is executing, eh?

        -=-

        (This is a sysV thing, not proprietary to antiX)
        When you place this initscript in /etc/init.d
        running update-rc.d will parse the initscript and, based on finding the line
        Default-Start: 2 3 4 5
        will create symlinks:
        /etc/rc2.d/Snnzram
        /etc/rc3.d/Snnzram
        /etc/rc4.d/Snnzram
        /etc/rc5.d/Snnzram

        Typically, a desktop user is booting straight to runlevel 5.

        Each time the system initializes a given runlevel, the init system reads (follows) the symlinks present is the associated /etc/rc*.d/ directory, launching each item.

        #60198
        Member
        Xecure
          Helpful
          Up
          0
          ::

          Man, oh, MAN!

          Literally, use man (It stands for MANual).

          update-rc.d is used to enable a service to start at BOOT (or to not start at boot). The “defaults” option enables the service at startup.
          Check if zram service is running
          service --status-all
          And see if zram is there with a “+” sign.

          lsmod shows the size of all active modules, and not of the mounted point. You would have discovered what it does with man lsmod. Or if MAN is too much for you, a web search.

          https://en.wikipedia.org/wiki/Lsmod
          “Module” denotes the name of the module. “Size” denotes the size of the module (not memory used) in Bytes.

          If the service starts at boot, then there is no need to add the command to /etc/rc.local (Which is used to start scripts or programs at boot, before the user logs in, with root privileges).

          Where is /etc/default/zram? The script is telling you that if you create a configuration file /etc/default/zram it will override the defaults. So, it means you need to create the file if you want to use a different value to 25%. It will always be a percentage of the RAM, to make it work on any machine, no matter the RAM available. It is much safer than a number in KB or MB. What happens if a RAM stick fails and Zram is trying to use more RAM than is available? Crash every single time you boot. That is why the decision in the design to use a percentage is the safe bet (good design).

          MAN, you need to learn how to do research.

          antiX Live system enthusiast.
          General Live Boot Parameters for antiX.

          #60213
          Member
          banned
            Helpful
            Up
            0
            ::

            @skidoo and @Xecure

            Thank you! After boot I have this:

            antix@antix1:~
            $ free
                          total        used        free      shared  buff/cache   available
            Mem:         949608      179776      361304       22852      408528      612876
            Swap:       2299308           0     2299308
            antix@antix1:~
            $ cat /proc/swaps
            Filename				Type		Size	Used	Priority
            /swapfile                               file		2097148	0	-1
            /dev/zram0                              partition	202160	0	100
            antix@antix1:~
            $ zramctl
            NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
            /dev/zram0 lzo         197.4M   4K   87B   12K       1 [SWAP]
            antix@antix1:~
            $ 
            

            That looks good 🙂 So zram is ok and working. But it has anyway a – 🙁

            antix@antix1:~
            $ service --status-all
             [ - ]  acpi-support
             [ + ]  acpid
             [ ? ]  alsa-utils
             [ - ]  anacron
             [ + ]  avahi-daemon
             [ + ]  bluetooth
             [ ? ]  bootchart-done
             [ - ]  bootlogs
             [ - ]  bootmisc.sh
             [ + ]  brightness
             [ - ]  checkfs.sh
             [ - ]  checkroot-bootclean.sh
             [ - ]  checkroot.sh
             [ + ]  connman
             [ - ]  console-setup.sh
             [ ? ]  cpufrequtils
             [ + ]  cron
             [ ? ]  cryptdisks
             [ ? ]  cryptdisks-early
             [ + ]  cups
             [ + ]  dbus
             [ ? ]  dundee
             [ + ]  elogind
             [ + ]  gpm
             [ + ]  haveged
             [ - ]  hostname.sh
             [ ? ]  hwclock.sh
             [ + ]  irqbalance
             [ - ]  keyboard-setup.sh
             [ - ]  killprocs
             [ ? ]  kmod
             [ - ]  lm-sensors
             [ ? ]  loadcpufreq
             [ - ]  mountall-bootclean.sh
             [ - ]  mountall.sh
             [ - ]  mountdevsubfs.sh
             [ - ]  mountkernfs.sh
             [ - ]  mountnfs-bootclean.sh
             [ - ]  mountnfs.sh
             [ ? ]  networking
             [ + ]  nfs-common
             [ + ]  ntp
             [ ? ]  ofono
             [ - ]  oobe
             [ ? ]  pppd-dns
             [ - ]  procps
             [ - ]  rc.local
             [ + ]  resolvconf
             [ - ]  rmnologin
             [ + ]  rpcbind
             [ - ]  rsync
             [ + ]  rsyslog
                    
             [ - ]  saned
             [ - ]  sendsigs
             [ + ]  slim
             [ - ]  smartmontools
             [ + ]  ssh
             [ - ]  sudo
             [ + ]  tlp
             [ + ]  tor
             [ + ]  udev
             [ - ]  ufw
             [ - ]  umountfs
             [ ? ]  umountnfs-alternative.sh
             [ - ]  umountnfs.sh
             [ - ]  umountroot
             [ - ]  unattended-upgrades
             [ - ]  urandom
             [ - ]  virtualbox-guest-utils
             [ - ]  x11-common
             [ - ]  zram
            antix@antix1:~
            $
            

            Also the firewall has a -. I was taking then a look to Control Center / System / Choose Startup Services:

            zram has a x in runlevel 2,3,4,5 (not S). The firewall (ufw) has x in runlevel S (no other). udev also has a x in runlevel S. So why ufw is – and udev i + on the above list? And why zram is – and anyway working?

            Last questions: Is algorithm lzo ok for zram? In zswap they say, that lz4 and lz4ho are better. But how I would change this? In the zram script it is not set…so default lzo. And also zram script is using another methode to create the zram? No zramctl to see there. Or can I use zramctl on a existing zram, without to change the size or to create it new?

            @Xecure

            And you should learn to repect people that are learning! It is not the first time, that I get or found answers from you, that wehre not repectfull or missleading.

            • This reply was modified 1 year, 11 months ago by banned.
            #60240
            Member
            Xecure
              Helpful
              Up
              0
              ::

              @Xecure

              And you should learn to repect people that are learning! It is not the first time, that I get or found answers from you, that wehre not repectfull or missleading.

              You are right. Completely unreliable. The process I follow as a non-expert is:
              1. I see a question and I don’t know the answer to.
              2. I waste my time researching a possible answer.
              3. I try to give the best answer I find after researching.

              I start not knowing the answer, as the OP, and end up finding something that resembles an answer and posting it. Can it be wrong? Yes. Can it be right? Sometimes. In those rare cases where the solution is found, the person asking could have arrived at the same answer if they spent the same time searching for the answer as I did.

              I never used zram and just know it is used for better RAM use. I researched the same things you asked and brought the best answer I could find.

              I am sorry for wasting my time researching and answering questions I originally didn’t have the answer to. I will leave all my volunteering work to you, and just spend some needed time away from the computer. Good luck with giving back and expanding your knowledge.

              Note: The zram script in antiX can be read here: /usr/local/bin/zram
              Note 2: You could also use zswap for more options. I just spent a few seconds searching and found this (another unreliable answer): https://www.antixforum.com/forums/topic/using-zswap-instead-of-zram/

              PS: It seems you didn’t get the MAN joke.

              antiX Live system enthusiast.
              General Live Boot Parameters for antiX.

              #60267
              Forum Admin
              anticapitalista
                Helpful
                Up
                0
                ::

                @JSM – stop insulting our forum members and moderators. They are invaluable to this forum. If you don’t like their comments, either ignore them or leave the forum.

                Philosophers have interpreted the world in many ways; the point is to change it.

                antiX with runit - leaner and meaner.

                #60269
                Member
                ModdIt
                  Helpful
                  Up
                  0
                  ::

                  @JSM, in a rambling spam post I deleted a week or so ago you claimed to have a vision of an operating system you will develop
                  (with knowledge from others I guess ?) and that you previously worked as a software development engineer.

                  Now you post this to Xecure, one of the most helpful and knowledgable persons on the forum:

                  And you should learn to repect people that are learning! It is not the first time, that I get or found answers from you, that wehre
                  not repectfull or missleading.

                  You are asking questions from mostly self taught persons who try to help others in there free time.

                  I am putting you on my ignore list

                  #60306
                  Member
                  banned
                    Helpful
                    Up
                    0
                    ::

                    Well, as all of you can see, the answeres from the 2 people where just not helpfull. And this is not the frist time! I am very good in testing…linux, browsers, swap methods…and also people.

                    If people are not well educated or not well in social skills, then this is not my fault. And I am also not willing to fix this problems.

                    For antiX it is very bad, if such people are giving answeres in the forum, that are missleading the users. But I think, that @anticapitalista knows the problem. antiX is for free, of course. But if you would have to sell it, then you would look for better supporters and you would make a better wiki, isn’t it? Well, sometimes also capitalism has good points 🙂

                    It is very strange, that 2 people are not even able to give answers to a simple zram script, that everyone can understand, that has just basic skills. But as I told you, I am very good in testing, also people.

                    By the way, if you look for better performance, the best way is, to use just a swapfile, but with the right settings. zram and zswap are ok, if your ram is not to small and if your cpu is not to slow. Because the 2 methodes need also ram and needs also cpu power, compressing data is not a simple thing.

                    Some helpfull links here and please take a look to your /etc/sysctl.conf. Swappiness default is 60 for servers, for clients can be lower. But 10 is very low! And take care with the other settings, as memory management is not so simple!

                    Very good and helpfull article:

                    https://www.howtogeek.com/449691/what-is-swapiness-on-linux-and-how-to-change-it/

                    some more with some helpfull information:

                    https://docs.gluster.org/en/latest/Administrator-Guide/Linux-Kernel-Tuning/
                    https://lwn.net/Articles/100978/

                    And please stop giving users missleading answers! With this you are waisting the time of the useres and also harm the antiX project! And yes, I am a ingeneer for informatic (not computer since), I am near 53 years old and I am not a stupid, anyway I can ask like a stupid in order to show up the people, that like to play around with stupid. Do you got the point? I hope so.

                    If you like to read my post about jOS, you can find it also in the devuan forum with some interessting answers:

                    https://dev1galaxy.org/viewtopic.php?id=4340

                    have a nice day 🙂

                    • This reply was modified 1 year, 11 months ago by banned.
                    #60530
                    Member
                    Xecure
                      Helpful
                      Up
                      0
                      ::

                      I tried to solve my differences with JSM privately, but it seems he still thinks he is in the right. In this thread we both made errors, though I have prematurely admitted fault, he cannot admit he was also mistaken.

                      He pointed out to me that my answer of checking the status was wrong, because the status of the service shows as non active. He is correct, I had not checked the script the last time I wrote here and only described how services usually work. He never mentioned where the script was so though I found it on my last answer.

                      Note: The zram script in antiX can be read here: /usr/local/bin/zram

                      I didn’t check it until yesterday. He points out that the script contains the options of Start, Stop and Restart. But as there is no Status option, “services –status-all” shows it as not active (because the script wasn’t planned to have a way to check if zram “service” was working AFTER everything else worked out, because it is non-dynamic, and or creates or deletes the zram mount point and configuration, not expecting to be watching over it). He probably arrived at the same conclusion, but was still insistent on pointing out my fault, instead of admitting he also fell into the same mistake as me, as reflected in his post.

                      Title of the post: zram defaults not found
                      Answer to the tittle:

                      Where is /etc/default/zram? The script is telling you that if you create a configuration file /etc/default/zram it will override the defaults. So, it means you need to create the file if you want to use a different value to 25%.

                      So, the main topic was answered.

                      First question in OP:

                      But with the command given in the zram script I got this:

                      $ lsmod | grep zram
                      zram                   18355  1

                      So what means 18255? Not the size? It comes from /sys/module/zram/coresize

                      I answered:

                      lsmod shows the size of all active modules, and not of the mounted point.

                      But the problem is that the OP mistook this check in the script for checking size, when in fact it was checking if the module was up. Seen on the script:
                      # After booting verify the module is loaded with: lsmod | grep zram
                      I answered the question, but the question was badly worded and had its own misconceptions, so the answer was also going to be misleading.

                      Second question inside the first post:

                      Then I tried to change the default like it says in the zram script:
                      “Copy this script (as root) from /usr/local/bin to /etc/init.d and then #update-rc.d zram defaults”
                      I don’t get any output, if I run this with sudo:

                      antix@antix1:~
                      $ sudo update-rc.d zram defaults
                      [sudo] password for antix: 
                      antix@antix1:~

                      What is it doing? I can not find a file or directroy rc.d. Where is it?

                      And my answer was also on point to what update-rc.d command did.

                      update-rc.d is used to enable a service to start at BOOT (or to not start at boot). The “defaults” option enables the service at startup.

                      But don’t trust me. Read the manual for it:

                      $ man update-rc.d
                      update-rc.d - install and remove System-V style init script links
                      DESCRIPTION
                             update-rc.d  updates  the  System V style init script links /etc/rcrun‐
                             level.d/NNname whose target  is  the  script  /etc/init.d/name.   These
                             links  are  run  by  init when it changes runlevels; they are generally
                             used to start and stop system services such as  daemons.

                      Which is the most complete answer.

                      Us pointing out to use the man command was really a very good point for helping out someone as knowledgeable as an I.T. engineer. They are used to reading technical manuals and documentation, so it could have avoided the need to wait for an answer in the forum. It is unfortunate that the differences in native languages lead my “joke like” answer to be interpreted as a personal attack. I have learnt my lesson and will avoid trying to make my answers more entertaining.

                      The last question:

                      Wouldn’t it also be helpful to have the option of specifying the zram size in MB and not as a percentage of the free ram?

                      I am no expert, so I gave my opinion that percentage is better than amount, but I am sure that a person knowledgeable in programming can change the script so that MEM_PER_CPU is calculated differently (instead of using a percentage to calculate it, use an amount), and modify the configuration file also.
                      It is your computer, so you can do as you please, without anyone telling you not to. You can create a new zram-JSM script to perform this exact idea if you need it and share it to the world (if you want to).

                      The conclusion I want to give. All answers in this post had no misleading intentions and were intended to give a solution to the questions proposed by the OP. The OP or anyone else cannot blame anyone if the questions were badly worded or wrongly interpreted, derived from a language barrier, a problem that comes from a difference in native tongues.

                      I think the OP blew this thread out of proportions and didn’t want to admit that, though knowledgeable, a misinterpretation of the script or a language problem lead to incorrect questions (and also incorrect answers). We are all learning, and we had no intention of personal attacks, but not recognizing when both parties are wrong will lead to conflict. If you can admit your faults (not publicly, no need for that, but to yourself, to avoid self-destruction), and take a step back to self reflect and end this topic, leaving everything behind and continue your own path in life with a wider and more forgiving vision, to yourself and to others.

                      Regards.

                      antiX Live system enthusiast.
                      General Live Boot Parameters for antiX.

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • You must be logged in to reply to this topic.