I publish various services from my home server with Docker, so when OrbStack (Docker) does not work properly it seriously disrupts my daily work and my use of those services.
This time, when I tried to start OrbStack on macOS, not only did the Docker containers fail to come up, the app itself did not launch at all and quit immediately, which made me quite nervous.
Here I record how I investigated the cause and recovered.
[Read More]
Why Is This Port Open? Answering It in One Command with witr
Replace manual netstat workflows with witr’s single-command answers
Introduction: the late-night “what was this port again?” problem When you run servers, you repeatedly end up in the situation where you see an alert in the middle of the night, SSH into the machine, and think “what is listening on this port again?”
Until now I combined netstat / ss / lsof / nmap / systemctl / docker ps and worked out the identity and the origin of the process by hand.
Recently I started using a CLI tool called witr (Why is this running), and because it explains in a single command even why a process exists, my investigation flow has changed considerably.
[Read More]
No Matching Host Key Type Found After Upgrading to OpenSSH 8.8
OpenSSH 8.8 disables RSA signatures
I updated openssh with Homebrew on my Mac, and after the version went up I could no longer connect, with the error below.
Copy ERROR: Unable to negotiate with 192.168.1.10 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss The error did not appear for every destination; the ones I could no longer reach were those running relatively old operating systems.
SSH that can connect Copy $ ssh -V OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1k 25 Mar 2021 SSH that cannot connect Copy $ ssh -V OpenSSH_8.9p1, OpenSSL 1.1.1n 15 Mar 2022 Looking into it, the cause is that RSA keys with SHA-1 have been disabled since OpenSSH8.8
[Read More]
Creating Password-Protected ZIP Files on Linux and macOS
Creating a password-protected zip, and adding a password to an existing zip file
The other day, while self-hosting Bitwarden with Docker , I realised that leaving the data exported from LastPass and 1Password lying around as it is would be dangerous. Deleting it once it is no longer needed is probably the best answer, but I wanted to keep it as a backup, so I decided to save it as a password-protected zip.
Creating a password-protected zip When you want to create a password-protected zip from a file Copy $ zip -e sample.zip sample.txt Enter password:<enter the password> Verify password:<enter the password> adding: test (stored 0%) When you want to create a password-protected zip from a directory When a directory is involved you need to be careful, because if you forget the -r option you end up with an empty zip file
[Read More]
socket: too many open files When Starting Hugo on a Mac
Raising the macOS file descriptor limit so that hugo can start
When I tried to run a certain theme with Hugo on MacOS Sierra, the error below appeared and it would not start
Error: listen tcp 127.0.0.1:1313: socket: too many open files
Looking into it, it turned out that the ulimit on the Mac needs to be changed, and I solved it by referring to macOS Sierraでulimitを変更する方法 - Carpe Diem (in Japanese).
Changing the ulimit
# cat /Library/LaunchDaemons/limit.maxfiles.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>524288</string>
<string>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
# cat /Library/LaunchDaemons/limit.maxproc.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxproc</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxproc</string>
<string>2048</string>
<string>2048</string>
</array>
<key>RunAtLoad</key>
<true />
<key>ServiceIPC</key>
<false />
</dict>
</plist># chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
# chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist
# chmod 644 /Library/LaunchDaemons/limit.maxfiles.plist
# chmod 644 /Library/LaunchDaemons/limit.maxproc.plistRestarting the Mac
Checking the change
$ ulimit -a
Maximum size of core files created (kB, -c) 0
Maximum size of a process’s data segment (kB, -d) unlimited
Maximum size of files created by the shell (kB, -f) unlimited
Maximum size that may be locked into memory (kB, -l) unlimited
Maximum resident set size (kB, -m) unlimited
Maximum number of open file descriptors (-n) 524288
Maximum stack size (kB, -s) 8192
Maximum amount of cpu time in seconds (seconds, -t) unlimited
Maximum number of processes available to a single user (-u) 2048
Maximum amount of virtual memory available to the shell (kB, -v) unlimitedInstalling Ripgrep on Mac, CentOS and Debian
Installing ripgrep
Notes from installing Ripgrep(rg), which searches faster than grep, ack and silver_searcher, on several platforms
Mac Install it straight from homebrew (if homebrew is already installed)
Copy $ brew install ripgrep CentOS 7 On CentOS, ripgrep is not in the standard repositories or in epel, so install it as follows
Copy $ sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo $ sudo yum install ripgrep Debian 10 Copy # apt install ripgrep If your version of Debian9 or Ubuntu is old and the package is not in apt, use the following
[Read More]