Saturday, September 28, 2019

Ubuntu 19.04 Upgrade - Fix Keyboard Mouse Not Responsive

- no title specified

 

To upgrade - first make sure that /etc/update-manager/release-upgrades,

has the following entry:

 Prompt=normal

 

 sudo apt update

 sudo apt upgrade

 sudo apt dist-upgrade

 

After upgrading to 19.04 - you may need to manually download

and install:

libpython3.7-minimal_3.7.3-2_amd64.deb
libpython3.7-stdlib_3.7.3-2ubuntu0.1_amd64.deb

 

** Before you log out **:

sudo apt install xserver-xorg-input-all

 

If you don't do the above here is how to break back in and fix

Ubuntu 19.04 without any mouse or keyboard response:

 

Shut it down and restart.

 At Ubuntu splash screen type "e".

 Add the word "single" after quiet on the kernel string (before splash).

 Log in.

 

If you are trapped in emergency mode at the boot prompt, try editing your fstab.

 First back up the old version: cp /etc/fstab /etc/old_fstab

 Remove all entries in the new file except for / and swap. vi /etc/fstab

 

You need to install further packages, enter:

 sudo systemctl set-default multi-user.target  

 

Reboot. This will cause Ubuntu to boot with a shell (no graphics loaded).

 

I'm fairly sure the key fix for me was:

 sudo apt install xserver-xorg-input-all

 

You may want to also install a few others for instance if you initially

chose LightDM and thereafter want to try gdm3, or install a new greeter

I recommend you use gdm3 as the default.

 

When done, put graphical mode back on:    

 sudo systemctl set-default graphical.target

 

Done! Reboot, hopefully mouse and keyboard are now working.

 

Don't forget to swap your fstab back.

Thursday, September 26, 2019

i3 - Start Application in Workspace

Alias to start an application in its own i3 workspace.
alias i3s='_(){ (($#<1))||[[ "${1}" =~ ^- ]]&&echo "Usage: i3s <workspace> <program>"&&return 1;local ws=${1:-0}; local prog=${2:-alacritty}; i3-msg "workspace ${ws}, exec QT_AUTO_SCREEN_SCALE_FACTOR=0 ${prog}";}; _' 

Friday, September 20, 2019

Xephyr + i3

This little alias works well for playing YouTube videos when you're programming in an i3 env.
[Don't forget to hit "f" after you start your favorite music playlist]
alias nest_win='_(){ local disp="${3:-1}";local tmpdir=$(mktemp -d);local prog="${2:-chromium-browser --user-data-dir=${tmpdir} http://www.youtube.com}";local win="${1:-460x340}";[[ "${1}" =~ ^- ]]&&echo "Usage: nest_win <win_size[default=460x340> <program[default=chromium-browser> <display[default=:1.0]>"&&return 1;(Xephyr :${disp#:} -ac -screen ${win} &> /dev/null & ); DISPLAY=:${disp#:} ${prog};}; _' 

Wednesday, September 4, 2019

Remove Duplicates

#!/usr/bin/env bash 

  ######################################################################
 ######################################################################
## Author: Adam M. Danischewski, Created Date: 20190904, Version: v1.1
## Major Revisions: 
## Last Modified: 2019-09-05
## Issues: If you find any issues emai1 me at my <first name> dot 
##         <my last name> at gmail dot com.  
##
## This script will scan the directory where it is run generating a list 
## of md5sum's for the files that are then sorted, for duplicates the 
## first in the list is kept, all duplicates are deleted and symbolically 
## linked to the kept file. 
##
## Note: Permissions are not checked, make sure you have enough 
## permissions to delete and create files where it is run. 
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
 ######################################################################
  ######################################################################


[[ "${1}" =~ ^- ]] && echo "Usage: ${0##*/} <file_frag_suffix (e.g. bsh)>" && exit 0

DUPES_FILE=/tmp/___dupes$$___
LOG_FILE=/tmp/___dupes_log$$___ 
pwd >> "${LOG_FILE}"
 ## Generate a list of files with their md5sum's sorted and dumped to DUPES_FILE  
find . -maxdepth 1 -type f -name "*${1}" -printf "%f\n" -exec md5sum {} \; 2>/dev/random | sort -k 1 > "${DUPES_FILE}"   
while read a; do 
 keep="" && while read b c; do 
  [[ -z "${keep}" ]] && keep="${c##*/}" && continue ## Keep the first entry
  echo "chattr -i \"${c##*/}\"" >> "${LOG_FILE}"
   ## In case it's invincible
  lsattr "${c##*/}" | grep -q '^----i' && sudo chattr -i "${c##*/}"  
  echo "rm \"${c##*/}\"" >> "${LOG_FILE}"
  rm "${c##*/}"
  echo "ln -s \"${keep}\" \"${c##*/}\"" >> "${LOG_FILE}"        
  ln -s "${keep}" "${c##*/}"
 done < <(grep "^${a}" "${DUPES_FILE}") 
done < <(awk '{print $1}' "${DUPES_FILE}" | uniq -d) 

exit 0