dashwood.net -

Ryan Stefan's Micro Blog

Increasing File Limits on Linux Mint: Bind 24 too Many Open Files

Feb 102019

This problem has been driving me nuts for a while now, but on the bright side it caused me to close all of my files by habit. The solution to this problem should have been obvious, but like many things in my life, it just didn't click. The problem is that I was trying to change global OS settings from within a non-root account. You have to actually change the config files from the root account and give all sub-accounts the ability to raise their limits. Also note, that the command "sudo ulimit -n 9000000" does not work.


Temporarily extend limits by switching to root and typing:

ulimit -n 900000

It's better to extend it on all users though so that you don't have to do everything in root. It took me a while to figure this out because I was changing the config in my user account etc/config files, but you have to switch to root and change the config in there to change the allowed limits.

sudo su root
rmate limits.conf

Then add this to the file and save:

* soft nofile 900000
* hard nofile 900000
<user> soft nofile 900000
<user> hard nofile 900000
root soft nofile 900000
root hard nofile 900000

Windows WSL Tips and Solved Issues

Dec 222018

I've completely switched over to Windows 10 with WSL on my main development computer and it's going pretty well. I just cant stand coding in Windows because everything is different and nothing works as well as it does on Linux. My job requires a lot of design work so having my home computers on Linux was not very practical. So when I heard about a native Linux sub-system I jumped at it. I will be putting any issues that I solve in this article. 

Getting Rsub Working with Windows WSL & Ubuntu 18.04

  1. Add rsub to sublime with package control (on Windows)
  2. Install & configure rmate (on Linux)
  3. Install openssh-server (on Linux)
  4. configure ssh (on Linux)
  5. add bashrc script with sudo and -f (on Linux)

Installing & Rmate

pip install rmate
sudo nano /etc/rmate.rc


Install & Configure Openssh Server

sudo apt install openssh-server

sudo nano /etc/ssh/sshd_config

Port 2222
Protocol 2
PasswordAuthentication yes
StrictModes no


sudo nano /etc/ssh/ssh_config

Host *
  RemoteForward 52698 localhost:52698
Port 2222
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes

sudo service ssh --full-restart

Bashrc Configurations

sudo nano ~/.bashrc

Open any file with Sublime Text

I plan on expanding this so that it can open on other windows drives like E:/

function subl {
 CUR_PATH=`readlink -f $1`
 if [[ $CUR_PATH == /mnt/c/* ]]; then
 /mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe "C:${CUR_PATH:6}"
 sudo rmate $CUR_PATH -f

Convert and Open Shell Directory in Explorer

  • $() runs subshell function but leaves quotes around result
  • `` double ticks run the wslpath function in a subshell and strips quotes from result
  • $pwd is in quotes because directory spaces break the wslpath function
  • /$1 is an optional parameter for a subdir path
open() { explorer.exe `wslpath -w "$PWD"/$1`; }

Handy Bash Aliases

alias bashrc='subl ~/.bashrc' # open bashrc config
alias rbash='. ~/.bashrc' # reset bash shell to use changes

alias rbash='. ~/.bashrc' # reset bashrc in terminal
alias startredis='sudo service redis-server start'
alias stopredis='sudo service redis-server stop'

Windows Python Path Conflicting with Pipenv

This one is pretty annoying. I installed python 3.7 on my windows computer so that I could do linting on Sublime Text and it caused my pipenv to start using that path for the --three tag. I suppose I could have specified a different version, but I assumed there would be a way to turn off the windows python path inside WSL. I tried a few different ways, but none of them worked. I gave up and just made a bash function that points to my linux path:

##! Don't install packages with this, it will break dependency matching
pipenv3() { pipenv --python=/usr/bin/python3 install "$@"; }

Note: bash script variables won't work if you use single quotes like this -> '

Other Things

  • ConEmu as bash editor
  • DejaVu Sans Mono font for everything (11pt)
  • Started saving appdata inside Google Drive
  • win+x shows "Power Menu"
  • win+ → or win + ← fits window to half screen
  • display fusion allows shortcuts on secondary taskbar
  • stickies — sticky notes minimize to tray
  • Musicbee — Powerful music player that saves spot

Side Note about Pip

Something that has been bothering me for a while now is whether I should install pipenv with pip or pip3. Turns out that pip is not the python two version of pip, but rather a hybrid of both. So there is pip3, pip, and pip2. So the obvious answer is to install it using plain pip. 

"pip3 always operates on the Python3 environment only, as pip2 does with Python2. pip operates on whichever environment is appropriate to the context."

Use "sudo apt install pip" on Ubuntu — Doesn't work well on Mint

Setting up Postgresql Properly

sudo apt install postgresql
sudo service postgresql start
sudo su - postgres
createuser --superuser ryan
psql # <- command line tool for making queries
\password ryan
\q # <- exit psql to create new users/dbs or import/export db's (psql is for sql)
createdb ryan # or whatever# exit and now you can run psql in your own console with your username.

#start automatically
sudo systemctl enable postgresql

Setting up Redis

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install redis-server

sudo service redis-server start
sudo service redis-server stop
sudo service redis-server restart

# running just redis-server will force you to keep a bash window open
# I usually just create a bashrc alias for this /shrug

# for automatically starting redis enter

sudo systemctl enable redis-server