<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>frankie-tales</title><id>https://lovergine.com/feeds/tags/debian.xml</id><subtitle>Tag: debian</subtitle><updated>2026-02-25T15:33:03Z</updated><link href="https://lovergine.com/feeds/tags/debian.xml" rel="self" /><link href="https://lovergine.com" /><entry><title>A Terramaster NAS with Debian, take two.</title><id>https://lovergine.com/a-terramaster-nas-with-debian-take-two.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2026-01-19T13:00:00Z</updated><link href="https://lovergine.com/a-terramaster-nas-with-debian-take-two.html" rel="alternate" /><content type="html">&lt;p&gt;After experimenting at home, the very first professional-grade NAS from
Terramaster arrived at work, too, with 12 HDD bays and possibly a pair of M2s.
NVME cards. In this case, I again installed a plain Debian distribution, but HDD
monitoring required some configuration adjustments to run &lt;code&gt;smartd&lt;/code&gt; properly.&lt;/p&gt;&lt;p&gt;A decent approach to data safety is to run regularly scheduled short and long
SMART tests on all disks to detect potential damage. Running such tests on all
disks at once isn't ideal, so I set up a script to create a staggered
configuration and test multiple groups of disks at different times. Note that it
is mandatory to read the devices at each reboot because their names and order
can change.&lt;/p&gt;&lt;p&gt;Of course, the same principle (short/long test at regular intervals along the
week) should be applied for a simpler configuration, as in the case of my home
NAS with a pair of RAID1 devices.&lt;/p&gt;&lt;p&gt;What follows is a simple script to create a staggered &lt;code&gt;smartd.conf&lt;/code&gt; at boot
time:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;#!/bin/bash
#
# Save this as /usr/local/bin/create-smartd-conf.sh
#
# Dynamically generate smartd.conf with staggered SMART test scheduling
# at boot time based on discovered ATA devices

# HERE IS A LIST OF DIRECTIVES FOR THIS CONFIGURATION FILE.
# PLEASE SEE THE smartd.conf MAN PAGE FOR DETAILS
#
#   -d TYPE Set the device type: ata, scsi[+TYPE], nvme[,NSID],
#           sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N],
#           usbprolific, usbsunplus, sntasmedia, sntjmicron[,NSID], sntrealtek,
#           ... (platform specific)
#   -T TYPE Set the tolerance to one of: normal, permissive
#   -o VAL  Enable/disable automatic offline tests (on/off)
#   -S VAL  Enable/disable attribute autosave (on/off)
#   -n MODE No check if: never, sleep[,N][,q], standby[,N][,q], idle[,N][,q]
#   -H      Monitor SMART Health Status, report if failed
#   -s REG  Do Self-Test at time(s) given by regular expression REG
#   -l TYPE Monitor SMART log or self-test status:
#           error, selftest, xerror, offlinests[,ns], selfteststs[,ns]
#   -l scterc,R,W  Set SCT Error Recovery Control
#   -e      Change device setting: aam,[N|off], apm,[N|off], dsn,[on|off],
#           lookahead,[on|off], security-freeze, standby,[N|off], wcache,[on|off]
#   -f      Monitor 'Usage' Attributes, report failures
#   -m ADD  Send email warning to address ADD
#   -M TYPE Modify email warning behavior (see man page)
#   -p      Report changes in 'Prefailure' Attributes
#   -u      Report changes in 'Usage' Attributes
#   -t      Equivalent to -p and -u Directives
#   -r ID   Also report Raw values of Attribute ID with -p, -u or -t
#   -R ID   Track changes in Attribute ID Raw value with -p, -u or -t
#   -i ID   Ignore Attribute ID for -f Directive
#   -I ID   Ignore Attribute ID for -p, -u or -t Directive
#   -C ID[+] Monitor [increases of] Current Pending Sectors in Attribute ID
#   -U ID[+] Monitor [increases of] Offline Uncorrectable Sectors in Attribute ID
#   -W D,I,C Monitor Temperature D)ifference, I)nformal limit, C)ritical limit
#   -v N,ST Modifies labeling of Attribute N (see man page)
#   -P TYPE Drive-specific presets: use, ignore, show, showall
#   -a      Default: -H -f -t -l error -l selftest -l selfteststs -C 197 -U 198
#   -F TYPE Use firmware bug workaround:
#           none, nologdir, samsung, samsung2, samsung3, xerrorlba
#   -c i=N  Set interval between disk checks to N seconds
#    #      Comment: text after a hash sign is ignored
#    \      Line continuation character
# Attribute ID is a decimal integer 1 &amp;lt;= ID &amp;lt;= 255
# except for -C and -U, where ID = 0 turns them off.

set -euo pipefail

