<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>3397</bug_id>
          
          <creation_ts>2012-11-07 08:31:00 +0000</creation_ts>
          <short_desc>/var/log and /var/cache should not be on volatile storage (tmpfs)</short_desc>
          <delta_ts>2016-10-25 20:58:29 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>General Runtime</product>
          <component>General Runtime</component>
          <version>1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.4 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chen Qi">Qi.Chen</reporter>
          <assigned_to name="Chen Qi">Qi.Chen</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>liang.li2</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>marc.ferland</cc>
    
    <cc>rob.mcclung</cc>
    
    <cc>sgw</cc>
    
    <cc>yi.zhao</cc>
    
    <cc>zhenfeng.zhao</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>27272</commentid>
    <comment_count>0</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-11-07 08:31:00 +0000</bug_when>
    <thetext>In current system, /var/log and /var/cache are links to /var/volatile/log and /var/volatile/cache respectively. And /var/volatile is a mount point for tmpfs. In other words, they are on volatile storage. Files contained in these two directories will lost if the system is shut down, rebooted or crashed for any reason.

For example, all system logs are lost once the system is rebooted. Besides, other application which use /var/log to store logs will also lost their logs between system reboots. For end users, this might be somewhat inconvenient and confusing. 

Anyway, /var/cache and /var/log are not designed to store volatile data, so I think these two dirs should not be on tmpfs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27333</commentid>
    <comment_count>1</comment_count>
    <who name="Marc Ferland">marc.ferland</who>
    <bug_when>2012-11-09 22:00:30 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; Anyway, /var/cache and /var/log are not designed to store volatile data, so
&gt; I think these two dirs should not be on tmpfs.

Actually I think they _are_ designed to store volatile data.

Also remember that if you want to store log files between reboots you will need a way to rotate these logs. Some devices do not have that much free space on disk and log files can quickly get big.

If the application wants to store data between reboots it should do it with /var/lib which is currently non-volatile.

You might want to look at:
http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27336</commentid>
    <comment_count>2</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-11-10 13:33:32 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; (In reply to comment #0)
&gt; &gt; Anyway, /var/cache and /var/log are not designed to store volatile data, so
&gt; &gt; I think these two dirs should not be on tmpfs.
&gt; 
&gt; Actually I think they _are_ designed to store volatile data.
&gt; 
&gt; Also remember that if you want to store log files between reboots you will
&gt; need a way to rotate these logs. Some devices do not have that much free
&gt; space on disk and log files can quickly get big.
&gt; 
&gt; If the application wants to store data between reboots it should do it with
&gt; /var/lib which is currently non-volatile.
&gt; 
&gt; You might want to look at:
&gt; http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

/var/lib: data and status of app
/var/log: logs for app
/var/cache: cache for app
All these three directory should not be on tmpfs. 
Of course logs should be rotated to save space. And some distributions have /var/lib/logrotate directory to store rotation information about the logs in /var/log. 
But if logs are totally lost once the system is crashed or shut down, why do we need them in the first place?
We don&apos;t look at logs now and then when system works well, we examine them when something goes wrong. So if they are not kept for a few days (for the most common situation), they are kind of useless. 
Also, I don&apos;t see any implication in FHS that these dirs should be on volatile storage.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27338</commentid>
    <comment_count>3</comment_count>
    <who name="Marc Ferland">marc.ferland</who>
    <bug_when>2012-11-10 17:03:12 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; /var/lib: data and status of app
&gt; /var/log: logs for app
&gt; /var/cache: cache for app
&gt; All these three directory should not be on tmpfs. 
&gt; Of course logs should be rotated to save space. And some distributions have
&gt; /var/lib/logrotate directory to store rotation information about the logs in
&gt; /var/log. 
&gt; But if logs are totally lost once the system is crashed or shut down, why do
&gt; we need them in the first place?
&gt; We don&apos;t look at logs now and then when system works well, we examine them
&gt; when something goes wrong. So if they are not kept for a few days (for the
&gt; most common situation), they are kind of useless. 
&gt; Also, I don&apos;t see any implication in FHS that these dirs should be on
&gt; volatile storage.

You&apos;re right saying the FHS doesn&apos;t mention they should be on volatile storage what I meant was that applications should not rely on /var/log or /var/cache being kept between reboots, so it shouldn&apos;t break anything.

Personally, I use log files while in development &quot;mode&quot; but once the system is shipped to clients (BTW, I&apos;m working with mobile systems) they&apos;re pretty much useless since I don&apos;t even have access to them.

I also wouldn&apos;t want to waste resources (flash wearing, cpu for log rotation) for log files on a production system.

Could this be made optional? It would actually be nice to keep log files between reboots for development purposes but we should be able turn it off when it&apos;s time to ship.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27339</commentid>
    <comment_count>4</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-11-10 18:29:26 +0000</bug_when>
    <thetext>To be clear, consider the &apos;syslog&apos; interface that unix specification provides.
#include &lt;syslog.h&gt;
void syslog(int priority, const char* message, arguments...);
This is supposed to be the standard logging mechanism in Linux as far as I know.

And syslogd uses /var/log/messages as the default file for all system messages unless you change the config file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29907</commentid>
    <comment_count>5</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-02-18 08:30:08 +0000</bug_when>
    <thetext>If no one rejects, I&apos;ll remove /var/log from volatile, just as Laurentiu did with /var/cache.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29947</commentid>
    <comment_count>6</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-02-19 08:21:23 +0000</bug_when>
    <thetext>Although I have finished and tested the patches, I suddenly realized that this doesn&apos;t really bother any user, so it seems unnecessary to make this change.

I&apos;ll mark this bug as RESOLVED/NOTABUG.

We can reopen it later if something goes wrong and bothers user.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67577</commentid>
    <comment_count>7</comment_count>
    <who name="Robert McClung">rob.mcclung</who>
    <bug_when>2016-10-25 20:58:29 +0000</bug_when>
    <thetext>What is the best way to configure Yocto so that the logs are located in non-volatile memory in the rootfs? In other words, I need the procedure (.bb mod and commands) for &quot;removing /var/log from volatile&quot; as mentioned above.

I tried modifying /etc/default/volatiles on the target but /var/log always gets linked to tmpfs/volatile during init. For the project I am working on I need a solution that is persistent.

Thanks,

Robert</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>