The translation is temporarily closed for contributions due to maintenance, please come back later.

Source string Read only

(itstool) path: sect2/para
Context English State
Assuming that you configured your filesystem correctly when it was built on the normal hard disk (with your filesystems mounted read-only, and with the necessary options compiled into the kernel) you should now be successfully booting your FreeBSD embedded system.
System Strategies for Small and Read Only Environments
In <xref linkend="ro-fs"/>, it was pointed out that the <filename>/var</filename> filesystem constructed by <filename>/etc/rc.d/var</filename> and the presence of a read-only root filesystem causes problems with many common software packages used with FreeBSD. In this article, suggestions for successfully running cron, syslog, ports installations, and the Apache web server will be provided.
Cron
Upon boot, <filename>/var</filename> gets populated by <filename>/etc/rc.d/var</filename> using the list from <filename>/etc/mtree/BSD.var.dist</filename>, so the <filename>cron</filename>, <filename>cron/tabs</filename>, <filename>at</filename>, and a few other standard directories get created.
However, this does not solve the problem of maintaining cron tabs across reboots. When the system reboots, the <filename>/var</filename> filesystem that is in memory will disappear and any cron tabs you may have had in it will also disappear. Therefore, one solution would be to create cron tabs for the users that need them, mount your <filename>/</filename> filesystem as read-write and copy those cron tabs to somewhere safe, like <filename>/etc/tabs</filename>, then add a line to the end of <filename>/etc/rc.initdiskless</filename> that copies those crontabs into <filename>/var/cron/tabs</filename> after that directory has been created during system initialization. You may also need to add a line that changes modes and permissions on the directories you create and the files you copy with <filename>/etc/rc.initdiskless</filename>.
Syslog
<filename>syslog.conf</filename> specifies the locations of certain log files that exist in <filename>/var/log</filename>. These files are not created by <filename>/etc/rc.d/var</filename> upon system initialization. Therefore, somewhere in <filename>/etc/rc.d/var</filename>, after the section that creates the directories in <filename>/var</filename>, you will need to add something like this:
<prompt>#</prompt> <userinput>touch /var/log/security /var/log/maillog /var/log/cron /var/log/messages</userinput>
<prompt>#</prompt> <userinput>chmod 0644 /var/log/*</userinput>
Ports Installation
Before discussing the changes necessary to successfully use the ports tree, a reminder is necessary regarding the read-only nature of your filesystems on the flash media. Since they are read-only, you will need to temporarily mount them read-write using the mount syntax shown in <xref linkend="ro-fs"/>. You should always remount those filesystems read-only when you are done with any maintenance - unnecessary writes to the flash media could considerably shorten its lifespan.
install
To make it possible to enter a ports directory and successfully run <command>make</command> <_:buildtarget-1/>, we must create a packages directory on a non-memory filesystem that will keep track of our packages across reboots. As it is necessary to mount your filesystems as read-write for the installation of a package anyway, it is sensible to assume that an area on the flash media can also be used for package information to be written to.
First, create a package database directory. This is normally in <filename>/var/db/pkg</filename>, but we cannot place it there as it will disappear every time the system is booted.
<prompt>#</prompt> <userinput>mkdir /etc/pkg</userinput>
Now, add a line to <filename>/etc/rc.d/var</filename> that links the <filename>/etc/pkg</filename> directory to <filename>/var/db/pkg</filename>. An example:
<prompt>#</prompt> <userinput>ln -s /etc/pkg /var/db/pkg</userinput>
Now, any time that you mount your filesystems as read-write and install a package, the <command>make</command> <_:buildtarget-1/> will work, and package information will be written successfully to <filename>/etc/pkg</filename> (because the filesystem will, at that time, be mounted read-write) which will always be available to the operating system as <filename>/var/db/pkg</filename>.
Apache Web Server
The steps in this section are only necessary if Apache is set up to write its pid or log information outside of <filename>/var</filename>. By default, Apache keeps its pid file in <filename>/var/run/httpd.pid</filename> and its log files in <filename>/var/log</filename>.
It is now assumed that Apache keeps its log files in a directory <filename><replaceable>apache_log_dir</replaceable></filename> outside of <filename>/var</filename>. When this directory lives on a read-only filesystem, Apache will not be able to save any log files, and may have problems working. If so, it is necessary to add a new directory to the list of directories in <filename>/etc/rc.d/var</filename> to create in <filename>/var</filename>, and to link <filename><replaceable>apache_log_dir</replaceable></filename> to <filename>/var/log/apache</filename>. It is also necessary to set permissions and ownership on this new directory.
First, add the directory <literal>log/apache</literal> to the list of directories to be created in <filename>/etc/rc.d/var</filename>.
Second, add these commands to <filename>/etc/rc.d/var</filename> after the directory creation section:
<prompt>#</prompt> <userinput>chmod 0774 /var/log/apache</userinput>
<prompt>#</prompt> <userinput>chown nobody:nobody /var/log/apache</userinput>
Finally, remove the existing <filename><replaceable>apache_log_dir</replaceable></filename> directory, and replace it with a link:
<prompt>#</prompt> <userinput>rm -rf <replaceable>apache_log_dir</replaceable></userinput>
<prompt>#</prompt> <userinput>ln -s /var/log/apache <replaceable>apache_log_dir</replaceable></userinput>

Loading…

No matching activity found.

Browse all component changes

Source information

Source string comment
(itstool) path: sect2/para
Flags
read-only
Source string location
article.translate.xml:481
String age
a year ago
Source string age
a year ago
Translation file
articles/solid-state.pot, string 77