I recently discovered the `ts` command from the moreutils package. You can use it to prepend a timestamp to each line.
Category Archives: Sys Admin
The Six Dumbest Ideas in Computer Security
This is good: The Six Dumbest Ideas in Computer Security.
It referenced this, which is also good: Personal observations on the reliability of the Shuttle by R.P. Feynman.
Two simple ways to version control your MariaDB schema changes
Over on Two simple ways to version control your MariaDB schema changes I learned a neat hack you can use to check for database schema revisions by reporting off the binlog.
The example command given was:
$ mysqlbinlog --no-defaults -R -u foo -p -d foodb -h db.home.arpa mysqld-bin.000001 > foodb.txt
Repology, the packaging hub
Today I discovered Repology. It provides info on distribution repositories and their project versions.
Database Workbench from Upscene Productions
My copy of MySQL Workbench doesn’t play 100% nice with my MariaDB install, so I checked out the Database Workbench software recommended by MariaDB and in the end I downloaded a trial version. It runs okay under Wine, so gonna check it out.
Keep MacBook Pro running when lid is closed
Another dialog with ChatGPT:
How do I tell my MacBook Pro what to do when I close the lid?
You can configure what your MacBook Pro should do when you close the lid by following these steps:
- Click on the Apple menu () in the upper-left corner of your screen.
- Select “System Preferences” from the drop-down menu.
- Click on the “Energy Saver” icon.
- In the Energy Saver window, you should see a section called “Battery” and “Power Adapter”.
- Click on the “Battery” or “Power Adapter” tab, depending on your needs.
- From the drop-down menu next to “When I close the lid” option, choose the action you want your MacBook to take when you close the lid.
You can select one of the following options:
- Sleep: This will put your MacBook to sleep when you close the lid.
- Display sleep: This will turn off the display but keep the MacBook running.
- Do nothing: This will keep your MacBook running as if the lid is still open.
Once you’ve made your selection, close the System Preferences window, and your MacBook Pro will now follow the setting you selected when you close the lid.
How do I tell macOS High Sierra what to do when I close the lid?
To configure what your MacBook should do when you close the lid on macOS High Sierra, you can follow these steps:
- Click on the Apple menu () in the upper-left corner of your screen.
- Select “System Preferences” from the drop-down menu.
- Click on the “Energy Saver” icon.
- In the Energy Saver window, you will see a section called “Battery” and “Power Adapter”.
- Click on the “Battery” or “Power Adapter” tab, depending on your needs.
- From the drop-down menu next to “When I close the lid” option, select the action you want your MacBook to take when you close the lid.You can choose one of the following options:
- Sleep: This will put your MacBook to sleep when you close the lid.
- Display sleep: This will turn off the display but keep the MacBook running.
- Do nothing: This will keep your MacBook running as if the lid is still open.
Once you’ve made your selection, close the Energy Saver window. Your MacBook will now follow the setting you selected when you close the lid.
Note that the steps to configure the lid close behavior may vary slightly depending on the version of macOS you are using, but they are similar for most versions.
There is no “When I close the lid” option.
If you are not able to find the “When I close the lid” option on your MacBook running macOS High Sierra, it’s possible that your MacBook is not compatible with this feature.
Alternatively, it’s also possible that the “When I close the lid” option is hidden, and you can access it by using the Terminal app. Here’s how you can do it:
- Open the Terminal app. You can find it in the Utilities folder in the Applications folder, or you can use Spotlight to search for it.
-
Type the following command in the Terminal window:
sudo nvram boot-args=”iog=0x0″
- Press Enter and then enter your administrator password when prompted.
- Restart your MacBook.
- After restarting, go to System Preferences > Energy Saver, and you should see the “When I close the lid” option.
Once you have made your selection, you can revert the changes by opening the Terminal app and running the following command:
sudo nvram -d boot-args
Then restart your MacBook to apply the changes.
What does the following do? sudo nvram boot-args=”iog=0x0″
The command “sudo nvram boot-args=”iog=0x0″” sets a specific parameter in the system’s NVRAM (Non-Volatile Random Access Memory) that tells macOS to enable the “When I close the lid” option in the Energy Saver preferences.
By default, on some Mac models, this option is not visible in the Energy Saver preferences because it’s disabled in the firmware. This command changes the firmware settings and enables the “When I close the lid” option in the Energy Saver preferences.
Specifically, the “iog=0x0” parameter tells macOS to ignore the sensor that detects when the lid is closed, allowing the system to keep running even when the lid is closed. This can be useful if you want to keep your MacBook running when you close the lid, for example, if you are using an external display and want to keep the MacBook’s lid closed to save desk space.
It’s important to note that changing the NVRAM settings can potentially cause issues with your system, so it’s recommended to follow the steps carefully and only make changes if you understand the consequences.
I get this error: nvram: Error setting variable – ‘boot-args’: (iokit/common) general error
If you encounter the “nvram: Error setting variable – ‘boot-args’: (iokit/common) general error” message when trying to run the command “sudo nvram boot-args=”iog=0x0″”, it’s possible that your system is not allowing you to change the NVRAM settings.
Here are some possible reasons for this error and solutions to fix it:
- System Integrity Protection (SIP) is enabled: If you are running macOS High Sierra or later, SIP is enabled by default and prevents modifications to the NVRAM settings. To disable SIP, you will need to restart your MacBook in Recovery mode (hold down Command + R during startup), launch Terminal from the Utilities menu, and enter the command “csrutil disable” in the Terminal window. After disabling SIP, you can try the nvram command again. However, it’s important to note that disabling SIP can make your system more vulnerable to security threats, so it’s recommended to re-enable it after you’re done with the NVRAM changes.
- Third-party software conflict: Some third-party software, such as anti-virus or system utilities, can conflict with the NVRAM settings and prevent changes. Try quitting these applications and running the nvram command again.
- Hardware issue: In some cases, the “general error” message can indicate a hardware issue with the system’s NVRAM or other components. If none of the above solutions work, you may need to contact Apple Support or take your MacBook to an Apple Authorized Service Provider for further diagnosis.
Replacing ZFS disk
Over on How to replace a failed disk in a ZFS mirror I found this command:
# sudo zpool replace -f storage 18311740819329882151 /dev/disk/by-id/ata-WDC_WD80EFAX-68LHPN0_7HJSWL7F
I’m gonna need that later on.
The number is the old device and the path is the new device.
Update. This is done.
------------------- Tue Feb 21 21:31:53 [bash:5.1.16 jobs:0 error:0 time:3] root@order:/home/jj5 # zpool replace -f data 12987390290044433012 /dev/disk/by-id/ata-WDC_WD30EFZX-68AWUN0_WD-WX72D1273L06 ------------------- Tue Feb 21 21:55:32 [bash:5.1.16 jobs:0 error:0 time:1422] root@order:/home/jj5 # zpool status pool: data state: DEGRADED status: One or more devices is currently being resilvered. The pool will continue to function, possibly in a degraded state. action: Wait for the resilver to complete. scan: resilver in progress since Tue Feb 21 21:34:26 2023 749G scanned at 605M/s, 88.2G issued at 71.1M/s, 5.71T total 27.9G resilvered, 1.51% done, 23:01:31 to go config: NAME STATE READ WRITE CKSUM data DEGRADED 0 0 0 raidz1-0 DEGRADED 0 0 0 ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0D8E3C9 ONLINE 0 0 0 replacing-1 DEGRADED 0 0 0 12987390290044433012 UNAVAIL 0 0 0 was /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N2473766-part1 ata-WDC_WD30EFZX-68AWUN0_WD-WX72D1273L06 ONLINE 0 0 0 (resilvering) ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0D5506W ONLINE 0 0 0 cache ata-WDC_WDS120G1G0A-00SS50_171905A00F49-part4 ONLINE 0 0 0 errors: No known data errors -------------------
SMART error on disk used with ZFS and mdadm
So I joined superuser.com to ask a question: SMART error on disk used with ZFS and mdadm.
Firefox snap, Ubuntu, EPSON printer not available
So I had to repave my primary workstation to fix a problem with my ZFS configuration (my ashift setting was causing problems) and things are mostly back online, but I wasn’t able to print from firefox for some reason.
I think the problem was that I had installed firefox prior to adding the printer. Anyway, long story short, this command seemed to fix the problem for me:
# snap connect firefox:cups-control
ZFS Performance
Found a good writeup on various ZFS performance options: ZFS Performance: Mirror VS RAIDZ VS RAIDZ2 vs RAIDZ3 vs Striped.