Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux [2019/02/15 21:06] paul [Install] |
linux [2019/12/28 23:23] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Linux ====== | ||
+ | |||
+ | Linux is a beautiful example of clean engineering. Form follows function and | ||
+ | function follows coherent thoughts. The following is a collection of notes. | ||
+ | |||
+ | ===== Adding passwordless users ===== | ||
+ | |||
+ | To add a sudo user that doesn' | ||
+ | |||
+ | <code bash> | ||
+ | sudo adduser usernameyoulike | ||
+ | # give the user any temp password | ||
+ | # the following command removes the password | ||
+ | sudo passwd -d usernameyoulike | ||
+ | # add the user to the sudoers list | ||
+ | usermod -aG sudo usernameyoulike | ||
+ | </ | ||
+ | |||
+ | ===== udev ===== | ||
+ | |||
+ | I fell in a deep rabbit hole with '' | ||
+ | comprehensive guide about '' | ||
+ | |||
+ | To get all the information about a USB device: | ||
+ | |||
+ | <code bash> | ||
+ | udevadm info -a -p $(udevadm info -q path -n / | ||
+ | </ | ||
+ | |||
+ | Some commands have changed since the bible has been written. | ||
+ | |||
+ | To test, you can use the test function of '' | ||
+ | it the top level device path in '' | ||
+ | Primo and showing up as '' | ||
+ | '' | ||
+ | command above and substitute in the port name. | ||
+ | |||
+ | To test an Arduino: | ||
+ | <code bash> | ||
+ | udevadm test / | ||
+ | </ | ||
+ | |||
+ | To restart the '' | ||
+ | <code bash> | ||
+ | sudo udevadm control --reload-rules && udevadm trigger | ||
+ | </ | ||
+ | |||
+ | You will still need to unplug/ | ||
+ | |||
+ | Some pitfalls I came across. You cannot change device names! You can only add | ||
+ | symlinks to them. The symlink did not work for the Tara uvc_camera. I think this is | ||
+ | issue has to do with the fact that the Tara has some weird shit with the way the | ||
+ | USB host onboard handles the two cameras. | ||
+ | |||
+ | Here's some other commands: | ||
+ | |||
+ | Lists the possible device attribute keys and their values along with the | ||
+ | parents of the device. | ||
+ | |||
+ | <code bash> | ||
+ | udevadm info --attribute-walk / | ||
+ | </ | ||
+ | |||
+ | Lists the device attributes and their values. | ||
+ | <code bash> | ||
+ | udevadm info -a /dev/video0 | ||
+ | </ | ||
+ | |||
+ | Reload udev rules | ||
+ | <code bash> | ||
+ | udevadm control --reload-rules && udevadm trigger | ||
+ | </ | ||
+ | |||
+ | ==== USB Information ==== | ||
+ | |||
+ | To get info on '' | ||
+ | |||
+ | <code bash> | ||
+ | cat / | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # Arduino with Encoder code | ||
+ | # For some readon the serial thingy doesn' | ||
+ | # SSUBSYSTEMS==" | ||
+ | # SUBSYSTEMS==" | ||
+ | |||
+ | SUBSYSTEMS==" | ||
+ | # Add a symlink to the stereo camera. This doesn' | ||
+ | # need to reference the device ID. | ||
+ | </ | ||
+ | |||
+ | When doing '' | ||
+ | permissions haven' | ||
+ | |||
+ | Shows the USB version of the devices with that vendor id: | ||
+ | <code bash> | ||
+ | sudo lsusb -v | grep 2560 -A 10 | grep bcdUSB | ||
+ | </ | ||
+ | |||
+ | ===== cron ===== | ||
+ | |||
+ | Cron is used to automate the running of jobs. | ||
+ | |||
+ | I use it to run a backup script and a VimWiki html generate script. | ||
+ | |||
+ | To add a job to cron you must edit the crontab file. You do this by running the | ||
+ | following command: | ||
+ | |||
+ | <code bash> | ||
+ | crontab -e | ||
+ | </ | ||
+ | |||
+ | This will load up the default editor (you can change this to be vim by running export | ||
+ | EDITOR=vim) and open the crontab file. | ||
+ | |||
+ | Cron has an interesting way of setting up timing intervals, look this up online. | ||
+ | Here's some examples: | ||
+ | |||
+ | <code bash> | ||
+ | # Run every minute | ||
+ | *\1 * * * * ~/ | ||
+ | |||
+ | # Run on the 45th minute of every hour | ||
+ | 45 * * * * ~/ | ||
+ | </ | ||
+ | |||
+ | To check the cron logs, type the following: | ||
+ | |||
+ | <code bash> | ||
+ | grep CRON / | ||
+ | </ | ||
+ | |||
+ | This will show you what jobs where run last. Cron discards the output of these jobs | ||
+ | if no MTA is setup, and don't worry about this. | ||
+ | |||
+ | ===== Display Manager ===== | ||
+ | |||
+ | I use the XFCE display manager because it was the only one that allowed my | ||
+ | laptop dock and 2 external monitor system to work properly. | ||
+ | |||
+ | ==== Workspaces ==== | ||
+ | |||
+ | Set the number of rows in the workspace to 2. That way you get a nice grid. | ||
+ | |||
+ | ==== Terminal ==== | ||
+ | |||
+ | I use the '' | ||
+ | that resides in '' | ||
+ | |||
+ | ===== Moving Windows ===== | ||
+ | |||
+ | To move windows around we need the following packages. | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt-get install xdotool | ||
+ | sudo apt-get install wmctrl | ||
+ | </ | ||
+ | |||
+ | Get the move window script from storage. | ||
+ | Add following keyboard shortcut application commands: | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | This information was gathered from [[http:// | ||
+ | |||
===== Taskwarrior and Timewarrior ===== | ===== Taskwarrior and Timewarrior ===== | ||
I use taskwarrior and timewarrior as a task keeping daily | I use taskwarrior and timewarrior as a task keeping daily | ||
- | ==== Install | + | ==== Installing |
Use pre-built debians for both taskmanager and timewarrior. You have to copy a file to get taskwarrior to use timewarrior. | Use pre-built debians for both taskmanager and timewarrior. You have to copy a file to get taskwarrior to use timewarrior. | ||
Line 11: | Line 180: | ||
</ | </ | ||
+ | ===== Remote Desktop ===== | ||
+ | |||
+ | I have tried every remote desktop option I could find. The best solution in | ||
+ | terms of ease of use, performance, | ||
+ | case here's a bunch of notes of ones I've tried. | ||
+ | |||
+ | ==== VNC Notes ==== | ||
+ | |||
+ | Using default VNC server on Linux machine. Using xvnc4viewer (RealVNC viewer) on | ||
+ | xubuntu (xfce) desktop. | ||
+ | |||
+ | using the x11 VNC server on the server. Port 5900 and 5901. | ||
+ | |||
+ | Running into security issues with the VNC server stuff. Tried: | ||
+ | |||
+ | VNC-Server: | ||
+ | * x11vnc with ssl | ||
+ | * tightvncserver | ||
+ | |||
+ | Viewer: | ||
+ | * realvnc viewer (vncviewer) | ||
+ | * xtightvncviewer | ||
+ | * remmina VNC viewer | ||
+ | |||
+ | I keep getting " | ||
+ | |||
+ | Trying out the RealVNC server and viewer. Installing RealVNC on Primo using wget and a | ||
+ | Debian pkg. Gave up on installing RealVNC because you need the premium version for | ||
+ | headless operation which is what I have. | ||
+ | |||
+ | The server that worked was this: | ||
+ | |||
+ | <code bash> | ||
+ | sudo x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Issue is getting the x11vnc server to load before a login has occurred, which is what | ||
+ | makes all this VNC shit complicated. | ||
+ | |||
+ | I used vncviewer on the client computer to talk to it. | ||
+ | |||
+ | Problem is that it is slow. I don't think there is anything we can do it. It is also | ||
+ | slow through the LAN. I've attributed this issue to running headless. | ||
+ | |||
+ | ===== Headless Operation ===== | ||
+ | |||
+ | I ran into a bunch of issues by running the Primo computer headless, meaning without a | ||
+ | display attached to it. The first time I noticed this was when I ran the computer | ||
+ | without a display attached to it. It would run extremely slow when trying to remote | ||
+ | into it. I then would plug in a display and bam, everything would run nice | ||
+ | and fast. | ||
+ | |||
+ | The reason for this is because without a display attached, the onboard GPU does not | ||
+ | properly initialize. Everything relating to graphics becomes slow when running | ||
+ | headless. X forwarding is slow, steaming video is slow, remote desktop with team | ||
+ | viewer and VNC, and any remote video stuff. | ||
+ | |||
+ | To diagnose the problem we see what drivers are being used for the graphics | ||
+ | operation. | ||
+ | |||
+ | <code bash> | ||
+ | glxinfo|egrep " | ||
+ | </ | ||
+ | |||
+ | If no hardware acceleration is detected, such when using a non professional grade | ||
+ | display, a virtual driver such as this one will be detected: | ||
+ | |||
+ | < | ||
+ | OpenGL vendor string: VMware, Inc. | ||
+ | OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.8, 256 bits) | ||
+ | </ | ||
+ | |||
+ | To solve this problem I found the following solutions: | ||
+ | |||
+ | ==== Dummy Plug ==== | ||
+ | |||
+ | There are cheap dummy plugs that trick the video card into thinking that there | ||
+ | is a display attached. | ||
+ | The[[https:// | ||
+ | Ghost]] is one of them. I bought the | ||
+ | [[https:// | ||
+ | knockoff from Amazon]] which worked great. | ||
+ | |||
+ | ==== Use a Display ==== | ||
+ | |||
+ | The other obvious solution is to use a display. I purchased an | ||
+ | [[http:// | ||
+ | the Raspberry Pi for 40 bucks]]. | ||
+ | |||
+ | ===== CLI Shortcuts ===== | ||
+ | |||
+ | Here are some command line shortcuts. | ||
+ | * $_ gives the argument of the last command | ||
+ | * . (dot command) same as source. This executes a list of commands. That is all. | ||
+ | * use ssh -X if you want to ssh with an X server | ||
+ | |||
+ | To remove all files except for one in '' | ||
+ | |||
+ | <code bash> | ||
+ | setopt extendedglob | ||
+ | rm -- ^file.txt | ||
+ | </ | ||
+ | |||
+ | ==== Clipboard ===== | ||
+ | |||
+ | To pump out contents of file to clipboard: | ||
+ | <code bash> | ||
+ | sudo apt install xclip | ||
+ | cat file | xclip -selection clipboard | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Window File Subsystem for Linux ====== | ||
+ | |||
+ | This thing is awesome! | ||
+ | |||
+ | For setting up ssh keys, xclip doesn' | ||
+ | <code bash> | ||
+ | clip.exe < ~/ | ||
+ | </ | ||
+ | |||
+ | ===== SSH Access ===== | ||
+ | |||
+ | For setting up external ssh access I did the following: | ||
+ | |||
+ | Reinstall openssh for some reason: | ||
+ | <code bash> | ||
+ | sudo apt-get purge openssh-server | ||
+ | sudo apt-get install openssh-server | ||
+ | </ | ||
+ | |||
+ | From an elevated powershell I ran this to change the port to 2222 to not | ||
+ | interfere with any windows services: | ||
+ | <code bash> | ||
+ | New-NetFirewallRule -DisplayName "Allow Inbound Port 2222" -Direction Inbound -LocalPort 2222 -Protocol TCP -Action Allow | ||
+ | </ | ||
+ | |||
+ | I added the following to sshd_config: | ||
+ | |||
+ | <code bash> | ||
+ | Port 2222 | ||
+ | PermitRootLogin no | ||
+ | AllowUsers paul | ||
+ | </ | ||
+ | |||
+ | I created an authorized hosts file and imported the keys. | ||
+ | |||
+ | I tested the connection by running this on the server: | ||
+ | <code bash> | ||
+ | sudo service ssh stop | ||
+ | sudo / | ||
+ | </ | ||
+ | |||
+ | Then on the client I ran a debug version of an ssh server to see if I was | ||
+ | receiving incoming connections. | ||
+ | <code bash> | ||
+ | ssh name@server -p 2222 | ||
+ | </ | ||
+ | |||
+ | I then monitored the server and make sure I could see the connection. The debug | ||
+ | client quit out cause it didn't have correct paths to the keys, but the test was | ||
+ | a success cause it validated the port pass through. I then restarted the regular | ||
+ | service like this: | ||
+ | |||
+ | <code bash> | ||
+ | sudo service ssh start | ||
+ | </ | ||