User:Przemoc/Notes: Difference between revisions

From Alpine Linux
(AL 3.3.3: Disk/RAID1)
(AL 3.3.3: Sensors)
Line 92: Line 92:
/etc/init.d/smartd start
/etc/init.d/smartd start
</pre>
</pre>
=== Sensors ===
==== lm_sensors ====
<pre>
# install package
apk add lm_sensors
# install package for detecting sensors (if needed) - installs perl too
apk add lm_sensors-detect
# load module required for detecting sensors
modprobe i2c-dev
# detect sensors (skip scanning Super I/O, IPMI, ISA if you're on grsec)
sensors-detect
# after detecting sensors you can remove perl (if you don't need it)
apk del perl
</pre>
===== Problems =====
<ol>
<li><code>sensors-detect</code> command created <code>/etc/modules-load.d/lm_sensors.conf</code> file, but its first line is a comment, which leads to following message during boot
<pre>
modprobe: ERROR: missing parameters. See -h.
</pre>
It can be fixed by improving sed command in <code>/etc/init.d/modules</code> from <code>'s/\#.*//g'</code> to <code>'s/\#.*//g;/^[ \t]*$/d'</code> (deleting empty lines).
<li>It seems that nowadays you don't have to add <code>lm_sensors</code> to autostart, because in AL ''lm_sensors'' package is patched to create file <code>/etc/modules-load.d/lm_sensors.conf</code> (files in this directory are inspected by <code>/etc/init.d/modules</code>). <code>/etc/init.d/lm_sensors</code> seems in fact superfluous and it also doesn't work
<pre>
* /etc/conf.d/lm_sensors does not exist, try running sensors-detect
* ERROR: lm_sensors failed to start
</pre>
because it expects old file (<code>/etc/conf.d/lm_sensors</code>), which is no longer provided.
</ol>
{{todo|Report both issues on alpine-devel ML.}}

Revision as of 22:56, 15 April 2016

I finally installed AL and I'm poking it a bit. Here you can find some notes regarding this experience. They should be helpful, but please use them with caution. I may add some additional commentary sometimes. If you think there is a better way to perform some of mentioned here tasks, then don't hesitate to notify me about it. Top-level headings denotes AL version that was used. Backward and forward compatibility is possible, but not tested.

Alpine Linux 3.3.3

Shell

Even though I always try to write POSIX sh-compliant scripts, I like to have bash as my default shell, because it's quite handy. Being able to write for instance quick diff -u <(COMMAND1) <(COMMAND2) (to compare output of two commands) or mv FILE{,SUFFIX} (to rename file by adding suffix) is very convenient.

Bash as default shell

AL doesn't have vipw, so root has to perform vi /etc/passwd himself to change the last field of root record (should be the first line in the file). You have to install util-linux package to get chsh utility.

Activate color prompt

Initial prompt: baytrail:~#

mv /etc/profile.d/color_prompt{,.sh}

Prompt after above change and relogin: baytrail [~]#

Long history

I like to have long history, so I created following file:

/etc/profile.d/long_history.sh

export HISTSIZE=9999999
export HISTFILESIZE=$HISTSIZE

Disk

Set up RAID1 on two devices

# install package
apk add mdadm

# load "raid1" module during boot (not really needed if you perform further steps)
echo raid1 >>/etc/modules

# create RAID1 array on two whole disks with 1MB data offset
mdadm --create --level=1 --raid-devices=2 --data-offset=1M /dev/md0 /dev/sda /dev/sdb

# preserve original example mdadm.conf
mv /etc/mdadm.conf{,.orig}

# save current setup into configuration file
# (usually people do not use -v, but it's more readable)
mdadm --detail -v --scan >/etc/mdadm.conf

# add raid devices starting to autostart
rc-update add mdadm-raid

# add raid devices monitoring to autostart
rc-update add mdadm

# start raid devices monitoring now
/etc/init.d/mdadm start

# following steps are needed if you want to support RAID early during boot

# add "raid" to features (space-separated values)
vi /etc/mkinitfs/mkinitfs.conf

# rebuild /boot/initramfs-grsec
mkinitfs

# add "raid1" to modules (comma-separated values)
vi /etc/update-extlinux.conf

# update extlinux
update-extlinux

Install smartctl and smartd

# install package
apk add smartmontools

# comment DEVICESCAN and uncomment DEVICESCAN -R 194 -R 231 -I 9
# to get meaningful and useful raw temperature in syslog
vi /etc/smartd.conf

# add smartd service to autostart
rc-update add smartd

# start the service now
/etc/init.d/smartd start

Sensors

lm_sensors

# install package
apk add lm_sensors

# install package for detecting sensors (if needed) - installs perl too
apk add lm_sensors-detect

# load module required for detecting sensors
modprobe i2c-dev

# detect sensors (skip scanning Super I/O, IPMI, ISA if you're on grsec)
sensors-detect

# after detecting sensors you can remove perl (if you don't need it)
apk del perl
Problems
  1. sensors-detect command created /etc/modules-load.d/lm_sensors.conf file, but its first line is a comment, which leads to following message during boot
    modprobe: ERROR: missing parameters. See -h.
    

    It can be fixed by improving sed command in /etc/init.d/modules from 's/\#.*//g' to 's/\#.*//g;/^[ \t]*$/d' (deleting empty lines).

  2. It seems that nowadays you don't have to add lm_sensors to autostart, because in AL lm_sensors package is patched to create file /etc/modules-load.d/lm_sensors.conf (files in this directory are inspected by /etc/init.d/modules). /etc/init.d/lm_sensors seems in fact superfluous and it also doesn't work
     * /etc/conf.d/lm_sensors does not exist, try running sensors-detect
     * ERROR: lm_sensors failed to start
    

    because it expects old file (/etc/conf.d/lm_sensors), which is no longer provided.

Todo: Report both issues on alpine-devel ML.