Sysadmin Mega Thread

I don’t set any loggers. It is whatever ubuntu has configed by default


https://klarasystems.com/learning/best-practices-for-optimizing-zfs1/

Same as last time?

Oh wow, pop some champagne everyone…

6 Likes

That was the intention since the project change of hands. I am surprised they were able to do it this fast though.

1 Like

It’s common to keep personal dot files in a github repository, which I already do and am happy with.

It is increasingly looking like I need something like that for system config as well. I find myself writing scripts to generate other scripts, edit config files, generate unit files, etc which look something like this:

printf  '%s\n'                                        \
        '[Unit]'                                      \
        'Description=First Boot Configuration'        \
        'After=sysinit.target'                        \
        ''                                            \
        '[Service]'                                   \
        'Type=oneshot'                                \
        'ExecStart=/usr/local/bin/first-boot'         \
        'TimeoutSec=600'                              \
        ''                                            \
        '[Install]'                                   \
        'WantedBy=network.target'                     >\
        '/mnt/etc/systemd/system/first-boot.service'

or this:

sed --in-place                                                  \
    --expression  '/^Example/                 s/^/#/'           \
    --expression  '/^#LogSyslog/              s/^#//'           \
    --expression  '/^#LocalSocket[[:space:]]/ s/^#//'           \
    --expression  '/^#LocalSocketMode/        s/^#//'           \
    --expression  '/^#ExcludePath/            s/^#//'           \
    --expression  '/^# Default: scan all/ a\
ExcludePath ^/dev/'                                             \
    --expression  's/^#\(MaxDirectoryRecursion\).*/\1 0/'       \
    --expression  's@^#\(VirusEvent\).*$@\1 '"${ALERT_CMD}"'@'  \
    --expression  '/^#ExitonOOM/              s/^#//'           \
    '/mnt/etc/clamav/clamd.conf'

Which is fine for a couple things, but it’s getting to the point where I should have these in a repo and just pull them.

Anyway, does anyone do this? What’s the best approach? I’m thinking I might make one big repo for all of it, pull it somewhere into /usr/local/share/ and then either copy, hardlink or symlink files from there ad hoc.

hello, sysadmins, I was wondering something about docker and wanted to ask you guys

if I run mysql on docker, can I connect to it through workbench?

I imagine yes if you bind it to a interface with network access.

Oof

encrypted about 1,200 servers, stole 100 GB of unencrypted files, and deleted 20-30 TB Of backups

3 Likes

Have to migrate a bunch of Google Drive files from a personal drive to a shared drive. The --drive-server-side-across-configs flag in rclone is working well. Large file transfers are going at over 200MB/s (yes, big B). Granted, I’m sure the data isn’t actually moving and it’s just updating metadata, but still…

1 Like

looks nervously at prod systems

2 Likes

rclone’s new backend untrash command saved me today. I have a FreeNAS system that backups a server up to Google Drive. I unmounted the dataset for reasons I won’t get into. The rclone backup saw an empty folder and dumped the whole backup in the trash. I looked through the trash and it’s all unstructured, just a mess of files and folders. No hierarchy. I asked G Suite Google Workspace support if it’s possible to restore into the same folders and they said no.

Luckily rclone to the rescue! Untrashing in progress, but all looks good so far. Even if some of it is lost for whatever reason, I’ll obviously run the backup again. It would just take a really long time to completely reseed it.

1 Like


Cant get it to work for me

# dnf group info custom-environment
Environment Group: Custom Operating System
 Description: Basic building block for a custom CentOS system.
 Mandatory Groups:
   Core
 Optional Groups:
   Guest Agents
   Standard
# dnf group info minimal-environment
Environment Group: Minimal Install
 Description: Basic functionality.
 Mandatory Groups:
   Core
 Optional Groups:
   Guest Agents
   Standard

:thinking:

TIL

FreeBSD really doesn’t want you to install over existing partitions. It will not let me delete the swap partitions on these drives. Swap is completely off, yet it insists the partition is in use…

I’m just dding the whole drive. Small SSD how long can it take?

Are you trying to get rid of the swap partitions or just trying to re-initialize/clear them?

1 Like

I’m installing pfsense over an existing opnsense install. I was able to destroy all the partitions except swap. Using the auto-zfs option in the installer results in a “file exists” error and gpart destroy -F ada0 says the device is busy. I have issued swapoff -a and swapctl -l shows no swap in use. Nothing on the disks is mounted anywhere. I have also dd if=zero'd the beginning and end of the drives.

If there is a FreeBSD counterpart to partprobe I don’t know what it is. It’s possible that it has stale information about the partitions.

Yeah, it may be non-empty. If you intend to run a swap partition, continue your installation and then add the swap partition to the fstab and then swap on -a. Should attach with no issue. Otherwise, I assume that FreeBSD looks at this as a potential security issue or data leakage issue and is like, “Nope! I am not touching that one”.

You should be to use fdisk to remove it as well if you just want it gone. [code]fdisk /dev/ada[/coded]
p to print the partition and make sure you have the correct disk and then d (I think to delete a partition), and then w to write the changes. if you are not sure, type m to get a list of regular options. If that does not work, then you may have to load the advanced options to remove it.

i set a task in the sudo crontab to run a basic update.

45 8 * * * sudo apt-get update && sudo apt-get upgrade -y

How do i know it ran, & the sudo crontab file is stored in the /tmp/crontab.SAHomy/crontab file, is that where it is suppose to be stored?

you should switch to systemd timers for stuff like this as you can actually tell if a service ran.

also, the standout and standerr are not suppressed.

you don’t want to put sudo in the crontab because it will prompt for a password which will never arrive so it will just hang until crond crashes.

When ever you stick something in the root crontab you don’t need sudo.

it should look more like this:

# note: each time this runs it will overwrite the existing contents
45 8 * * * apt-get update -y -q > /var/log/apt_update.log 2>& && apt-get upgrade -y -q > /var/log/apt_upgrade.log 2>&1
2 Likes