# Test schedule configuration
BASE_SCHEDULE=&amp;quot;L/../../6&amp;quot;  # Long test on Saturdays
TEST_HOURS=(01 03 05 07)   # 4 time slots: 1am, 3am, 5am, 7am

DEVICES_PER_GROUP=3

main() {
    # Get array of device names (e.g., sda, sdb, sdc)
    mapfile -t devices &amp;lt; &amp;lt;(ls -l /dev/disk/by-id/ | grep ata | awk '{print $11}' | grep sd | cut -d/ -f3 | sort -u)

    if [[ ${#devices[@]} -eq 0 ]]; then
        exit 1
    fi

    # Start building config file
    cat &amp;lt;&amp;lt; EOF
# smartd.conf - Auto-generated at boot
# Generated: $(date '+%Y-%m-%d %H:%M:%S')
#
# Staggered SMART test scheduling to avoid concurrent disk load
# Long tests run on Saturdays at different times per group
#
EOF

    # Process devices into groups
    local group=0
    local count_in_group=0

    for i in &amp;quot;${!devices[@]}&amp;quot;; do
        local dev=&amp;quot;${devices[$i]}&amp;quot;
        local hour=&amp;quot;${TEST_HOURS[$group]}&amp;quot;

        # Add group header at start of each group
        if [[ $count_in_group -eq 0 ]]; then
            echo &amp;quot;&amp;quot;
            echo &amp;quot;# Group $((group + 1)) - Tests at ${hour}:00 on Saturdays&amp;quot;
        fi

        # Add device entry
        #echo &amp;quot;/dev/${dev} -a -o on -S on -s (${BASE_SCHEDULE}/${hour}) -m root&amp;quot;
        echo &amp;quot;/dev/${dev} -a -o on -S on -s (L/../../6/${hour}) -s (S/../.././$(((hour + 12) % 24))) -m root&amp;quot;

        # Move to next group when current group is full
        count_in_group=$((count_in_group + 1))
        if [[ $count_in_group -ge $DEVICES_PER_GROUP ]]; then
            count_in_group=0
            group=$(((group + 1) % ${#TEST_HOURS[@]}))
        fi
    done
}

main &amp;quot;$@&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To run such a script at boot, add a unit file to the systemd configuration.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl  edit --full /etc/systemd/system/regenerate-smartd-conf.service
sudo systemctl enable regenerate-smartd-conf.service&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Where the unit service is the following:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;[Unit]
Description=Generate smartd.conf with staggered SMART test scheduling
# Wait for all local filesystems and udev device detection
After=local-fs.target systemd-udev-settle.service
Before=smartd.service
Wants=systemd-udev-settle.service
DefaultDependencies=no

[Service]
Type=oneshot
# Only generate the config file, don't touch smartd here
ExecStart=/bin/bash -c '/usr/local/bin/create-smartd-config.sh &amp;gt; /etc/smartd.conf'
StandardOutput=journal
StandardError=journal
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target&lt;/code&gt;&lt;/pre&gt;</content></entry><entry><title>DebianGis anniversary and the power of being a community</title><id>https://lovergine.com/debiangis-anniversary-and-the-power-of-being-a-community.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2025-10-16T18:15:00Z</updated><link href="https://lovergine.com/debiangis-anniversary-and-the-power-of-being-a-community.html" rel="alternate" /><content type="html">&lt;p&gt;A few days before today, 21 years ago, I sent
&lt;a href=&quot;https://lists.debian.org/debian-devel-announce/2004/10/msg00007.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;this message&lt;/a&gt;
to the &lt;em&gt;debian-devel-announce&lt;/em&gt; mailing list to solicit helpers in packaging and
to oversee the geospatial software stack included in the main Debian archive.
After so many years, still there.&lt;/p&gt;&lt;p&gt;At that time, the Debian project had already been around for more than 10 years
and even had a few releases behind, but the typical maintenance of software was
still a one-person show, except for a few large and complex pieces of software.
Even the kernel was managed by a single developer, Herbert Xu. Each developer
was responsible for implementing updates, fixing bugs, and releasing updates.
Often jealous of such prerogatives and their stated possession of the package
or task. While there was already a quality assurance team and an orphaning
process for abandoned packages (or inactive developers), these processes were
not very common and were even relatively slow and imperfect.&lt;/p&gt;&lt;p&gt;Since that time, team-based maintenance has become the standard approach in the
Debian community for properly managing the most complicated software
collections. That's at least to ensure proper long-term maintenance,  because
the average developer can provide only a limited continuity to their efforts,
and real life is generally more complicated than the digital one. It is not
secondary that packaging tasks can be tedious in the long term, and it is easy
to lose motivation. The presence of a working team can reduce the risk of
burnout and allow each developer to step down when needed. The most effective
team should be small enough to coordinate more easily and avoid lagging in
changes and migrations, but not too small: presenting a one-person show as a
team work is not a great idea. But too many people in the same team is equally
not a great idea for the opposite reason.&lt;/p&gt;&lt;p&gt;In the specific case of Debian, the system is so modular and lacks many
interdependencies that it favors the creation of fully independent management
groups for hundreds of components and ecosystems of packages. It is not casual
that most of the bugs and inconsistencies are concentrated where too many parts
need to interact appropriately with perfectly aligned programming interfaces.&lt;/p&gt;&lt;p&gt;Talking about DebianGis and the geospatial software, the key motivation at the
time was the lack of a coordinated effort to build and collect together, with
consistency, a lot of different libraries and programs that were (and still
are) specialized enough and based on hundreds of dependencies, often not within
the perimeter of competence of the geodata user. At that time, piling up the
software stack of a typical geospatial application was not an easy task for the
faint of heart, and most (all?) of the Linux distributions lacked in one way or
another.&lt;/p&gt;&lt;p&gt;Anecdotally, I can remember about 15 years ago, the company that sold us a Suse
Enterprise-based solution for a geospatial information system that had so many
problems in completing the required setup that I finally created a chroot-based
environment with a Debian stable plain install to run a working PostGIS DBMS.
That was the time when containerized solutions were still far from being
supported, so the chroot environment was the most immediate solution to such a
problem.  A little win for a community-based distribution and its tiny
geospatial team, which provides a measure of the problems at the time. A giant
step for the whole FOSS concept.&lt;/p&gt;&lt;p&gt;I'm currently much less active in packaging tasks, but still seeing the current
team alive and capable of releasing well-supported products more than twenty
years later gives me reason to be proud of such a community.&lt;/p&gt;</content></entry><entry><title>Installing Debian on a USB stick for a Terramaster NAS</title><id>https://lovergine.com/installing-debian-on-a-usb-stick-for-a-terramaster-nas.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2025-10-15T18:00:00Z</updated><link href="https://lovergine.com/installing-debian-on-a-usb-stick-for-a-terramaster-nas.html" rel="alternate" /><content type="html">&lt;p&gt;I recently bought a basic NAS for home use. The NAS is a nice &lt;a href=&quot;https://shop.terra-master.com/it-it/products/f2-425&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Terramaster
F2-425&lt;/a&gt;, which is a very
basic RAID1-only NAS with a decent CPU and 2.5Gb network. Terramaster allows
users to either use its custom Linux-based TOS or install any other operating
system supported by the x86_64-based platform. Note that this model does not
mount any NVME unit for the OS, as for the F2-424.&lt;/p&gt;&lt;p&gt;Common choices include TrueNas, Proxmox, or any other Linux-based distribution.
My choice has been a plain Debian stable distribution because I do not have
special requirements and prefer a lightweight CLI-only solution over a
dashboard. The F2-425 does not have NVME cards, only regular HDDs/SSDs.
However, when installing an independent OS, as in my case, you can immediately
use an external USB stick for the system, and dedicate HDDs to data. The unit
even has a tiny (264MB) internal USB stick for installing TOS, but I simply
used a decent 16GB SanDisk thumb drive. The clear advantage is the possibility
of having the base system and data perfectly separated, and multiple copies of
the stick for safety.&lt;/p&gt;&lt;p&gt;Of course, the installation of such a system can be done without using the
Debian installer at all, so I'm describing here how to perform such an
installation for my future reference and for other geeks. Of course, you need a
running Linux system with &lt;em&gt;debootstrap&lt;/em&gt; installed. The process involves
partitioning the stick in GPT mode, installing the base system and EFI, and
configuring the system to finalize a bootable system with the necessary
software to connect the NAS to the network, including OpenSSH.&lt;/p&gt;&lt;p&gt;Note that the 2.5 Gb Ethernet is a RealTek, so a firmware blob
(firmware-realtek package on Trixie) is required to properly work with that.
Alternatively, another of the USB ports could also be used to add a wireless
connection. The OS stick could be simply mounted on the internal port, but it
requires opening the chassis for that and using a tiny stick.&lt;/p&gt;&lt;p&gt;At power-on, the internal TOS dongle automagically boots up, so connecting an
HDMI display and a keyboard is required to change the setup to boot the Debian
EFI image on the stick. On F2-425, press the &amp;lt;F12&amp;gt; key to access the AMI setup
and change boot priorities. There are always slight differences among AMI BIOS
setups, so it is required to find the right key to access settings and change
boot options.&lt;/p&gt;&lt;p&gt;Let's consider /dev/sde as the name of the USB stick device on the host where
it will be prepared. A GPT partition can be created via GNU parted, as follows:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;parted /dev/sde 	# to create EFI and root primary partition
partprobe --summary /dev/sde
sfdisk -l /dev/sde
mkfs.vfat -F 32 /dev/sde1
mkswap /dev/sde2
mkfs.ext4 /dev/sde3&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once done, installing the base system is immediate.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;mount /dev/sde3 /mnt
mount /dev/sde1 /mnt/boot/efi
debootstrap trixie /mnt

mount -o bind /dev /mnt/dev
mount -t devpts devpts /mnt/dev/pts
mount -t proc proc /mnt/proc
mount -t sysfs sysfs /sys /mnt/sys
mount -t tmpfs run /mnt/run

cp /etc/apt/sources.d/debian.sources /mnt/etc/apt/sources.d/.
cp /etc/resolv.conf /mnt/etc/.

echo &amp;quot;nas&amp;quot; &amp;gt; /mnt/etc/hostname
sed -i -e 's/localhost$/localhost\n127.0.0.1\tnas/' /mnt/etc/hosts

rootfs=$(blkid /dev/sde | grep TYPE=\&amp;quot;ext4\&amp;quot;|awk '{print $2}'|cut -d\&amp;quot; -f2)
vfat=$(blkid /dev/sde|grep TYPE=\&amp;quot;vfat\&amp;quot;|awk '{print $2}'|cut -d\&amp;quot; -f2)
swap=$(blkid /dev/sde|grep TYPE=\&amp;quot;swap\&amp;quot;|awk '{print $2}'|cut -d\&amp;quot; -f2)

cat &amp;gt;/mnt/etc/fstab &amp;lt;&amp;lt;EOF
UUID=$rootfs / ext4 noatime,errors=remount-ro 0 1
UUID=$vfat /boot/efi vfat noatime,umask=0077 0 1
UUID=$swap none swap sw 0 0
EOF

chroot /mnt
apt update
apt upgrade -y
apt install grub-efi-amd64 linux-image-amd64 ssh \
        firmware-misc-nonfree \
        firmware-realtek xfsprogs rsync pmount \
        gddrescue screen util-linux-extra bash-completion \
 	mdadm  parted smartmontools htop ntp unattended-upgrades sudo
useradd -m -G sudo -s /bin/bash -C 'Your Name' your_username 
passwd your_username
adduser your_username plugdev
apt install tzdata locales
dpkg-reconfigure locales
grub-install --target=x86_64-efi --force-extra-removable /dev/sde
update-initramfs -u
apt clean
exit # leave the chroot
umount /mnt/run
umount /mnt/sys/firmware/efi/efivars
umount /mnt/sys
umount /mnt/proc
umount /mnt/dev/pts
umount /mnt/dev
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that required HDDs can be easily installed later. I manually configured
the two disks with GNU parted for a GPT Linux RAID partition.  After booting
with the stick, a simple install of the md array support suffices.  Typically,
the USB stick runs as &lt;code&gt;/dev/sdd&lt;/code&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mkfs.xfs /dev/md0
mkdir /data
data=$(blkid /dev/md0|grep TYPE=\&amp;quot;xfs\&amp;quot;|awk '{print $2}'|cut -d\&amp;quot; -f2)
echo &amp;quot;UUID=$data /data xfs defaults 1 1&amp;quot; &amp;gt;&amp;gt;/etc/fstab&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In order to allow shutting down by pressing the power button, it is required to
configure &lt;code&gt;systemd-logind&lt;/code&gt; as follows.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;sed -i -e 's/^#HandlePowerKey=poweroff'/HandlePowerKey=poweroff/ \
       -e 's/^#HandlePowerKeyLongPress=ignore/HandlePowerKeyLongPress=ignore/ \
    /etc/systemd/logind.conf

systemctl restart systemd-logind.service&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It could also be a good idea to stop the periodic auto-scan on the RAID volume
for big disks, which can take ages to run.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;sed -i -e 's/^AUTOCHECK=true/AUTOCHECK=false/' /etc/default/mdadm
systemctl restart mdmonitor.service&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The network configuration depends definitively on the type of connection used
and the home network setup. In my case, the NAS uses a static IPv4
address, so it can be configured through &lt;code&gt;ifupdown&lt;/code&gt;, and it is only necessary
to correctly write the &lt;code&gt;/etc/network/interfaces&lt;/code&gt; for the &lt;code&gt;enp1s0&lt;/code&gt; Realtek 2.5Gb
Ethernet interface. Not that it requires a non-free firmware blob to run.&lt;/p&gt;&lt;p&gt;After the initial syncing, a series of software to better manage the NAS can be
installed, but that is optional and can be the subject of a different post. For
sure, for better convenience, a copy of the USB stick with the complete
configuration is a good idea, to allow a fast recovery in case of failures.&lt;/p&gt;</content></entry></feed>