Wednesday 10 February 2021

Basic SMTP only configuration for FastMail on FreeBSD

dma is installed in base, so:

# Edit /etc/dma/dma.conf 

SMARTHOST smtp.fastmail.com
PORT 465
AUTHPATH /etc/dma/auth.conf
SECURETRANSFER
MAILNAME your.example.server

# Create an application password in FastMail for sending SMTP.

# Create /etc/dma/auth.conf containing

youremail@fastmail.com|smtp.fastmail.com:AppPassword

# Set dma as the default mailer

cp /etc/mail/mailer.conf /etc/mail/mailer.conf.orig
cp /usr/share/examples/dma/mailer.conf /etc/mail/mailer.conf

Make sure permissions are correct

chmod 640 /etc/dma/dma.conf /etc/dma/auth.conf
chown root:mail /etc/dma/dma.conf /etc/dma/auth.conf

Disable sendmail in /etc/rc.conf

sendmail_enable="NONE"

Send a test message

echo hello | mail -v -s test youremail@fastmail.com

Edit /etc/aliases and set root: to point to youremail@fastmail.com

Friday 15 January 2021

Replacing a ZFS pool device in FreeBSD 12.2

# Check drive to replace
smartctl -A -i /dev/ada2

# Shortcut to show hours only
smartctl -A -i /dev/ada2 | grep Power_On_Hours

# ada2 very old 61661 hours Device Model:     WDC WD10EAVS-00D7B0 
# ada3 old 34813 hours Device Model:     TOSHIBA DT01ACA100

# Power off and swap drives - HP Microserver Gen8 is not hotplug
poweroff

# Check replaced drives have same dev numbers before we obliterate them
smartctl -i /dev/ada2

# Create partition layout on replaced drives and copy bootcode
gpart destroy -F ada2
gpart create -s gpt ada2
gpart add -s 512k -t freebsd-boot -l gptboot2 ada2
gpart add -a 1m -s 2G -t freebsd-swap -l swap2 ada2
gpart add -a 1m -t freebsd-zfs -l zfs2 ada2

# Identify a removed drive
zpool status | grep UNAVAIL

# Replace drive in pool - mine is called zroot
zpool replace zroot 15833367089499325236 /dev/gpt/zfs2

# Install bootcode
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada2

Tuesday 24 October 2017

Debian 9 (stretch) on Sony Vaio Z SVZ1311C5E

Back on Debian. Would prefer a non-systemd distribution but sadly FreeBSD doesn't support various bits of hardware in this machine, and I'm not fussed on being hideously behind-the-times software wise or sitting on the bleeding edge. It's come a long way since Wheezy. Stretch has everything working out of the box with a few things to note.
  • Use the "non-free" installation media. This gets you the wireless firmware required for installation without ethernet. 
  • I wanted RAID1 and UEFI installation. Bit of messing around manually configuring the partition structure - and you NEED to enable UEFI "portable device" installation on this machine.
  • Bluetooth needs switching on.
    • apt-get install rfkill
    • rfkill list all
    • rfkill enable (whatever the ID of hci0 is)
  • I've ended up on MATE this time. It's like XFCE but more polished, and everything seems to work without messing. But to cleanup after other DE experiments:
    • apt-get purge `dpkg --get-selections | grep xfce | cut -f 1`
    • apt-get autoremove
  • Monitor size is reported incorrectly.
    • xrandr --prop
      • Gets the real display size (290x160mm)
      • We know this is actually not quite correct due to real life measurement and 16:9 ratio. It's 290 wide, but over 160 high (163)
    • xdpyinfo | grep -B2 resolution
      • Shows the wrong display size
    • Drop to single user as root (kill the display manager) and run:
      • Xorg -configure
    • Copy the created xorg.conf into /etc/X11/xorg.conf
    • Edit and add to the "Monitor" section
      • DisplaySize 290 163
    • Restart the display manager
  • Samba doesn't browse properly.
    • /etc/samba/smb.conf
    • Add to [global] section
      • netbios name = ETHER
      • name resolve order = bcast wins lmhosts hosts
    • Comment out/"Yes"
      • dns proxy  = no
    •