linner.org

Slackware UEFI boot fix

Posted by in Linux, Slackware

If boot device has been replaced (M.2 disk) or CMOS is cleared (battery drained) on a Slackware installation that uses UEFI and elilo, here is a quick fix:

  1. Edit BIOS settings: Enable UEFI boot and turn off CSM
  2. Boot an (USB) installation image (Slackware 15)
  3. Mount the EFI System Partition (mount /dev/nvme0n1p1 /boot/efi)
  4. Backup the content in /boot/efi/EFI/Slackware/ (elilo.conf, vmlinuz, initrd.gz)
  5. Run the eliloconfig script
  6. Restore elilo.conf and kernel files from backup (or edit/adapt new elilo.conf)
  7. Reboot
0

NUT (Network UPS Tools) on Slackware 15

Posted by in Linux, Slackware

  • Install sbopkg https://sbopkg.org/
  • Create user nut and group nut
  • Use sbopkg to download/build/install system/nut
  • Check device info for your connected UPS:
    root@pn41:/etc/nut# lsusb
    .
    .
    Bus 001 Device 006: ID 0463:ffff MGE UPS Systems UPS
    .
  • Edit /etc/nut/ups.conf and add your device:
    [myups]
    driver = usbhid-ups
    port = auto
    vendorid = 0463
    pollfreq = 30
  • Add an user to /etc/nut/upsd.users:
    [user]
    password = password
    upsmon master
    actions = SET
    instcmds = ALL

    # To be used by monitoring client
    [client]
    password = password2
    upsmon slave
  • Edit and configure /etc/nut/upsmon.conf.sample and save as upsmon.conf:
    MONITOR myups@localhost 1 user password master
    NOTIFYCMD /etc/nut/sendupsmsg
    NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
    NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
    NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
    NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
  • Edit /etc/nut/nut.conf (to allow other clients to connect):
    MODE=netserver
  • Edit /etc/upsd.conf and specify which NIC that should be used for outside connections:
    LISTEN 192.168.1.9 3493
    LISTEN 127.0.0.1 3493
  • Edit script (/etc/nut/sendupsmsg) that will be called if NOTIFYFLAG with flag EXEC kicks in:
    #!/bin/bash
    echo $(date): "$*" >> /var/log/ups.log
    # Replace with your own script for alert.
    sendupsemail "$*"
  • Set correct file permissions:
    chown root:nut /etc/nut/* /var/log/ups.log
    chmod 650 /etc/nut/* /var/log/ups.log
    chmod +x /etc/rc.d/rc.ups
    chmod 750 /etc/nut/sendupsmsg
  • Add rc.ups to /etc/rc.d/rc.local:
    if [ -x /etc/rc.d/rc.ups ]; then
    /etc/rc.d/rc.ups start
    fi
  • Add shutdown cmd to /etc/rc.d/rc.local_shutdown:
    if [ -f /etc/killpower ]; then
    # Stop ups service:
    echo "Stopping ups stuff: upsdrvctl shutdown"
    upsdrvctl shutdown
    fi
  • Start the services:
    /etc/rc.d/rc.usp start
  • Check if it works:
    upsc myups
  • Pull the plug and check syslog and that the notify script is called
0

Docker in Slackware 14.2

Posted by in Slackware

First, install sbopkg: https://sbopkg.org/
Make sure you have the (standard 14.2) gcc-go package installed.
Select preferred editor before starting sbopkg (default is vi):

> export EDITOR=nano
> sbopkg

From sbopkg, download, build and install tini and Go:

tini
google-go-lang

After google-go-lang is installed, quit sbopkg and make sure to add the path to the new go-binary in ~/.bashrc (check the go version):
PATH=$PATH:/usr/lib64/go1.16.3/go/bin
Logout and login from the terminal session or run:

> . ~/.bashrc

Start sbopkg again and build these packages in the given order:

docker-proxy
libseccomp
runc
containerd
docker
docker-cli
docker-compose

You have to edit the .Slackbuilds for all the packages in bold above before building them and add GO111MODULE=auto \” before the row that contains the GOPATH row (Select “Custom/Edit Slackbuild” from the package menu in sbopkg).

Slackbuild:
.
.
.
GO111MODULE=auto \
GOPATH=$TMP/$SRCNAM-$VERSION/build

Good luck! If everything worked as it should, let’s try Docker out and create a minimal Dockerfile:

# Text file named Dockerfile
FROM busybox
ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/
RUN gunzip -c /tmp/s6-overlay-amd64.tar.gz | tar -xf - -C /
ENTRYPOINT ["/init"]

> chmod +x /etc/rc.d/rc.docker
> /etc/rc.d/rc.docker start
> docker build -t s6demo .
> docker run -ti s6demo /bin/sh

Or why not try to run Slackware in Docker?
(from http://www.slackware.com/~vbatts/docker/)

docker run -i -t vbatts/slackware bash
0