Reddragon - Ubuntu

From miki
Jump to navigation Jump to search

Introduction

This is the configuration page for the Ubuntu partition on RedDragon.

Configuration Files

All configuration files can be found here.

Repositories

Installed Applications

Common Essential:
[2011-11-16] Opera (opera) [2011-11-16] v 11.00.1156
[2011-11-16] etckeeper (etckeeper) Configured to use git as SCM
[2011-11-16] GIT (git git-gui gitk git-doc)
[2011-11-16] Google Chrome (chromium-browser)
[2011-11-16] Midnight Commander (mc) See reference page. Use vi as standard viewer/editor. Installed version from mc official repository to fix file highlighting issue.
[2011-11-16] Vim (vim, exuberant-ctags, vim-gnome) including GVim to enable support of X clipboard
[2011-11-16] Ruby (ruby) ... for Vim plug-in snipMate.vim
[2011-11-16] Vim/Cscope (cscope)
[2011-11-16] Samba (smbclient smbfs)
[2011-11-16] NFS Server (nfs-kernel-server nfs-common portmap) See NFS for more details; Created entries in /etc/exports.
[2011-11-16] AutoFS (autofs) See local config
[2011-11-16] KeePassX (keepassx)
[2011-11-16] apt-file (apt-file)
[2011-11-16] SSH (ssh) Local settings
[2011-11-16] Thunderbird (thunderbird)
[2011-11-16] Meld (meld) Diff tool
[2011-11-16] Color Diff (colordiff)
[2011-11-16] p7zip (p7zip-full p7zip-rar)
[2011-11-16] dlocate (dlocate)
[2011-11-16] MS Truetype core fonts (ttf-msttcorefonts-installer)
[2011-11-16] Ubuntu restricted extras (ubuntu-restricted-extras) shall install automatically libdvdread4
[2011-01-18] libdvdcss2 Installed via sudo /usr/share/doc/libdvdread4/install-css.sh (see also [1])
[2011-11-16] Qiv (qiv)
[2011-11-16] gThumb (gthumb)
[2011-11-16] GPG Agent (gnupg-agent) Added use-agent at end of ~/.gnupg/gpg.conf
[2011-11-16] Rename utils (renameutils)
[2011-11-16] Wine (wine) See Wine page
[2011-11-16] Gnome Terminator (terminator) See Gnome Terminator
[2011-11-16] Flash Plugin 10 (flashplugin-installer) First need to enable Ubuntu partner repository (deb http://archive.canonical.com/ubuntu lucid partner). Next
sudo aptitude autoremove "flashplugin-*"
sudo aptitude install flashplugin-installer
[2011-11-16] MPlayer (mplayer mplayer-doc mplayer-fonts)
[2011-11-16] Quicktime plugin (gnome-mplayer,gecko-mediaplayer) To play Quicktime content in Opera, Firefox
[2011-11-16] Gimp (gimp)
[2011-11-16] Graphical Disk Map (gdmap)
[2011-11-16] gparted (gparted)
Dist-upgrade to Precise Pangolin
[2012-04-18] Bumblebee (bumblebee bumblebee-nvidia)
[2013-05-28] mini upnp (miniupnpc) For remote support script
[2013-05-28] vnc server (vnc4server) For remote support script
Local applications:
[2011-11-16] GNU Go (gnugo)
[2011-11-16] Various Go games (qgo uligo)
[2011-11-16] Quarry (quarry) Board games Go, Amazons, and Reversi
[2011-11-16] XBMC (xbmc xbmc-standalone) See local page
[2011-11-16] fdupes (fdupes)
[2011-11-16] PGP (pgpgpg)
[2011-11-16] Synergy (synergy) [2011-03-04] v1.4.5! See local settings.
[2011-11-16] Perl Audio Converter (pacpl)
[2011-11-16] PowerTop (powertop)
[2011-11-16] Gnome Tweak Tool (gnome-tweak-tool) To change default font size...
[2011-11-16] XScreensaver (xscreensaver xscreensaver-gl-extra xscreensaver-data-extra) First remove gnome screensaver (sudo apt-get remove gnome-screensaver). Then set the screensaver as startup app (xscreensaver -nosplash). Select glslideshow. [2], [3], [4]
Dist-upgrade to Precise Pangolin



Un-installed applications (by uninstall date):

[YYYY-MM-DD] Application (package) [YYYY-MM-DD] uninstalled (reason)

Simple Settings

  • [2009-10-19] - Enabled proprietary video device driver NVIDIA (version 280).
  • [2013-05-18] - Enable audio head-phone (see [5]). Edit file /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf as follows:
[Element Speaker]
switch = on
volume = ignore
  • Printer — add Canon network printer (select IPP network printer via DNS-SD for protocol).
    • Set Color Model to CMYK

Detailed System Settings

1st install

  • INSTALL LOG

File System

  • To be completed

Network

  • To be completed

Preferences

  • To be completed

Users

  • Added to group users (for write access to mnemosyne):
    mich

Printer / CUPS shit

  • Go to http://localhost:631
  • Set default policy to abort-job (was on retry-job)
    • Go to PrintersCanon-MG5300-seriesAdministrationSet default optionsPoliciesError Policy = abort-job
  • April 5, 2020
  • Still the same issue.
  • Set printer policy of all printer to retry-this-job (/etc/cups/printers.conf)
  • In mich user crontab, added:
# m h  dom mon dow   command
@reboot   sleep 15 && ~/bin/cups-cron-enable&
  • The script ~/bin/cups-cron-enable:
#! /bin/bash

BASE=$(basename "$0")
LOGDIR=~/.cache/$BASE
LOG=~/.cache/$BASE/$BASE.log

mkdir -p "$LOGDIR"
touch $LOG

cat > $LOGDIR/logrotate.conf << __END__
compress
$LOG {
    rotate 5
    weekly
}
__END__
logrotate -s $LOGDIR/logrotate.status $LOGDIR/logrotate.conf

check_all_printers()
{
    lpstat -p | \
    while read TAG PRINTER MORE; do
        if [ "$TAG" = "printer" ]; then
            if [[ "$MORE" =~ disabled ]]; then
                echo -n "[$(date)] $PRINTER: disabled -- restarting"
                cupsenable "$PRINTER" && echo "ok" || echo "FAILED"
            fi
        fi
    done
}

while : ; do
    check_all_printers
    sleep 5
done >> $LOG

Detailed Application Settings

HDMI support

  • Create a desktop shortcut launching ~/bin/xdisplay.sh hdmi.

Screensaver

  • gnome-screensaver does not work anymore. It simply show a black screen
  • Use xscreensaver instead, and select glslideshow for a slideshow.
 sudo apt-get remove gnome-screensaver
 sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
  • UPDATE ISSUES — viewer used by glslideshow maintains a cache at ~/tmp/.xscreensaver-getimage.cache. Delete that file when updating the set of images in the slideshow.

Using xscreensaver without OpenGL

  • Package chbg does not exist anymore.
  • I could build package xv, but it does nothing under xscreensaver.
  • Use package qiv. Add the following line in .xscreensaver:
  qiv -s -r -S -d 10  -f -u -l -t -i      \
          $HOME/Slideshow               \n\
  • Select qiv as screensaver.

Apparently qiv does not work well with sub-folders. I use the following script (autoln):

#! /bin/bash
#
# Usage: autoln /path/to/file /path/to/second/file [...]
#
#        will create the following symbolic links:
#
#        _path_to_file         --> /path/to/file
#        _path_to_second_file  --> /path/to/second/file

while [ -n "$1" ]; do
    target="$1"
    symlink=${target//\//_}
    ln -ns "$target" "$symlink"
    shift
done

In the command line:

find -L /home/mich/Slideshow -type f -print0  | xargs -0 autoln

Remote support

New method

We call remote the remote laptop to which we will connect, and local the laptop we connect from. server is the intermediate ssh server.

  • On server, add to .ssh/authorized_keys:
no-pty,no-X11-forwarding,permitopen="localhost:54895",command="/bin/echo do-not-send-commands" ssh-rsa PUBLIC_KEY_HERE username@remoteserver
  • On remote, start automatically autonoekeon.sh at boot:
#! /bin/bash

autossh -M 0 -f -N -n -q -R 54895:localhost:22 immie    # or 'ovhi'
  • On local, setup a 2nd SSH forwarding link:
autossh -M 0 -f -N -n -q -L 22221:localhost:54895 ovhi

This being done, one can either start an SSH-only session, or an SSH+VNC session:

  • On local, to start an SSH session only:
ssh -p 22221 mich@localhost
  • On local, to start an SSH and VNC session:
# SSH connect to remote + fwd some vnc ports
ssh -p 22221 -L 5900:localhost:5900 -L 5631:localhost:631 -L 5901:localhost:5901 mich@localhost          
# Old method:
#   export DISPLAY=:0
#   xhost +
#   sudo x11vnc -safer -localhost -nopw -once -auth /var/lib/gdm/:0.Xauth -display :0
x11vnc -safer -localhost -nopw -once -tightfilexfer -auth ~/.Xauthority -display :0
  • In a separate terminal on local, starts the vnc viewer:
#vncviewer localhost:0
xtightvncviewer -compresslevel 0 -bgr233 -quality 0 localhost:0
To try — x11vnc client-side caching
******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
old solution — Troubleshooting on scarlet box
  • Open a browser, and go to local.gateway. Go to LAN servers. Check that port 12322 is re-routed to server's port 22
old solution — How to connect

(note: previous config used to send an e-mail to michael.peeters@noekeon.org with instructions, but this does not work anymore. Now it creates a gpg file on noekeon.org)

  • Download gpg file, then view content for instructions:
scpn @/mip.txt.gpg .
gpg -d mip.txt.gpg >mip.txt


old solution — Configuration on the server
  • Disable strict host key checking for noekeon (to allow ssh connection even if host key changed):
Host ftp.noekeon.org   noekeon
     User                    daemenj
     HostName                ftp.noekeon.org
     StrictHostKeyChecking   no
  • autonoekeon.sh is run automatically at logon:
#! /bin/bash

autossh -M 0 -f -N -n -q -R 54895:localhost:22 noekeon
To connect, first setup port forwarding, then connect via localhost:
autossh -M 0 -f -N -n -q -L 22221:localhost:54895 noekeon
ssh mike@localhost -p 22221
  • Port forwarding also allows to connect to router and cups server:
autossh -M 0 -f -N -n -q -L 8080:192.168.1.1:80 -p 22221 mich@localhost   # Access remote router      via localhost:8080
autossh -M 0 -f -N -n -q -L 8081:localhost:631 -p 22221 mich@localhost    # Access remote cups server via localhost:8081
  • Script on desktop to setup vnc remote (vnctunnelnoekeon):
#! /bin/bash

# Save current stdout / stderr
exec 3>&1
exec 4>&2

# Redirect stdout / stderr
exec > >(tee /tmp/stdout.tmp)
exec 2> >(tee /tmp/stderr.tmp >&2)

# Deleting current .ssh/known_hosts
echo "Deleting current .ssh/known_hosts"
rm .ssh/known_hosts

# Open a vncserver
echo "Opening a virtual desktop for remote desktop sharing..."
vnc4server :1 -geometry 1440x900 -depth 8 -rfbport 5901

# TRAP EXIT --> Will remove port forwarding and kill the VNC server
trap "upnpc -d 12322 TCP; vnc4server -kill :1; rm /tmp/vnctunnelnoekeon-tail-f.tmp" EXIT

# Tunnel the VNC + local SSH Server connection through noekeon ssh
# ... SSH tunnel will remain open for 5min after which it will be automatically closed if no connection is made
ssh -f -n -R12301:localhost:5901 -R12322:localhost:22 noekeon sleep 300
# Wait a bit so that error message don't mess up my text below...
sleep 2

echo "################################################################################"
IPLOCAL=$(getlocalip.sh)
echo "Local IP address: $IPLOCAL"
IPPUBLIC=$(getpublicip.sh)
echo "Public IP address: $IPPUBLIC"
echo "################################################################################"
echo "Opening port 12322 on UPNP:"
upnpc -a "$IPLOCAL" 22 12322 TCP | tail -n 1
echo "################################################################################"

#Stop tee redirection
exec >&3
exec 2>&4

#Mail the current session to me
MAILSERVER=smtp.scarlet.be
FROM=michel.roch@scarlet.be
TO=michael.peeters@noekeon.org
echo "Sending mail to $TO..."
exec 5<>/dev/tcp/${MAILSERVER}/25
cat <&5 >/dev/null &
sleep 1
echo -e "HELO dummy.domain" >&5
sleep 1
echo -e "MAIL FROM: $FROM" >&5
sleep 1
echo -e "RCPT TO: $TO" >&5
sleep 1
echo -e "DATA" >&5
sleep 1
echo -e "subject: IP Addresses" >&5
echo -e "" >&5
echo -e "LOCAL IP Address: $IPLOCAL" >&5
echo -e "PUBLIC IP Address: $IPPUBLIC" >&5
echo -e >&5
echo -e "Connect with 'ssh -p 12322 username@$IPPUBLIC'" >&5
echo -e >&5
echo -e >&5
echo -e "Content of stdout:" >&5
echo -e "---------------------------------------------------------------------" >&5
cat /tmp/stdout.tmp >&5
echo -e "---------------------------------------------------------------------" >&5
echo -e >&5
echo -e "Content of stderr:" >&5
echo -e "---------------------------------------------------------------------" >&5
cat /tmp/stderr.tmp >&5
echo -e "---------------------------------------------------------------------" >&5
echo -e "." >&5
sleep 1
echo -e "QUIT" >&5
sleep 1
echo '... mail sent (hopefully)!'
echo

# Cleaning...
rm /tmp/stdout.tmp
rm /tmp/stderr.tmp

# kill it when the user press a key
echo "========================================================================"
# tail file to duplicate edit session. Eg:
# 1. Connect to $IPPUBLIC
# 2. tee stderr
#    exec 2> >(tee /tmp/vnctunnelnoekeon-tail-f.tmp >&2)
# 3. Redirect stdout
#    exec >&2
# 4. From now, current terminal will duplicate login terminal
touch /tmp/vnctunnelnoekeon-tail-f.tmp
tail -f /tmp/vnctunnelnoekeon-tail-f.tmp &
read -p "Press ENTER to close the desktop sharing session..." ignore
# No need to kill VNC / UPNP port forwarding, will be done on EXIT signal trap
# ssh will exit automatically

To Do

Issues

See Common Issues.

To Do

None.