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

Let’s git

Posted by in Lagom

cd .../myproject/
nano -w .gitignore (filtered stuff, one on each row, *.old, *.backup etc)
git init
git add .
git commit -m "Initial release or whatever."
---
git status
nano -w changedfile.xxx
git diff changedfile.xxx
git add changedfile.xxx
git commit -m "Fixed a bug or whatever."
git push (if remote repository on gitlab etc.)
0