Turn off all monitors while watching VLC media on TV

I've created a script that slowly dims two monitors after 5 minutes of keyboard or mouse inactivity while you watch a movie on a third monitor. When you move your mouse or use your keyboard the two dimmed monitors quickly brighten (but not suddenly to shock you).
Sample status screen

Before you think I watch too much TV note this is a laptop and the program has been running for many days and the laptop is suspended / resumed twice a day at least.
Setup Instructions

Save the script below to a filename in your path such as /usr/local/bin/movie.sh or /home/your_user_name/bin/movie.sh and then use:
chmod a+x /path/to/script/movie.sh

Xorg's package xprintidle is required to track how long your computer has been idle since a mouse movement or keyboard activity:
sudo apt install xprintidle

Then to launch the script use:
movie.sh

Note: When testing, change TIME_TO_FADE from 200000 to 10000 so you only have to wait 10 seconds instead of 200 seconds for fading to start.
The script
#!/bin/bash

# NAME: movie.sh
# PATH: ~/eyesome
# DESC: Dim monitors 1 and 3 after 5 minutes of activity
# DATE: June 27, 2019. Modified November 5, 2019.
# PARM: Pass any parameter 1 to generate trace output

# UPDT: 2019-07-05 Add dependancy message. Improve sleep calcualation.
#       2019-09-01 Display how long dimming lasted in hours, minutes, seconds
#       2019-09-07 Do not brighten if toggling play / pause of movie with
#       mouse click or Enter key. Log first wake and if a second wake appears
#       within 1 to 3 seconds then wake up. Otherwise forget first wake signal.
#       2019-11-05 Replace scrolling messages with Statistics display.

: <<'END'
/* -----------------------------------------------------------------------------

CUSTOM NOTES
============
Put C-style free form notes here about disabling third party auto-brightness
sunrise / sunset applications like nightlight, redshift, flux, eyesome, etc.

CONFIGURATION FILE LOCATION
===========================
$ ll /usr/local/bin/.eyesome-cfg
-rw-r--r-- 1 root root 610 Jun 27 18:31 /usr/local/bin/.eyesome-cfg

CONFIGURATION FILE RECORD LAYOUT
================================
$ cat /usr/local/bin/.eyesome-cfg
https://www.timeanddate.com/sun/canada/edmonton|70.000000|120.000000|90.000000|
1.000000|TRUE| | | | |1|Disabled|Hardware|Alien 17" Builtin DIsplay|
intel_backlight|eDP-1-1|3500.000000|1.000000|1.000000|1.000000|850.000000|
1.000000|0.780000|0.650000|3500|1.000000:1.000000:1.000000| | | | |2|Enabled|
Software|Sony 50" TV|xrandr|HDMI-0|1.000000|1.000000|1.000000|1.000000|0.750000|
1.000000|0.950000|0.850000|1.00|1.000000:1.000000:1.000000| | | | |3|Disabled|
Software|Toshibal 43" 4K TV|xrandr|DP-1-1|1.000000|1.000000|1.000000|1.000000|
0.650000|1.000000|0.880000|0.780000|1.00|1.000000:1.000000:1.000000| | | |

----------------------------------------------------------------------------- */
END

# If sudo powers not needed, eg no 3rd party auto-brightening to disable,
# then comment out the next four lines:
if [[ $(id -u) != 0 ]]; then # root powers needed to call this script
    echo >&2 "$0 must be called with sudo powers"
    exit 1
fi

command -v xprintidle >/dev/null 2>&1 || { echo >&2 \
        "xprintidle package required but it is not installed.  Aborting."; \
        exit 1; }

# To echo debug/trace statements to screen, pass any parameter to script
Debug=0
[[ $# -gt 0 ]] && Debug=1

# To get list of your monitors use: xrandr --verbose | grep " connected"
MON1="eDP-1-1"      # eDP-1-1 = Laptop display
MON2=""             # HDMI-0 = Sony TV
MON3="DP-1-1"       # DP-1-1 = Toshiba TV

# If you elect to turn backlight complete off and on you must use sudo
BACK="intel_backlight"  # Setting to blank means no backlight to turn off/on

# All seconds in millisconds, eg 1000 milliseconds = 1 second
TIME_TO_FADE=200000 # Keyboard/Mouse idle time before dim 300000 = 5 minutes
TIME_TO_WAKE=2000   # 2 second time or less to trigger brightening
FADE_SLEEP=.15      # When fading sleep seconds between monitor changes
WAKE_SLEEP=.025     # When waking sleep seconds between monitor changes

# Optional configurationfile for 3rd party auto brightnes / color temperature
CFG_FILE=""
# if nothing else is automatically controlling monitors comment out next line
CFG_FILE=/usr/local/bin/.eyesome-cfg

DisableAutoBright () {
    # Disable specific monitors from nightlight, redshift, flux, eyesome, ect.
    [[ $CFG_FILE == "" ]] && return # No third party apps
    [[ $MON1 != "" ]] && sed -i 's/1|Enabled/1|Disabled/g' "$CFG_FILE"
    [[ $MON2 != "" ]] && sed -i 's/2|Enabled/2|Disabled/g' "$CFG_FILE"
    [[ $MON3 != "" ]] && sed -i 's/3|Enabled/3|Disabled/g' "$CFG_FILE"
} # DisableAutoBright

EnableAutoBright () {
    # Renable specific monitors for nightlight, redshift, flux, eyesome, ect.
    [[ $CFG_FILE == "" ]] && return # No third party apps
    [[ $MON1 != "" ]] && sed -i 's/1|Disabled/1|Enabled/g' "$CFG_FILE"
    [[ $MON2 != "" ]] && sed -i 's/2|Disabled/2|Enabled/g' "$CFG_FILE"
    [[ $MON3 != "" ]] && sed -i 's/3|Disabled/3|Enabled/g' "$CFG_FILE"

    # Trigger 3rd party app to gradually set brightness based on sunrise/sunset
    /usr/local/bin/wake-eyesome.sh post eyesome-cfg.sh nosleep

} # EnableAutoBright

MonArr=()   # Index 0= Monitor # 1 to 3, 1=Xrandr Name, 2=Connected/Disconnected,
            # 3=Save Bright "100"=1.0, 4=Current Bright "75"=0.75, 5=xprintidle cnt

PaintStats () {

    local i Image

    Image=( \
    "╔═══════════════════════════════════════════════════════════════════╗"
    "║   movie.sh - Dim specific monitors when keyboard and mouse idle   ║"
    "╠═════════════════════════════════╤═════════════════════════════════╣"
    "║         Active Stats            │         Dimmed Stats            ║"
    "╟─────────────────────────────────┼─────────────────────────────────╢"
    "║ Total time:   1:30:22 (H:M:S)   │ Total Time:   0:30:25 (H:M:S)   ║"
    "║ Cycle Count:  999 cycles        │ Cycle Count:  999 cycles        ║"
    "║ Total checks: 9,999,999 checks  │ Total checks: 9,999,999 checks  ║"
    "╟─────────────────────────────────┼─────────────────────────────────╢"
    "║ This cycle:   99 Hours 99 Secs  │ Last cycle:   99 Hours 99 Secs  ║"
    "║ Last check:   Sat 1:52:39 pm    │ Dim started:  Sat 12:42:15 pm   ║"
    "║ Sleeping:     200 Seconds       │ Short wakes:  999 pause/plays   ║"
    "║ Next check:   Sat 1:53:49 pm    │ Dim ended:    Sat 1:31:08 pm    ║"
    "╚═════════════════════════════════╧═════════════════════════════════╝"
    )

    echo -e "\033[32m"  # Start green text
    for i in "${Image[@]}" ; do echo "$i" ; done
    echo -e "\033[0m"   # End green text

} # PaintStats

PrintStr () {
    tput cup "$1" "$2" ; echo -e "                 "
    tput cup "$1" "$2" ; echo -e "$3"
} # PrintStr

PrintDig () {
    tput cup "$1" "$2" ; echo -e "                 "
    tput cup "$1" "$2" ; printf "%'d %s" "$3" "$4"
} # PrintDig

PrintDur () {

    local h m s FormattedElapsed
    (( h = ${3} / 3600 ))
    (( m = (${3}%3600) / 60 ))
    (( s = ${3}%60 ))
    FormattedElapsed="$h:$m:$s (H:M:S)"
    FormattedElapsed="$h""hr $m""mn $s""sc"

    tput cup "$1" "$2" ; echo -e "                 "
    PrintStr "$1" "$2" "$FormattedElapsed"
} # PrintDur

TotalActive=0
TotalDimmed=0
ActiveCount=1       # We are already active starting up
DimmedCount=0
ActiveChecks=0
DimmedChecks=0
ThisActiveTime=0
LastDimmedTime=0
LastActiveCheck=""
LastDimStarted=""
ActiveSleepTime=0
ShortCount=0
NextActiveCheck=""
LastDimEnded=""

UpdateStats () {

    tput sc             # Save Cursor
    echo -e "\033[36m"  # Start cyan text
    PrintDur  6 16 "$TotalActive"
    PrintDur  6 50 "$TotalDimmed"
    PrintDig  7 16 "$ActiveCount" "cycles"
    PrintDig  7 50 "$DimmedCount" "cycles"
    PrintDig  8 16 "$ActiveChecks" "checks"
    PrintDig  8 50 "$DimmedChecks" "checks"
    PrintDur 10 16 "$ThisActiveTime"
    PrintDur 10 50 "$LastDimmedTime"
    PrintStr 11 16 "$LastActiveCheck"
    PrintStr 11 50 "$LastDimStarted"
    PrintStr 12 16 "$ActiveSleepTime Seconds"
    PrintDig 12 50 "$ShortCount" "pause/plays"
    PrintStr 13 16 "$NextActiveCheck"
    PrintStr 13 50 "$LastDimEnded"
    echo -e "\033[0m"   # End cyan text
    tput rc             # Restore cursor
}
# UpdateStats

SetBrightness () {

    # Parm 1: XrandrMonitor Name
    # Parm 2: Math Brigthness Value
    local MON CurrBright
    MON="$1"
    MathBright="$2"

    [[ "${MathBright:0:1}" == "-" ]] && MathBright=0    # Negative not allowed
    [[ "$MathBright" -gt 999  ]] && MathBright=999      # Can't go over 9.99

    if [[ "${#MathBright}" -eq 3 ]] ; then
        MathBright="$MathBright"000         # Pad with lots of zeros
        CurrBright="${MathBright:0:1}.${MathBright:1:2}"
    elif [[ "${#MathBright}" -eq 1 ]] ; then
        CurrBright=".0$MathBright"
    else
        MathBright="$MathBright"000         # Pad with lots of zeros
        CurrBright=".${MathBright:0:2}"
    fi

    # Even if brigthness hasn't changed we want to set it each time so
    # that `xrandr` will lag sleep cycle by 25 milliseconds
    if [[ $CurrBright == ".0" ]] ; then
        xrandr --output "$MON" --off
    else
        xrandr --output "$MON" --brightness "$CurrBright"   # Set new brightness
    fi
} # SetBrightness

GetCurrBright () {

    # Call this before starting to fade monitor. Parm1: Monitor Xrandr name
    # Setup for global variables failure
    MonMathBright="0"
    MonCurrBright="0.0"
    MonStatus="Disconnected"
    [[ $1 == "" ]] && return

    local CurrBright Left Right
    CurrBright=$( xrandr --verbose --current | \
                                      grep ^"$1 connected" -A5 | tail -n1 )
    [[ $CurrBright == "" ]] && { echo "$1 Monitor not found in xorg"; return; }

    MonStatus="Connected"
    MonCurrBright="${CurrBright##* }"  # Get brightness level with decimal place
    Left=${MonCurrBright%%"."*}        # Extract left of decimal point
    Right=${MonCurrBright#*"."}        # Extract right of decimal point

    [[ "$Left" != 0 ]] && MonMathBright="$Left"00   # 1.0 becomes "100"
    [[ "${#Right}" -eq 1 ]] && Right="$Right"0      # 0.5 becomes "50"
    MonMathBright=$(( MonMathBright + Right ))
    # ((Debug)) && echo "$MonName Starting brightness: $MonMathBright"

} # GetCurrBright

ConvertSeconds () {

    # Credit: https://stackoverflow.com/a/12199798/6929343
    local h m s
    ((h=${1}/3600))
    ((m=(${1}%3600)/60))
    ((s=${1}%60))
    printf "Monitor(s) dimmed for: "
    [[ $h -gt 0 ]] && printf "%d Hour(s) " $h
    [[ $m -gt 0 ]] && printf "%d Minute(s) " $m
    printf "%2d Second(s)\n" $s

} # ConvertSeconds

IgnoreShortWake () {

    # If this was just an accidental mouse movement or a singe Enter key to
    # pause / play movie then return false (1).

    local LastElapsed ShortTime
    LastElapsed=$(xprintidle)
    while true ; do
        sleep .1
        ShortTime=$(xprintidle)
        [[ $ShortTime -lt "$LastElapsed" ]] && return 0 # Real wakeup
        # User clicked play/pausse, incrment count and go back to sleep
        [[ $ShortTime -ge 3000           ]] && { (( ShortCount++ )); return 1; }
        LastElapsed="$ShortTime"
    done

} # IgnoreShortWake

BrightenMonitors () {

    # If short mouse movement or single key press go back to sleep
    IgnoreShortWake
    [[ "$?" == "1" ]] && return 1   # Monitors not brightened

    # How long were we dimmed for?
    DimmingEnded="$SECONDS"
    DimmingDuration=$(( DimmingEnded - DimmingStarted ))
    TotalDimmed=$(( TotalDimmed + DimmingDuration ))

    (( ActiveCount++ ))
    ThisActiveTime=0

    # Turn monitor on and slowly raise brightness to saved setting
    [[ "$BACK" != "" && "$BackOff" == true ]] && \
        echo 0 > "/sys/class/backlight/$BACK/bl_power"
    BackOff=false

    local i m LastPercent NewMathBright
    LastPercent=0
    for (( m = 0 ; m < MonArrCnt ; m=m+MON_COL_CNT )); do   #loop for each monitor
        GetByNdx "$m"
        [[ $MonStatus == Disconnected ]] && continue
        # If dimming interrupted, start from last percentage and not 0%
        [[ $MonPercent -gt "$LastPercent" ]] && LastPercent="$MonPercent"
    done
#    if ((Debug)) ; then
#        echo Starting percentage: "$LastPercent"
#        ConvertSeconds "$DimmingDuration"
#    fi

    # Brighten by increments of 4% for quicker waking
    for (( i = LastPercent ; i <= 100 ; i=i+4 )); do    # loop from 0% to 100%
        [[ $i -ge 96 ]] && i=100 # If 96, next loop will be 100
        for (( m = 0 ; m < MonArrCnt ; m=m+MON_COL_CNT )); do   #loop for each monitor
            GetByNdx "$m"
            [[ $MonStatus == Disconnected ]] && continue
            [[ $MonMathBright -eq 0 ]] && MonMathBright=1
            NewMathBright=$(( MonMathBright * i / 100 ))
            SetBrightness "$MonName" "$NewMathBright"
            SetByNdx "$m"
            sleep "$WAKE_SLEEP"       # Very quick increase, so smaller sleep
        done
    done

    LastDimEnded=$(date +'%a %I:%M:%S %P')

    return 0        # Monitors were brigthened

} # BrightenMonitors

DimMonitors () {

    DimmingStarted="$SECONDS"
    LastDimmedTime=0
    (( DimmedCount++ ))
    local i m NewMathBright Elapsed
    for (( m = 0 ; m < MonArrCnt ; m=m+MON_COL_CNT )); do   #loop for each monitor
        GetByNdx "$m"
        # Get starting full brightness level, blank monitor name returns zeros
        GetCurrBright "$MonName"
        SetByNdx "$m"
    done

    # Dim by increments of 1% for slow fading
    for (( i = 100 ; i >= 0 ; i-- )); do    # loop from 100% to 0% brightness
        for (( m = 0 ; m < MonArrCnt ; m=m+MON_COL_CNT )); do   #loop for each monitor
            GetByNdx "$m"
            [[ $MonStatus == Disconnected ]] && continue
            NewMathBright=$(( MonMathBright * i / 100 ))
            SetBrightness "$MonName" "$NewMathBright"
            MonPercent="$i"
            SetByNdx "$m"
        done
        sleep "$FADE_SLEEP"         # slowly dim so longer sleep
        Elapsed=$(xprintidle)
        [[ $Elapsed -lt 2000 ]] && return
    done

    # Completely turn off laptop's backlight for "full black"
    [[ "$BACK" != "" ]] && echo 4 > "/sys/class/backlight/$BACK/bl_power"
    BackOff=true

    LastDimStarted=$(date +'%a %I:%M:%S %P')

} # DimMonitors

GetByNdx () {
    # Parm1 = index number, 0 = first monitor array entry
    MonNumber="${MonArr[$1]}"       # 3rd party monitor number, eg "3"
    MonName="${MonArr[$1+1]}"       # Xrandr Monitor name, eg "DP-1-1"
    MonStatus="${MonArr[$1+2]}"     # Xrandr Connected/Disconnected
    MonCurrBright="${MonArr[$1+3]}" # Value when dimming first starts eg 1.00
    MonMathBright="${MonArr[$1+4]}" # Math implied decimal 100 = 1.00, 50 = .5
    MonPercent="${MonArr[$1+5]}"    # Last percentage brightness set
} # GetByNdx

SetByNdx () {
    # Parm1 = index number, 0 = first monitor array entry
    MonArr[$1]="$MonNumber"         # 3rd party monitor number, eg "3"
    MonArr[$1+1]="$MonName"         # Xrandr Monitor name, eg "DP-1-1"
    MonArr[$1+2]="$MonStatus"       # Xrandr Connected/Disconnected
    MonArr[$1+3]="$MonCurrBright"   # Value when dimming first starts eg 1.00
    MonArr[$1+4]="$MonMathBright"   # Implied decimal 100 = 1.00, 50 = .5
    MonArr[$1+5]="$MonPercent"      # Last percentage brightness set
} # SetByNdx

InitializeMonArr () {

    # Initialize arrays with Xrandr name, status, curret bright, math bright, %
    MonArr=()
    MonArr+=( "1" "$MON1" "Cconnected" "1.0" "100" "0" )
    MonArr+=( "2" "$MON2" "Disconnected" ".0" "0" "0" )
    MonArr+=( "3" "$MON3" "Connected" "1.0" "100" "0" )

    MON_COL_CNT=6
    MonArrCnt="${#MonArr[@]}"

    # Dummy calls, but may not be necessary, test with delete later
    GetByNdx 0
    SetByNdx 0

} # InitializeMonArr

clear
PaintStats

Dimmed=false
InitializeMonArr
if ((Debug)) ; then
    echo ""
    echo "$(date +'%A %I:%M:%S %P') Starting movie.sh"
    echo ""
    echo "Monitor Array Dump: #, Name, Curr Bright, Math Bright, Last Percent"
    echo "${MonArr[*]}"
    echo ""
fi

# Loop until CTRL + C
while true ; do

    UpdateStats
    Elapsed=$(xprintidle)

    if [[ $Elapsed -lt "$TIME_TO_WAKE" ]] ; then
        if [[ $Dimmed == true ]] ; then

            # ((Debug)) && echo -e $'\n'"$(date) Wake after: $Elapsed milliseconds"
            TotalDimmed=$(( Elapsed / 1000 + TotalDimmed ))
            (( DimmedCount++ ))
            BrightenMonitors
            if [[ "$?" == "0" ]] ; then
                EnableAutoBright
                Dimmed=false
            else
                Elapsed=0       # Calculate new full sleep cycle below
            fi
        fi

    elif [[ $Elapsed -gt "$TIME_TO_FADE" ]] ; then
        if [[ $Dimmed == false ]] ; then

            # ((Debug)) && echo -e $'\n'"$(date) Fade after: $Elapsed milliseconds"
            TotalActive=$(( Elapsed / 1000 + TotalActive ))
            Dimmed=true
            DisableAutoBright
            DimMonitors
            continue    # Double check in case mouse moved during fade.
        fi
    fi

    if [[ "$Dimmed" == true ]] ; then
        # Be prepared to respond relatively instantly to mouse movement
        sleep 1
        (( DimmedChecks++ ))
        DimmedTime=$(( DimmedTime + 1 ))
        LastDimmedTime=$(( LastDimmedTime + 1 ))

    else
        # sleep until time to test for monitor fade
        SleepTime=$(( (TIME_TO_FADE - Elapsed + 1000) / 1000 ))
        [[ "$SleepTime" -lt 1 ]] && SleepTime=1
        # ((Debug)) && echo "$(date) Sleeping until next fade check: $SleepTime seconds"
        LastActiveCheck=$(date +'%a %I:%M:%S %P')
        ActiveSleepTime=$SleepTime
        NextActiveCheck=$(date +'%a %I:%M:%S %P' --date "$SleepTime seconds")
        ActiveTime=$(( ActiveTime + SleepTime ))
        TotalActive=$(( TotalActive + SleepTime ))
        (( ActiveChecks++ ))
        ThisActiveTime=$(( ThisActiveTime + SleepTime ))
        UpdateStats
        sleep "$SleepTime"
    fi

done


Open a terminal and run this command :export DISPLAY=:0.0

For more details, you can read this answer


This is likely to be caused by different understandings of what 1GB, 1MB and what 1KB is.

1KB could mean 1024 bytes or 1000 bytes. The same is true for MB, GB, TB etc. In this case I guess that the manufacturer defined one KB as 1000 bytes (and so on), but in the System Monitor 1KB is defined as 1024 bytes.


I have personally experienced this many times.. as the first thing I do in lot of fresh Installations of Ubuntu 18.04 is to run sudo rm -rf /usr/share/gnome-shell/extenisons/* This will remove the pre-enabled extensions but apt still thinks this is not removed from the system and that's why it says gnome-shell-extension-ubuntu-dock is already the newest version (0.9.1ubuntu18.04.3).

Example:

pratap@i7-4770U:~$ ls /usr/share/gnome-shell/extensions/
ubuntu-appindicators@ubuntu.com  ubuntu-dock@ubuntu.com
pratap@i7-4770U:~$ sudo rm -rf /usr/share/gnome-shell/extensions/*
[sudo] password for pratap:
pratap@i7-4770U:~$ ls /usr/share/gnome-shell/extensions/
pratap@i7-4770U:~$ sudo apt install gnome-shell-extension-ubuntu-dock
Reading package lists... Done
Building dependency tree
Reading state information... Done
gnome-shell-extension-ubuntu-dock is already the newest version (0.9.1ubuntu18.04.3).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
pratap@i7-4770U:~$ sudo apt purge gnome-shell-extension-ubuntu-dock
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  gnome-shell-extension-ubuntu-dock* ubuntu-desktop*
0 upgraded, 0 newly installed, 2 to remove and 8 not upgraded.
After this operation, 687 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 233472 files and directories currently installed.)
Removing ubuntu-desktop (1.417.1) ...
Removing gnome-shell-extension-ubuntu-dock (0.9.1ubuntu18.04.3) ...
Processing triggers for libglib2.0-0:amd64 (2.56.4-0ubuntu0.18.04.2) ...
pratap@i7-4770U:~$

so, the workaround is to purge the extension with the below command

sudo apt purge gnome-shell-extension-ubuntu-dock

and then re-install with

sudo apt install gnome-shell-extension-ubuntu-dock

between these two commands, I am not sure.. whether these commands are required or not

sudo apt autoremove && sudo apt autoclean
gnome-session-logout

and then Install it from any tty, I did not remember it when I came across with this situation.. but guessing is that sudo apt purge gnome-shell-extension-ubuntu-dock command will remove ubuntu-desktop also


C# Mono.Cairo example to make an EventBox transparent

Answering my own question...:

The solution is so simple, while I was looking for complex code to redraw the widget...
All that needs to be done is to set the EventBox.VisibleWindow member to 'false' (it is 'true' by default). Than the EventBox is not drawn and if the image inside the EventBox has transparent areas, they will show what ever is below.

In the example below, it is:
mapBox.VisibleWindow = false;
and
pinBox.VisibleWindow = false;

As far as I could see, the Z-Order (which Widget is on top of which) is determined by the order of drawing on the screen (when the EventBox is not drawn, the EventBox.GdkWindow.Lower() or Raised() members are not doing anything).

Example:

// Showing a map in an invisible EventBox
EventBox mapBox = new EventBox();
mapBox.Visible = true;
mapBox.VisibleWindow = false;
fixed1.Add(mapBox);
fixed1.Move (mapBox, 0, 0);

Image mapImage = new Image("map.png");
mapImage.Visible = true;
mapBox.Add (mapImage);

// Showing a pin image with transparent areas, in an invisible EventBox, on top of the map
EventBox pinBox = new EventBox();
pinBox.Visible = true;
pinBox.VisibleWindow = false;
fixed1.Add(pinBox);
fixed1.Move (pinBox, 60, 60);

Image pinImage = new Image("redpin.png");
pinImage.Visible = true;
pinBox.Add (pinImage);


How to enable UPnP coherence plugin in rhythmbox 2.95?

Coherence plugin does not install in newer versions of rhythmbox

A debian package rhythmbox-plugin-coherence built for 11.10 can be found on launchpad (see link). However this package depends on rhythmbox <0.14 and will not run with a newer version of rhythmbox. This may not change in the future as both the coherence plugin and the debian package is not included for 12.04.

Alternatives

DAAP shares from Rhythmbox:
We are able to share our music by defining a DAAP share from the DAAP plugin in rhythmbox (Edit->Plugins):

uShare
Another quite stable solution for UPnP shares is the command line tool uShare that also works independent of a running music player. After set up with

sudo dpkg-reconfigure ushare

we can share any directory or multiple directory by running

ushare -D --name=<name_of_my_stream> --content=<path_to_mediafiles>

In case you are not so comfortable with the command line there is a GUI tool stream2ip that will do most of the work for you.


Web filtering, dhcp, proxies in a distro?

OpenDNS has a DNS-based filtering solution that can block a whole bunch of different categories of websites, and gives you the ability to override the actions for certain websites.  Here's a setup that might work for you:

Get a free OpenDNS Home account.
Install Ubuntu, and then set it up as your network router.
Install dnsmasq for serving DNS and DHCP to your LAN.
Install ddclient if you do not have a static public IP.
After OpenDNS account setup, go through their tutorials on how to configure ddclient to update the IP address associated with your account and edit your resolv.conf file with their DNS server addresses.


List all the optional arguments of a particular command in bash

It's by no means universal, but many commands provide a usage summary in response to a -h or --help argument e.g.

$ cat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s) to standard output.

With no FILE, or when FILE is -, read standard input.

  -A, --show-all           equivalent to -vET
  -b, --number-nonblank    number nonempty output lines, overrides -n
  -e                       equivalent to -vE
  -E, --show-ends          display $ at end of each line
  -n, --number             number all output lines
  -s, --squeeze-blank      suppress repeated empty output lines
  -t                       equivalent to -vT
  -T, --show-tabs          display TAB characters as ^I
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
      --help     display this help and exit
      --version  output version information and exit

Examples:
  cat f - g  Output f's contents, then standard input, then g's contents.
  cat        Copy standard input to standard output.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/cat>
or available locally via: info '(coreutils) cat invocation'


How to configure two monitors on Ubuntu 16.04?

You should be able to do this quite simply from in the settings

This guide covers it quite well:

https://help.ubuntu.com/stable/ubuntu-help/display-dual-monitors.html (Latest Ubuntu Version)

As an overview you would go to System Settings, then Screen Display where you can turn the monitor on and off. Make sure to not have ticked "Mirror Display"

Hope that helps

Edit: For Ubuntu 16.04 - Copied from the docs:
(https://help.ubuntu.com/16.04/ubuntu-help/display-dual-monitors.html)

To set up an external monitor with your laptop, connect the monitor to your laptop. If your system doesn't recognise it immediately, or you would like to adjust the settings:

Click the icon at the very right of the menu bar and select System
Settings.
Open Screen Display.
Click on the image of the monitor you would like to activate or deactivate, then switch it ON/OFF.
By default, the Launcher only shows on the primary monitor. To change which monitor is "primary", change the monitor in the Launcher Placement drop-down box. You could also drag the Launcher in the preview to the monitor you want to set as the "primary" monitor.
If you want the Launcher to show on all monitors, change Launcher Placement to All Displays.
To change the "position" of a monitor, click on it and drag it to the desired position.
If you would like both monitors to display the same content, check the Mirror displays box.
When you are happy with your settings, click Apply and then click Keep This Configuration.
To close the Displays click on the x in the top corner.


Recover a file which has lost 5 minutes ago

If you are using hdd (instead of ssd) you can recover it using "photorec".
Install it: sudo apt-get install testdisc then run photorec.

ps.: depending on the size of your disk it can takes a lot of time, and you will recover a lot of files.


Which Ubuntu version for Dell Precision M4400 notebook

Ubuntu will run on just about any system. There's no need to compare versions, however the desktop might be the problem to keep in mind. If there's issues, right click on the Ubuntu Logo and select Ubuntu 2D to use a less resource intensive desktop.

If issues still arise, pressing Ctrl+Alt+F1 will call up the console. Login and put in tasksel and use the arrow keys to navigate around to find Ubuntu Desktop. Press space to uncheck it and select a different desktop that'll work for you. Examples are Lubuntu, Xubuntu, and so forth. Press enter when you are done to install the new desktop before rebooting.

Optionally, if the 2D Desktop is working as I suggested, you might want this as default for all users and future users, so opening a terminal by Ctrl+Alt+T and putting in sudo /usr/lib/lightdm/lightdm-set-defaults -s ubuntu-2d


I have experimented with opening a ton of windows and loading the activity overview.

I have found that for me anyways, the number of windows is the factor that matters the most. When I spam Ctrl+alt+T to open tons of empty terminals, the time it takes to load activity overview increases significantly.

If you are also having lots of windows open and they are all terminal windows, try to use tabs instead of windows. The same goes for Web browsers, text editors, etc.

Hope it helps :)


No release file for Rethink db on Ubuntu 18.04

They don't have packages for Ubuntu 18.04 in their repository but only for 17.04 and earlier.

Ask them if they could provide a package for 18.04.

Alternatively you could try to manually download and install the package for 17.04 from http://download.rethinkdb.com/apt/pool/zesty/main/r/rethinkdb/ (I don't know if that works) or build from source as described on their web page.


Installing Ubuntu with Windows installer on Windows 8 machine

Especially if your ultrabook came with Windows 8, there is a good chance that it is UEFI with secure boot on, you may need to turn this off for even the Wubi install, and definitely need to if you are to try and install grub. Otherwise, I you may want to try and remove it (with wubi you can remove in programs/features in control panel), double check the md5 of your ubuntu iso, and reinstall.


You have held packages error when trying to install e17

I solved this by attempting to install the dependencies. I had to repeat this several times until I encountered a package called libembryo0; e17 was attempting to install "libembryo-bin." I apt-get removed libembryo0 and reattempted to install e17 and it worked. Very sloppy, but successful.
Thank you.


Installing certbot on Ubuntu 16.04.4 LTS (on Azure) fails with "you have held broken packages."

What I did to solve this problem on 18.04. See if you have python not just python3 installed.

python -V

Should give you a version number. If not:

sudo apt install python

Then you can add the python certbot. You'll need to add the repository that has it:

sudo add-apt-repository universe

Then you should be able to:

sudo apt-get install python-certbot-nginx

You can search for repositories here:
https://packages.ubuntu.com/search?keywords=python-certbot-nginx&searchon=names&suite=bionic&section=all


Keyboard of Acer Aspire A5943G not working properly

The problem is actually with the power management of the "Suyin Corp. 1.3M WebCam (notebook emachines E730, Acer sub-brand)" device. This device is an internal multi-protocol USB device which is not only the webcam but also the keyboard. The solution is to disable autosuspend for that device. You can do so with the following steps:

Step 1A: Identify your device on the USB bus.

Run

$ lsusb

and look for the WebCam.
In my case the output looks like this:

Bus 002 Device 004: ID 064e:a219 Suyin Corp. 1.3M WebCam (notebook emachines E730, Acer sub-brand)
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 1c7a:0801 LighTuning Technology Inc. Fingerprint Reader
Bus 001 Device 011: ID 0cf3:3005 Atheros Communications, Inc. AR3011 Bluetooth
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

which means that in my case the device is Bus 002 Device 004. We need that information in Step 2 as 2-1.4. The 2 is the Bus number from the lsusb command, the 1 is the Bus (0 would be the Hub itself), The 4 is the device on the bus from the lsusb command.

Step 1B: Identify your device on the USB bus.

Alternatively, you can identify your device using the following commands:

$ cd /sys/bus/usb/devices
$ echo */input

This will print all devices which are a keyboard. In my case, it prints 2-1.4:1.0/input which means the device is 2-1.4.
If you have multiple keyboards attached, you need to figure out which keyboard is the right one. In that case, either detach all other keyboards before running the echo command, or inspect the corresponding product file, in this case 2-1.4/product, i.e. using cat 2-1.4/product. The product file should contain a string like 1.3M WebCam.

Step 2: Disable autosuspend for the device.

Assuming that Step 1 resulted in the device 2-1.4, run the following command to disable autosuspend for that device:

$ sudo sh -c 'echo "0" >/sys/bus/usb/devices/2-1.4/power/autosuspend'

Now the keyboard should be working perfectly well.

Step 3: Make the change permanent

To make this change permanent, you need to run that echo command during startup. For how to run a script during startup, see https://stackoverflow.com/questions/8339555/how-to-run-a-script-at-the-start-up-of-ubuntu


Ubuntu 12.10 Manually installing Catalyst 12.11 Beta

Hi I'm fairly new to both Ubuntu and askubuntu.com. What I did was to download the beta drivers from here: http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx

Then I right-clicked on the file, under permissions made sure it's marked as an executable, double-clicked it and chose "Run in terminal". The rest is pretty much straight forward.

As a side-note, if you want to remove the water mark (AMD for testing only) that appears after you installed the drivers - just follow this video: http://www.youtube.com/watch?v=OcNDyYozzrQ

If you look in the comments of the video you will see what I had to do to make the script work. I hope I don't offend you by my very newbie-like approach. You can always just ignore me and wait for more advanced terminal magic suggestions  ;)

EDIT: Just realized that if the old drivers give you problem, run these commands in the Terminal:

sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*


Issue turned out that pc "sees" usb device as a hard drive, so that's where to prioritize boot order. Strange, I think.


Controlling my wireless card, how do I know if I will harm it?

Upping your Tx power will have no effect on the Rx signal strength. You would need to increase the Tx power on the router to get a stronger signal on your laptop.

Unless you are using some Kali tools to break into other Wi-Fi networks (I hope not), there isn't really much point in upping the Tx power in your laptop.

Also, keep in mind that increasing the Tx power will generate more heat, and also degrade the quality of the transmitted signal.


Partition recognized as unusable during ubuntu installation

First, be aware that you did something very dangerous: You should NEVER use Windows' own partitioning tool to create partition(s) for Linux. NEVER. The Windows tools have known bugs that cause all manner of problems, particularly when increasing the number of partitions beyond four on a Master Boot Record (MBR) disk, which you have. Fortunately, you don't seem to have run into these problems. I'm leading with this point because I don't want you, or somebody else who reads this, to make that mistake. It's OK to use the Windows tools to shrink an existing partition, but that's it.

Second, the screen shots to which you've linked do not show five partitions; they show four partitions and unallocated space between two of those partitions. The GUIs are easy to misinterpret. With that in mind, you should also know that MBR supports a maximum of four primary partitions, which is what you've got. That's why GParted identifies the unallocated space as "unusable" -- it literally cannot be carved up into additional partitions, because you've already used your four primary partition slots.

Note the qualifier word primary. MBR also supports logical partitions, but they must exist within a special type of primary partition known as an extended partition. Thus, when you need more than four partitions, the usual solution is to make at most three primary partitions, one extended partition, and as many logical partitions as you need. The trick in your case is that you've already got four primary partitions, so you can't create the extended partition that you need to create your logical partitions. There are ways around this dilemma, but the best way to proceed depends on how you're using those partitions.

I note that GParted seems not to have fully identified /dev/sda4 -- GParted says that it's NTFS, but says the amount of used space is "unknown." If you created /dev/sda4 in Windows for Linux's use, one approach is to delete it and create an extended partition in its place. The trouble with this approach is that if you delete /dev/sda4, you'll have two areas of unused space, and you can create just one extended partition. Thus, you must either convert /dev/sda3 into a logical partition or move it to the left so that you'll have one big area of contiguous free space for your extended partition. If /dev/sda3 is not a boot disk, then converting it to a logical partition should work. (Windows can boot only from primary partitions, so you should not convert /dev/sda3 to logical form if you're booting from it.) Moving the partition may be time-consuming, and imposes a risk of data loss, but may be an acceptable solution if you've got a good backup.

Another solution (which overlaps with the preceding one) is to convert one or more of your existing partitions from primary to logical form. You can do this with my FixParts program, which comes in the gdisk package in Ubuntu. You should definitely be able to convert /dev/sda3 from primary to logical form with FixParts, and you might be able to convert other partitions, too. DO NOT convert your Windows boot partition, though. Once you convert partition(s) from primary to logical form, you can use GParted to adjust the size of the extended partition and create new logical partitions for use by Ubuntu. (Unlike Windows, Ubuntu has no problems booting from a logical partition.) Unfortunately, I can't be very specific about what to convert in this scenario, since I don't know enough about what each of your partitions does. I recommend you read the FixParts documentation, identify your existing partitions' functions, and if necessary ask more questions before proceeding. If you go this route, you'll probably end up using at least two partitioning tools (FixParts and GParted), and maybe more (the Windows tool may be slightly safer than GParted if you have to move or resize existing NTFS partitions).


update-alternatives gives you the convenience of switching between different installed gcc versions. Downgrading the system gcc is almost never needed, and is generally harmful.

The error /usr/bin/gcc-6 doesn't exist from update-alternatives suggests that gcc-6 is not installed, so all you need is to install the following packages (which are found in the default 18.04 repository, bionic/universe):

sudo apt-get install gcc-6 g++-6 g++-6-multilib gfortran-6

Then, repeat the sudo update-alternatives --install step for each gcc version you wish to use.

Whenever you want to change back gcc to point to the default version shipped with Bionic, 7.3, simply run sudo update-alternatives --config gcc, which will let you pick between the available gcc versions with installed alternatives.

Also, you can always run a specific gcc version directly, by specifying the version suffix (gcc-6, gcc-7, etc).


Disabling Lock Screen Fade to Black on Ubuntu 17.10 (Wayland)

This is from another answer I posted where OP has yet to log into Ask Ubuntu again to respond. To set these options open a terminal with Ctrl+Alt+T. The changes take effect for the current session and permanently.

For Login screen:

gsettings set org.gnome.desktop.screensaver idle-activation-enabled false

Disable dimming screen when idle:

In Unix & Linux someone complained when on battery screen dims every 20 seconds and wants to turn that feature off:

gsettings set org.gnome.settings-daemon.plugins.power idle-dim false


Shell script needs to be run twice to work as expected

When entering the commands into the terminal yourself you are more than likely waiting for each command to complete.

When the same commands are run as part of a script they can complete too quickly. pkill, for example, will send the kill command but won't wait for the application to exit.

You can make the script wait for an amount of time using the sleep command.

For example:

/usr/bin/pkill -f reportPrintingServer.jar

# Wait a few seconds
sleep 5

/usr/bin/screen -S proRps -d -m /usr/bin/java -jar /opt/projects/pro/assets/report_printing_server/reportPrintingServer.jar


when you do the install-grub and it is installed on a new drive that is the grub install that will be updated an will be the one the system looks to to boot from.
I believe the other one on the old drive will be left alone. Glad you figured out a system that works for you :)


PHP Version 7.1.18-1 on ubuntu16.04.1 xdebug is not working. How to enable it?

I had the same issue you as you. Despite having used the tailored instructions multiple times in the past, they don't seem to want to work on this particular configuration, and I can't tell exactly why.

However, I had success installing it very simply using:

sudo apt-get install php-xdebug
sudo service apache2 restart

Don't know if you're still having the issue, but I hope it helps someone. Same issue from here: https://petersproblems.wordpress.com/


As suggested by @Lillox I needed to chwon the directory (e.g. /home/openmpi-1.10.1).

sudo chown -R user: .

(After the : the user-group is left out so this command uses the default user group.)

After that I continued installation with these commands:

./configure --prefix="/opt/openmpi"
make all install


Ubuntu 18.04 fails to boot on Dell Inspiron 15-3552

After many (many) attempts, what worked for me was:

Switching startup mode from UEFI to legacy and
Setting /etc/default/grub to "quiet nosplash"

More details:

boot, press F2 to enter Setup, go to Boot / UEFI mode: legacy
boot from a live usb, mount main disk, edit /media/ubuntu/xxxxx-xxxx-xxxx/etc/default/grub, set GRUB_CMDLINE_LINUX_DEFAULT="quiet nosplash"

This way a Dell Inspiron 3552 did boot into Ubuntu 18.04 LTS

Edit: after a few restarts, the problem ensisted, so I had to use "nomodeset"


How to add a keyboard layout to the login screen?

Add the layouts that you desire under System Settings --> Keyboard layout, and when you login you will be able to choose the layout of your choice.

For 14.04


Laptop display not working after updating to 18.04

I had the exact same problem, and I found the answer from here (which ultimately is just a link to here).

Edit your /etc/X11/xorg.conf and look for any commented lines. For some reason, the line containing Driver "nvidia" was commented out for me. Un-commenting it solved the issue.

If that doesn't work, then there are some more options in the linked post.

In my opinion, it's pretty silly that things like this can happen, where a random line in a config can get commented out or modified and cause such havoc. But I guess that's what you get for trying to upgrade instead of doing a fresh install.


Why does dpkg install the Vagrant deb into "/opt"?

/opt
This directory is reserved for all the software and add-on packages
that are not part of the default installation.

This deb put files in /opt because it is a third party package, downloaded directly from vendor website. Packages available in Ubuntu repositories (installable via apt-get) don't install files in /opt (look at vagrant filelist).


Ubuntu installation stuck at ‘updates and other software’

Maybe this bug is what you describe:

https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1766978

If so, try mounting and unmounting the Windows boot partition until the installer detects it and prompts you to unmount it.


How do you make USB bootable on chromebook

How did you make the USB stick? Did you use UNetBootin? There's supposed to be something you can do with fdisk, but I'm too lazy to talk about that right now. (Don't worry, there's like a 90% chance someone else will add an answer detailing that method.)

I'd recommend this alternative method - it's a little more "hacker-ish" (you're basically tricking your computer into thinking the USB stick is a CD-ROM,) but it's the simplest method ever to make your bootable USB drive.

Okay, first off, we're going to enter Crosh - ChrOme SHell is what I think it stands for. Anyway, it's basically useless, except to open up the "real" Shell.
Press CTRL-ALT-T to open it up, then type shell and press Enter. You'll now be presented with a $ with (maybe) some text before it. If you see this, congrats. You're in. If not, reread the instructions and try again.

Once you've gotten the Shell open, type cd Downloads (assuming you saved the ISO to your Downloads folder.)
Now, we need to figure out what Device your USB stick is. It's usually /dev/sdb, if it's your computer's only USB stick plugged in, but it you're nervous, type fdisk -l - it'll reply with a bunch of tech stuff. Upload it to Pastebin, then post the link as a comment below my post.

(NOTE: THE FOLLOWING COMMAND WILL WIPE ANYTHING CURRENTLY ON THE USB DRIVE. IF YOU HAVE ANYTHING VALUABLE ON IT, PLEASE REMOVE IT BEFORE CONTINUING.)
Once you've figure out what your USB drive is, type:

dd if=ubuntu-12.*-desktop*.iso of=/dev/sdb

(except, edit the *'s to complete the filename.)
This will "burn" the Ubuntu disk image to your USB stick, as if it were a CD. In fact, it basically turns the USB stick into a CD, albeit one that runs significantly faster than your average optical drive.

When it's finished, reboot your computer and spam F12 while it's booting up - it should ask you what you want to boot from. Choose USB CD-ROM or something similar. Ta-da, you have just booted from the USB stick! If that didn't work, reboot and try a different F# key or perhaps a different boot device. There's not really much to screw up here, unless you enter the BIOS settings and break something (but that's highly unlikely. ;)

Just remember that after you have done this to the USB stick, you can't use it as a USB stick until you reformat it. Normal Windows utilities can't do this, use something like Gparted instead. Create a new partition table (if it asks, use msdos,) and then create a new partition with the Type as FAT32.


Run python Script that reruns every 4 hours at system startup

For anyone that needs to know, as it was mentioned in the comments I edited the crontab file.  I actually only needed it daily, so it was very simple.

crontab -e

On the last line I added:

0 1 * * * python /file_location/file.py

This runs file.py at 1:00 AM.

(minutes) (Hour) (day of month) (day of week) command


How can I exit a command line input consumer without stopping it's program?

You can suspend the program, and then place it in the shell's background.

To suspend a running job, use Ctrl+Z - the shell should respond giving you a job id in brackets. You can then background the job using

bg <job id>

Ex. using sleep to mimic your long-running process:

$ sleep 100
^Z
[1]+  Stopped                 sleep 100
$
$ bg 1
[1]+ sleep 100 &
$

You can obtain a list of running background jobs using jobs, and foreground the job again if you wish to do so using fg <job id>.

For further information, refer to the JOB CONTROL section of man bash.


You can probably solve it more efficiently than with a for-loop that needs to process the whole file once per line to remove.

filename="/PATH/TO/FILE"
number=5

line_count="$(wc -l < "$filename")"
line_nums_to_delete="$(shuf -i "1-$line_count" -n "$number")"
sed_script="$(printf '%dd;' $line_nums_to_delete)"

sed -i.bak -e "$sed_script" "$filename"

Or in one line (after defining the filename and number variables or replacing them manually):

sed -i.bak -e "$(printf '%dd;' $(shuf -i "1-$(wc -l < "$filename")" -n "$number"))" "$filename"

The -i.bak switch tells sed to edit/replace the input file immediately, but keep a backup copy of the original data, named like the input file but with .bak appended to the file name. If you don't want it to make a copy, just write -i.

Btw, you don't have to use variables as I did. You can also directly replace "$number" and both occurrences of "$filename" with the appropriate values. I just did it this way for clarity.

To break down and explain the rest of the command:

sed -e "SCRIPT" "$filename"

runs the text processing tool sed on the file specified by the filename variable, applying the instructions given as SCRIPT argument.

Our SCRIPT is dynamically generated in the lines above it, which run commands and assign their outputs to variables. Here we use these commands:

wc -l < "$filename" reads in the file specified by the filename variable and outputs the number of lines this file contains.

In your case, this should return roughly 10000 according to the size you mentioned in the question.

shuf -i "1-$line_count" -n "$number returns as many unique random numbers as specified by the number variable in the range 1 to $line_count (both boundaries inclusive).

For example, shuf -i 1-6 -n 2 would emulate throwing two regular six-sided dies.

printf '%dd;' ARGUMENTS returns a formatted string, taking in all ARGUMENTS (not quoted this time to treat each random number as a separate argument). The format string %dd; will be repeated while there are arguments left, and %d will be replaced with the argument represented as a decimal number.

Therefore, e.g. an input of 1 7 42 would result in an output of 1d;7d;42d;.

The resulting $sed_script is finally our SCRIPT for sed. A plain number is treated as address, i.e. the line number on which to apply an action, starting at 1 for the first line of the input file. d is the command to delete the specified line, and ; separates multiple sed script commands.

All together, the whole command first examines your input file as specified in the filename variable and counts its lines. Then it generates number many unique random numbers in the range 1 to the number of lines and constructs a sed script out of these to delete each mentioned random line. Finally sed runs that script on the file, modifying it.


sandisk 32gb 3.0 otg gone wrong while using rufus then it says write protected

In modern SD card/USB pendrives, write protection usually means it has unrecoverable CRC errors, so the controller lock the whole device to prevent further data corruption.

Rufus does not cause this problem.  You just happen to use rufus to write significant amount of data on the drive when it reaches the end of life.

All you can do is replacing the drive or RMA.


How to feed multiple options to a command from a file?

xargs -a file_name command --initial-argument --another-initial-argument


after installing hplip 3.20.6 recieve communication error 5012

In terminal, type:
sudo apt-get install printer-driver-hpcups

If that works, please consider marking this question answered or up-voting. Thanks!


I want to post this as an actual answer; the comment on the question from Doug Smythies is correct, you will need to install the package libssl-dev to resolve this error.
Command:
sudo apt install libssl-dev


How to take screenshot of a windows machine for every 30 minutes?

There are so many possibilities:

Set up a webcam on your Linux box, point it to the Windows machine's screen so you can capture what's on it, set Windows up so that it doesn't lock or blank the screen. Install fswebcam and use cron to automate running it every 30 minutes. Create a file named e.g. cronfile containing this:

*/30 * * * * fswebcam -q "`date`.jpg"

Then activate the cronfile with:

crontab cronfile

this will put a timestamped file in your home dir every 30 minutes.

The first five fields in a crontab job definition decide when to run the job; this will simply run it every 30 minutes (*/30) of every hour, every day of every month (the 5th field allows you to decide which days of the week a job runs). The command that will be run is the rest of the line.

fswebcam takes a filename on which to save the captured image. In this case, we build the filename by using the output of the date command (the backticks tell the shell to first run the command within, and place its output value in there, before running the rest of the line). I also used double-quotes because the output of date can contain spaces, so the filename has to be quoted to work.

That's all there is to it.

Another option is to use VNC the way you're using it now. You'd have to set up both the Windows system and the Linux one to not blank the screen after some period of inactivity. Then you could use a screen capture program (I suggest shutter) and automate it running every 30 minutes using the same cron technique I describe above.


Secure connection to docker image using port 80?

The https 443 port number is not "magic", you can use any port from 1-65535 you like. There are only 2 conditions:

Both the server and the client have to (agree to) use the same port number.

Ports in the range 1-1023 are "well known ports" which are assigned worldwide to specific applications or protocols. If you use one of these port numbers, you may run into conflicts with the "well known" applications. Ports from 1024 on are freely useable.

As an example, you could use port 30443.
Just add a :30443 at the end of url in the browser like "https://www.myip.com:30443".
set up docker to expose the 443 port of the docker image to the machines 30443 port
if your docker image only support non-https access via port 80 you might need to setup a proxy that secures the 80 port of the docker image - nginx-proxy and letsencrypt-nginx-proxy-companion can help - but that's another subject
see https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion


Right now, we only support docker 1.6, but we do have a newer version of docker on the roadmap for ubuntu core 16.04.

There may we some way we can make your snap working out with 1.6 in the mid-term? Do not hesitate to join us on irc (freenode) #snappy and ask around! :)


How to share a VirtualBox virtual machine with users of the computer

The idea

To make a VM available from different user accounts on one computer (not having it running at the same time), you need to set up a few things:

Locate the virtual hard drive of the shared machine in a directory where different users have appropriate permissions.
Create virtual machines on the different accounts, using that same virtual hard drive.

How it can be done

Create a shared folder, in your personal home folder, for you and other user(s):

Make other users member of the group yourusername (the easiest way is to install gnome-system-tools and use the users and groups -section.
Manage groups > choose_yourusername > properties > add_other_users
(detailed instructions here to mange users, and here to create a shared folder)
Change the permissions of the folder; right-click on in nautilus. In the permissions tab, change the group permissions for group yourusername to read & write.
Change the permissions for the files in the folder similarly (the button down in the nautilus properties window).

Create a virtual machine in VirtualBox. Do not use the default directory for a disk, but browse to the shared folder and save the disk image there. If you have an existing VM, delete it, delete its folder in ~/VirtualBox VMs as well, but keep its disk image, and move it to the shared folder first, then create a new VM, using the existing image as a harddisk. (if you try to relink the disk image in your existing VM, VirtualBox will complain the UUID already exists).
On the other user's account(s), create similar machines, but use the hard disk image in the shared directory: /home/yourusername/shared_folder/machine_name.vdi (depending on the diskimage you created)


"Continue button" grayed out in "installation type" screen during 13.04 installation

I clicked "Back" and then "Continue" again, and now it works. Go figure...

[Update based on comments: If this doesn't work, try it again and/or wait 15 minutes.]


Log upstart event env var EXIT_SIGNAL/EXIT_STATUS

In another job that has the stanza start on stopped main-job. Then in that job the script sections will have those environment variables.


How do I install ebook reader? Problems with FBReader

calibre

Overview
Calibre is a free and open source e-book library management application developed by users of e-books for users of e-books.
Calibre is primarily a ebook cataloging program. It manages your ebook collection for you. It is designed around the concept of the logical book, i.e. a single entry in the database that may correspond to ebooks in several formats. It also supports conversion from a dozen different ebook formats to LRF and EPUB. A graphical interface to the conversion software can be accessed easily by just clicking the "Convert E-books" button.
Supported input formats are: MOBI, AZW, LIT, PRC, EPUB, ODT, HTML, CBR, CBZ, RTF, TXT, PDF and LRS.

Starting calibre's ebook viewer as a standalone application
In certain cases you will not want to add an EPUB or MOBI file to calibre's library before reading it. Luckily calibre's ebook viewer can be started independently via ebook-viewer. This makes it possible to create a standalone launcher:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=calibre
Exec=ebook-viewer %f
Name=Ebook Viewer
Comment=Display .epub files and other e-reader formats
StartupWMClass=ebook-viewer
MimeType=application/x-mobipocket-ebook;application/epub+zip;

See here for more information on adding launchers to your system.

To click an ebook and open in ebook-viewer, make this application (usr/bin/ebook-viewer) the default for that type of file.


Open Nautilus file manager (open your Home folder for example), click
Edit -> Preferences -> Behavior and enable Single click to open items.


How can I run Ubuntu with minimal system resources?

Can you please outline the exact specs of the "quite old pc"?  It is hard to answer without knowing; it could quite well turn out there is not much you can do.

Be advised, if you are skirting the fringes of the basic requirements it may be difficult to use Ubuntu.

Some things to try would turning off as many desktop effects as possible.  Do not open many programs at once.

Is there a reason you need to use the Ubuntu Unity desktop?  You can install Ubuntu using the server edition and then insall your own desktop after that.  See http://www.psychocats.net/ubuntu/minimal for more on installing on lower resource pc's.


How to Increase my root partition's size. I am dual booting with windows 10

You can do it with decreasing the size of /home partition from left side to the right side and after that you can extend the / partition.
Please before doing that make a backup of your data. There is always a risk resizing of partitions.
Some tools may not allow this operation.


Can you put i3 on an alternate GUI terminal?

Yes, but you have to run another x server.

As I recall, you can't do this with the standard login managers (lightdm, gdm), because they're designed on the assumption that only once instance of them will be running. However, I've done it with wdm, although it's a bit clunky.

You probably want to look into running your second server manually via startx.


The Adobe Reader DC is available as Snap, so it should be removed as Snap with
snap remove acrordrdc


Copying files after accidental removal of various packages

Although your system probably can be rescued because your package system still should be in a healthy state, try rescuing/saveguarding your user files first if you do not have an up to date backup. to that aim, start the machine up with a Live Ubuntu CD or USB. You will then have a working live session on this PC, allowing you automatically have removable media mounted when you plug them in. You will also need to mount the partition on your internal drive where your files reside. Here, it should be sufficient to click the drive icon in the left pane of the file manager that represents the partition. Subsequently, you can copy files.

Once you safeguarded your user files, you can attempt repairing the system. Since you just removed too much in a "correct" way, i.e., using apt, your package system should still be OK. As your system does not anymore work correctly, you very likely also removed the ubuntu-desktop package. Reinstalling that metapackage should automatically pull back in all packages that make up a default Ubuntu desktop and thus make your system fully operational again.

Log back in to a text console and issue the following command to reinstall the ubuntu-desktop package

sudo apt install ubuntu-desktop


JRE installation using webupd8 PPA, possible ? how does it harm if I use JDK when JRE is enough for me?

When using the webupd8 PPA you will be installing the official , publicly available Java SE JDK which also contains the JRE as a part of that download. If your wish is only to install the JRE and not the JDK, then you can choose to use the manual method of obtaining the latest JRE from Oracle's website, and then finding the Easy Linux Tips Project page and following the method there.

You will not be harmed using the JDK, and the PPA may be a much better option for you  For one thing, the scripts to make the java defaults proper in the PPA are much better for you depending on what you use within java, and take effect on all properties versus the manual method (IMHO).

The PPA can only update when updates are made in the PPA itself. The manual method requires your own intervention in order to work.  Do hope that helps.


Unable to commit using bazaar tool to my unfuddle svn

Do you perhaps hve bzr-svn installed? It sounds like you might be opening a svn repository through bzr from within RabbitVCS.


Kubuntu not logging in after restoring an rscyn-based backup

Oh, sorry this didn't came to my mind earlier. Looks like this is Bug #58.

Permissions can't be restored from LiveCD because the LiveCD doesn't know the users. I'm about to add a new feature to read a different /etc/passwd. But nothing done yet. At the moment you need to run backintime --restore from root terminal in recovery mode. This will not change any files but fix the permissions.

First you need to mount the drives

mount -o remount,rw /
mount /home
mount /boot
mkdir -p /media/USER/backup_drive #or what ever path you used before
mount /dev/sdXX /media/USER/backup_drive
backintime --restore / '' 0

If you run BackInTime as user to backup your /home/USER you need to su <USER> and restore your home, too.


Canon-LBP2900 printer not working on ubuntu 14.04

I finally got my LBP 2900 printer to work on ubuntu 14.04, 64-bit. I followed the instructions posted here: Can't get my Canon LBP printer to run under Ubuntu 14.04.

There seems to be some fault with CAPT. So to get the printer to work I had to use the commands given here:" Making Canon LBP6000 printer work under Ubuntu 14.04 64-bit
I used the kill commands (as given in update 2 of the link above) to stop capt and restart it.

also captstatusui command is handy while printing to check for any errors: sudo captstatusui -P LBP2900


How to enable Dropbox panel icon at startup in Lubuntu?

I worked on a solution for this. If I run these commands:

#!/bin/bash
dropbox stop
sleep 5
dbus-launch dropbox start -i

Dropbox icon will work like a charm, as image below:

So I saved a bash script as /opt/dropbox-start.sh

Boring is having to open a terminal to execute it. If I put in ~/.profile, it locks lxsession startup. Changing the Exec line in ~/.config/autostart/dropbox launcher, doesn't work, because this launcher is a copy from /usr/share/applications/dropbox.desktop and it will be replaced by this one at system startup.

So I decided to change Exec line directly in /usr/share/applications/dropbox.desktoplauncher, as it follows:

[Desktop Entry]
Name=Dropbox
GenericName=File Synchronizer
Comment=Sync your files across computers and to the web
Exec=bash /opt/dropbox-start.sh
Terminal=false
Type=Application
Icon=dropbox
Categories=Network;FileTransfer;
StartupNotify=false

This solution works even if there are several accounts in the computer, because the change was not saved in $HOME folder. To assure dropbox will autostart, check at

  Preferences > Default Applications for LXSession

if Dropbox is checked as shown below:


First of all you have to get the kernel sources. Please have a look at the answer to »Getting the kernel source in Ubuntu«. It shows you where to get the sources. If you used the command apt-get source linux-source, you'll a tar.gz-file. You can double-click on it to unpack or use the command line:

tar xfz linux.tar.gz

You might also need several other packages. This command installs all needed:

sudo apt-get install git kernel-package fakeroot build-essential ncurses-dev

Now you should change into the directory where your kernel sources reside. If you downloaded it with git they might be in the subdirectory linux. Otherwise they are copied to /usr/src.

In the next step you should copy your existing kernel config file to the source tree:

cp /boot/config-$(uname -r) .config

And now you can execute

make menuconfig

and enter your changes. Please see also the site GitKernelBuild in the Ubuntu wiki for more advice.
After you saved your changes you can compile your new kernel:

CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers

and if you enter ls .. you'll see some .deb files. You can install them and use your new kernel.


14.04 Ubuntu loads an empty desktop after recent apt-get upgrade

I'm a bit late to the party, but if you still have issues, and particularly if you have a line like
(EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found) in your xorg log file, consider this answer:

(Black Screen after login Ubuntu guest on OS 10.10.1)
https://forums.virtualbox.org/viewtopic.php?f=8&t=65158

It boils down to ensure that no nvidia-related package is installed.
Cheers


I might be wrong on this but it is my understanding that if you give a utility root privileges and it gets compromised by malicious code, then the malicious code also gets root privileges.

It is my understanding that for this reason Ubuntu handles security differently from other distributions. It does not install a root user. It installs a user that gets root privileges when that user, as administrator, needs root privileges. Once the task is finished or the time limit has been reached the user with administrator access loses the root privileges. This reduces the risk of malicious code getting root access.

This is why in Ubuntu we do not use "su" but "sudo" before a command in the terminal. We limit the opportunity for malicious code to get access and do damage by restricting our use of root privileges.

This is the document that I get my understanding from:

Ubuntu reasons for sudo and not su or root

I strongly advise you to consider the reasons that the Ubuntu developers have for doing things this way. It is those reasons that cause me to say that what you intend to do is not safe.

I quote the official document:

  By default, the Root account password is locked in Ubuntu. This means
  that you cannot login as Root directly or use the su command to become
  the Root user. However, since the Root account physically exists it is
  still possible to run programs with root-level privileges. This is
  where sudo comes in - it allows authorized users (normally
  "Administrative" users; for further information please refer to
  AddUsersHowto) to run certain programs as Root without having to know
  the root password.


How can I change to Kubuntu from Ubuntu?

Changing from one Desktop Environment to another (like KDE) isn't an upgrade; it's like changing from a Ford to a Chevy, it's just different. and often just a matter of personal preference. (The obvious analogy of Lubuntu with its very lightweight LXQt desktop to a Type 1 VW I shall leave to others).

Duplicate items? If you don't remove GNOME first, that's what you will get. Do

sudo apt autoremove gdm3 lightdm gnome-shell-extension-tool ubuntu-gnome-desktop gnome-shell && sudo apt install plasma* sddm kde* qml-module-org-kde* libkf5kdelibs4support* libkf5libkdepim* software-properties-kde xdg-desktop-portal-kde libkde* konsole

after you've read these articles so you understand why:

Upgrade from KUbuntu-16.04 to Ubuntu-18.04

What is gdm3, kdm, lightdm? How to install and remove them?

How can I remove Gnome Desktop Environment without messing Unity DE? (Ubuntu 16.04)

Another perfectly good method is to

back up /home
verify the backup is good
make a list of every app you now have with find /usr/share/applications -maxdepth 1 -type f -exec basename {} .desktop \; | sort > ~/Desktop/applications.txt
decide if you want to keep each of them or replace them with the KDE version
edit the list of apps ~/Desktop/applications.txt to remove those you don't want and save that list so you can use it later
install Kubuntu directly, overwriting Ubuntu
pour your data from /home back into the newly installed Kubuntu, leaving out the configurations you no longer need, so you can keep your browser settings and data
reinstall the apps you decided to keep using sudo apt install < applications.txt


Ubuntu 12.04 and MacBook 4,1 wireless problem; NO wired connection

I'm proud to report that wireless is now, for the most part, working!

I went back over Broadcom's instructions (see the second link under UPDATE 2), but used the sudo command before everything to solve the permissions issue. The make command (no clean) worked, automatically using the cfg80211 API. On step 1 of the instructions for a fresh installation, I had to issue rmmod ssb_hcd before rmmod ssb as the former was using the latter, and I blacklisted both modules. On step 2, modprobe lib80211 and modprobe cfg80211 worked. On step 3, in addition to the cp and depmod commands, I used echo wl >> /etc/modules instead of the command suggested for Fedora/SUSE (thanks to gertvdijk for the link to that). I had to go back and follow the instructions for "Common issues" under step 2 to prevent ssb from loading at boot, even though it was blacklisted.

Everything worked until I ran a software update. The kernel was updated, so I did exactly what I did before and it now works again. So unfortunately it looks like this method must be repeated every time the kernel is changed.

Only problem now is it often seems to take a while before I actually get an internet connection. It recognizes the network and all, but I find I have to keep retrying to load web pages for a while. Sometimes disconnecting and reconnecting helps. The patchiness of my provider's data network through iPhone tethering over WiFi makes it difficult to identify exactly where the issue is. I sometimes have trouble with it in OS X and even on other computers in the house, and frequently have to reset the personal hotspot option (and sometimes the cellular data network connection) on the phone. So I'm not thinking it's a problem with Ubuntu. It just seems worse with it, but I'm probably just nitpicking. It is weird, though, that I only see two "bars" of signal strength. Then again, OS X only shows the tethering icon, with no indication of signal strength, so who knows.

UPDATE: Perhaps I spoke too soon! It's getting really annoying having to either wait or play around with network settings to get a good internet connection. I just tried OS X and Ubuntu right next to each other and there's definitely something funky going on with the way Ubuntu is getting wireless. Strange that it wasn't like this the other day when I first got it working.


How to change the Launcher icon of a Chrome app

First, get the identifier of the extension, by searching it on Chrome store and extracting it from the URL. For instance, LINE is at https://chrome.google.com/webstore/detail/line/menkifleemblimdogmoihpfopnplikde?hl=en so the identifier is menkifleemblimdogmoihpfopnplikde.

Now in your home directory open the file ~/.local/share/applications/chrome-menkifleemblimdogmoihpfopnplikde-Default.desktop (replace with the correct identifier)

At the Icon= line, replace the value with the path of a 48x48 PNG file of your choice.

The problem with this approach is that for some reason the icon is reset at every reboot, so you have to do it every time, or set some script to do it.


After upgrading from 13.04 to 13.10 I get a black screen (ubuntu)

I faced something like that a few times but I never managed to make it work correctly however there is one thing that I didn't try 'sudo do-release-upgrade'.I hope that this helps you.


pure-ftpd fails to install (Couldn't examine directory /etc/pure-ftpd/conf)

Found the solution to this issue.  It appears pure-ftpd-common was also installed, I would think this package works with the configuration files and the following command solve this issue;

apt-get remove --purge pure-ftpd pure-ftpd-common


Tmux: jumping over words in the terminal

To jump over words enable xterm-keys: set-window-option -g xterm-keys on

source


How do I change background entry color when renaming a file, folder etc.?

After working around for hours with help of theme developer I finally came up with a solution for Nautilus, so to change background entry color when renaming a folder or a file you need to create a small code inside theme folder exactly at:

sudo -H gedit /usr/share/themes/name-of-the-theme/gtk-3.0/nautilus-entry-section.css

and add this code:

NautilusCanvasViewContainer.view EelEditableLabel.entry {
background-image: none;
background:black;
}

You can edit your way refering to a color even blue or yellow etc... When done, save & close.

Now we should give gtk-main a path to read it be named gtk-main.css mostly or only gtk.css:

sudo -H gedit /usr/share/themes/name-of-the-theme/gtk-3.0/gtk-main.css

And going all the way to the bottom add at the end:

@import url("nautilus-entry-section.css");

Save & close it. That's it, done!

Just use a tweak tool to reload a theme.


How can I know which commands were installed with a package?

Short answer:

dpkg -L packagename | grep 'bin/'

Long answer:

To get a list of all files installed in a package (say moreutils), run this command:

dpkg -L moreutils

Now, all we need to do is filter out the ones that are executable files in the path. In general, commands are installed to /bin, /sbin, /usr/bin and /usr/sbin, so we can simply match those patterns:

dpkg -L moreutils | grep -e '^/bin/' -e '^/sbin/' -e '^/usr/bin/' -e '^/usr/sbin/'

If you want something that's easier to memorise, but not completely accurate, just filter out lines with bin/ instead:

$ dpkg -L moreutils | grep 'bin/'
/usr/bin/isutf8
/usr/bin/pee
/usr/bin/errno
/usr/bin/vidir
/usr/bin/zrun
/usr/bin/lckdo
/usr/bin/ifne
/usr/bin/mispipe
/usr/bin/parallel
/usr/bin/sponge
/usr/bin/ts
/usr/bin/ifdata
/usr/bin/vipe
/usr/bin/chronic
/usr/bin/combine

So, in this example, I have discovered these commands: isutf8, pee, errno, etc.

Some packages don't install commands into the path, but do install an icon for the GUI app. If you want to find the command that launches the application, you will need to find the installed .desktop file, and look at the line beginning with Exec=. For example:

$ dpkg -L worldofgoo | grep '\.desktop$'
/usr/share/applications/WorldOfGoo.desktop

$ grep '^Exec=' /usr/share/applications/WorldOfGoo.desktop
Exec=/opt/WorldOfGoo/WorldOfGoo

So in this example, I have discovered that I should run /opt/WorldOfGoo/WorldOfGoo to launch World Of Goo from the terminal.


Open Rhythmbox, click Edit --> Preferences --> Music Tab, and point the Library Location to the music library in whatever directory you have the music stored in.


I had the same problem with 2 wireless printers. I found I had to reserve the URLs in the router to get them to work consistently. Evidently, Ubuntu uses a static URL to access a wireless printer and cannot do so if the router is changing it every time you turn it on which it will do if you turn other wireless devices on or off. Sometimes the router will assign the correct URL by luck, but when it doesn't,  the print que will give you a "cannot obtain printer status".


How install Tex-live on Ubuntu Kylin not showing on Software?

You could open a terminal by pressing Ctrl + T, and run:

sudo apt-get install texlive

There is no hyphen in the package name.


You cannot turn it off in the current (3.5) LibreOffice version. However, this has been bothering other people. The discussion here points to this page containing a patch that makes the header/footer appear on a click, rather than mouseover. Starting with version 3.7, there should be a setting for this.


I cloned a driver package from Github and installed it; Can I delete this folder now?

You can safely delete the folder and nothing will happens, the cloned folder contain nothing more than a installation script (usually a driver will have a makefile).
Neither of the driver file should be located on home directory, probably there are several who does it but this is highly unlikely— most of the time driver file are located on directory owned by root, and in no way a normal user would interfere without having root privilege.
So yeah, you can delete the file.


Try this:

gawk -F, '
    # spawns nslookup as a coprocess, passes the IP into its stdin
    # then reads the output of the coprocess to find the hostname
    function get_name(ip,      line, name) {
        name = "UNRESOLVED"
        print ip |& "nslookup"
        close("nslookup", "to")
        while (("nslookup" |& getline line) > 0) {
            if (match(/name =(.+)\.uncc\.edu\./, line, m))
                name = m[1]
        }
        close("nslookup")
        return name
    }
    { print $1, get_name($1), $2, $3, $4, $5, $6 }
' "$1" > "$outfile"

ref: https://www.gnu.org/software/gawk/manual/html_node/Two_002dway-I_002fO.html


TouchPad not working Dell Latitude E5420

This used to happen to me a fair bit. To fix it, open a terminal window (Ctrl+Alt+T), then type:

synclient TouchpadOff=0

This should tell your synaptics driver to enable your touchpad.


How to permanently block udp on all ports on all connections including pppoe

To just block outgoing UDP connections irrespective of port, don't specify a port. Just specify the protocol:

iptables -A OUTPUT -p udp -j DROP

The same applies for TCP (-p tcp).


See edit below

Plasma browser integration is not available in Kubuntu 18.04. This feature requires Plasma 5.13. Kubuntu 18.04 has Plasma 5.12 and will remain on 5.12 for the rest of its life.

If you have installed the Firefox extension required for Plasma browser integration, remove it.

Edit: A Kubuntu developer mentioned that plasma-browser-integration is available for Kubuntu 18.04. But it requires adding the Kubuntu Backports ppa and following the instructions in the link.

In addition to plasma-browser-integration, other selected packages will be updated to more recent versions than normally available. You can get an idea by looking at this link.


How do I resolve 'skipping acquire of configured file error

It seems like your sources list is not configured properly: either the file you've created at /etc/apt/sources.list.d/ (usually virtualbox.list if created when using a script or a tutorial),
 or  the file /etc/apt/sources.list if you've edited it directly.
You actually have two problems here:

Wrong dist name (no error currently shown, but will pop up as soon as we fix your main problem).
 May be fixed by changing the word bionic with focal, so your stanza would be:
deb http://download.virtualbox.org/virtualbox/debian focal contrib

Wrong architectures chosen to be looked for in the given target repository.
This involves the understanding of how repositories actually work, and causing your problem.

When installing a package using the APT util, it connects to a repository such as this one (you may actually browse them using your web browser), and searches for a Release file or a InRelease file, that describes important key information regarding the available packages in this repository.
Notice that in the given Ubuntu repo examples, those files include these architectures:

Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x

Ubuntu 20.04 OS is only 64bit (amd64) arch, so why is it searching for 32 bit (i386)?
By default, Ubuntu's APT will also search for i386 packages, although will not install them unless we configure it to do so by dpkg.
Your problem occurs only because of how APT is designed to work. If your source list file is configured to connect to a repo that supports both amd64 and i386 archs, it will expect the InRelease file to have amd64 and i386 written at the architecture stanza: Architectures: amd64 i386.
VirtualBox's repo InRelease file only has amd64 written in it, thus APT skips this repo, even if it has a package matching your needs and OS, only because you described you need a repo that also supports i386.
Solution:
Since we can't control what's written in VirtualBox's server files, we'll have to change something in our local system.
Edit your sources list and tell APT to search for a repo that only holds amd64 architecture packages - add [arch=amd64] to your stanza:
deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian focal contrib


I can't install Windows 10 alongside my Ubuntu

It sounds like the issue is that you can't boot from the USB itself. If you are spamming the correct key to view the boot options when the computer turns on you should be able to select your flash drive as the boot option.

On most laptops and pcs to view the boot options you have to spam either F9 or ESC as the computer boots up to view the boot options.


Setting path permanently for openmpi in ubuntu

echo 'export PATH="$PATH:/home/$USER/.openmpi/bin"' | tee -a /home/$USER/.bashrc

and

echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/"' | tee -a /home/$USER/.bashrc


Why does 'install-info' keep warning me about "lilypond"?

This is a known bug in the Lilypond package and has not yet been fixed.

The warnings are annoying but harmless, so I'd just ignore them (or remove the lilypond package).

Hopefully this will be fixed by the time Ubuntu 12.10 is released


What are interesting uses for a web cam beyond video chat?

Cheese
Cheese uses your webcam to take photos and videos, applies fancy special effects and lets you share the fun with others. It's a photo booth like application written for GNOME and is loads of fun!
sudo apt-get install cheese


Changing ulimit on ubuntu 12.04 Never works

I was able to successfully change my ulimit real time priority and memlock by doing this:

Open /etc/security/limits.conf and add these lines (replace 'tyler' with your Ubuntu user name)

tyler hard rtprio 95
tyler soft rtprio 95
tyler hard memlock unlimited
tyler soft memlock unlimited

Open /etc/pam.d/su and make sure the following line is present, and not commented out:

session    required   pam_limits.so

After that, I just needed to restart my computer, then I could use this terminal command to check my ulimit:

ulimit -r -l


Xubuntu 20.04 Automatic Ubiquity - Installing Additional Packages

I had struggled with this issue for server days until I found the answer. Apparently the installer shuts down the network interface at the end of the installation. You need to bring the network interface up to allow network access so it can download the apps. Try this but change the interface name ens160 to match yours.
ubiquity ubiquity/success_command string
string ip link set up dev ens160;
dhclient ens160;
apt-get update -y;
in-target apt-get install -y openssh-server;


Heeadless reboot of Ubuntu 20.04on Raspberry PI

The command to reboot the system is sudo reboot.
You will be promoted to authenticate, and the system will reboot.
If you do not know how to run commands on your raspberry pi from another device you should research and ask about how to enable and configure SSH headless on a raspberry pi.


I would do this with a little shell script:

for i in `seq -w 150`
do
  wget -c http://example.com/image$i.jpg
done

There are also guis like gwget that can do this.


Manage passwords in Chromium --> security risk?

Google leaves your Chrome passwords unprotected to promote security. (article)

  Google doesn't secure stored passwords, stating that it does not want
  "to provide users with a false sense of security and encourage risky
  behavior." Schuh's argument is that if a would-be attacker had access
  to a user's machine then "the game was lost," as there would be "too
  many vectors for [the attacker] to get what he wants."


Is there any Ubuntu flavor that handles HiDPI consistently?

No, there isn't any so far--see Answerer's note at the end.

What is "consistent"

Before one disagrees with this answer, make sure to understand the question by OP. Given that one needs to manually set DPI value or scale factor of desktop environment, which varies for different monitors, we can't say Ubuntu "handles HiDPI consistently".

I would understand "consistent" as more towards out-of-box experience (Even OP has mentioned this in the question). That is, in terms of the ability of operating system to use appropriate settings for any given hardware and application software that respects the settings.

Does Ubuntu offer out-of-box experience for HiDPI support? No, or mostly uncertain.

HiDPI support for Ubuntu

Trusty Tahr (14.04) is the first Ubuntu release that explicitly mentioned HiDPI support. Even before the release, relevant information can be traced back to this dated message.

  cairo 1.13 snapshot in the ubuntu-desktop ppa (Hi-DPI support testing)

  Better support for Hi-DPI screen is a topic that is being discussed for the coming LTS [...]

From TrustyTahr/ReleaseNotes for 14.04:

  Support for High-DPI screens and desktop scaling
  Initial HiDPI support for LibreOffice

From XenialXerus/ReleaseNotes for 16.04:

  Improved HiDPI support in the greeter
  Support for scaling cursors in HiDPI environments

HiDPI support for others

From blog post Kubuntu and HiDPI Screen dated 16 February 2016, by Giri Alam:

  Kubuntu/KDE is not perfect on HiDPI screen. Currently, there is no utility to automatically detect and scale the UI based on device screen resolution and Dots Per Inch (DPI) value, but the workaround to make Kubuntu more usable on HiDPI screen is quite simple.

From blog post Ubuntu MATE 16.10 Alpha 1 dated late June 2016, on Ubuntu MATE blog:

  We have initial HiDPI support (almost) working. Don’t get too excited, this is an all or nothing implementation. When enabled all GTK3+ applications (not just MATE) will be rendered using high quality pixel doubling. If you have a 2160p display, it looks ace :-D

However, no mention of HiDPI support status in the final release note of Ubuntu MATE 16.10.

From GNOME Wiki HowDoI/HiDpi:

  GNOME currently enables hi-dpi support when the screen resolution is at least 192 dpi and the screen height (in device pixels) is at least 1200.

From reddit thread of BudgieRemix dated mid-June 2016, prior to becoming Ubuntu Budgie:

  There doesn't seem to be HiDPI Support in any native settings menus, or on the lock screen. Scaling on the lock/login screen was added to Ubuntu 16.04 for HiDPI monitors.
  [...] scales everything correctly with a scale factor of 2, however there is one issue. [The icons in the system tray] do not scale and do not appear correctly.

And the only replied answer:

  None of the current members of the development team has a HiDPI monitor so we cannot reproduce the issues you raise :(

Overall HiDPI support

Although I have not quoted other sources here, most mentioned flavours for HiDPI support are Ubuntu GNOME and Ubuntu (Unity). Some mentioned Kubuntu/KDE and Xubuntu/Xfce, but not much information for hardware that actually worked for these flavours.

Disclaimers: This answer intends to review HiDPI support status, as 2016, for Ubuntu and its official flavours. The following limitations shall be noted.

Some flavours are not mentioned at all because those had no relevant information of HiDPI support
Non-Ubuntu flavours or unofficial derivatives are not mentioned, such as Linux Mint/Cinnamon, elementary OS/Pantheon
I don't have any HiDPI monitor or HiDPI supported hardware to verify above information; This answer solely quotes relevant information from the web

TL;DR The HiDPI support is work in progress, regardless of distribution and desktop environment. There isn't any Ubuntu flavour that handles HiDPI consistently yet.

Answerer's note: The HiDPI support may have improved since this answer was first written. Hence this answer is now a community wiki, so that anyone with minimum reputation can improve this post to keep up with how HiDPI support is being made consistent for newer releases of Ubuntu and the official flavours.


Q: Raid1 not booting after new hard drive installed

I have figured out what happened. Either of two things: 1) I messed up the partition table or 2) something else messed up the partition table and after a reboot there was NOTHING to be done.

Here's what I should have done when one disk of the raid1 died:

check the raid status with cat /proc/mdstat make sure the drive is really dead
mdadm examine gives more insight into the status of the raid
while system is still running make backups of stuff that is not properly backed up (f.e. before having the hard drive removed and forcing a reboot on an already stressed system)
make a backup of the partition table before doing anything else (prefer using gdisk interactively and list partitions before backing them up to be sure the right device/harddrive is used)
use mdadm to remove the failed hard-drive partitions from the raid with --fail cleanly
instead of copying partition table from one drive to the other use the backup to load it
A reboot may be needed to get the partitions properly set up (make sure all stuff is backed up before)
Use mdadm to add the new partitions back to the raid devices f.e. mdadm --add /dev/md1 /dev/sda2
If for some reason you forgot to execute the --fail you may be able to re-create the raid devices with this: mdadm --create /dev/md1 --assume-clean --level=1 --verbose --raid-devices=2 missing /dev/sdb2 (I am reasonably sure that was not what destroyed the filesystems on the remaining Harddrive

If I'd followed the above I'd never have got into the position above. Once there, I did not find a way out. So what made me sure the data was gone?

From a rescue system, I was unable to mount any of the devices with mount -t ext4 /dev/md1 /mnt/mountpoint. I kept getting errors that the file-system was not recognized and the magic numbers not found
Testdisk had found the wrong number of partitions when trying to recreate the partition table
dumpe2fs while giving me locations for a bunch of magic numbers helped nothing because none were valid, also these positions are "fixed" within the partition in certain positions so if the partition table is wrong, these positions don't line up anymore
fsck basically told me the same thing and one partition was sacrificed to an attempt to repair the file system but every single inode threw an error
I did a remote scan with R-Studio (commercial software from R-Tools, the scan and recovery of files up to 256kb is free) and while at first it looked like there were recoverable files, I used it to download a few jpgs and pngs and none contained valid image data
I tried a variety of things to find out what went wrong with the file system but everything came back to a messed up partition table and a failed recovery with testdisk.

So lessons learned: 1) keep a backup of the partition table somewhere safe (aka not on the server) 2) when stuff happens - do backups first 3) have a backup strategy before stuff happens


Scanning on Canon PIXMA MP270 does not work with Ubuntu 14.10

Some Canon scanners aren't yet fully supported by sane, especially PIXMA MP devices. (got one myself) However, Canon provides its scanning suite ScanGear MP for Linux. You can download it on Canon's support webiste of your country.

In some countries, including the U.S., the software isn't deployed. So here's the downlaod link from the Canon Switzerland support website.

Download the deb package and install it as you would do with any other. (Install with gdebi, USC, or directly with sudo dpkg -i <package_file>)

The package doesn't come with a desktop file, so take the one I made:

Name=Canon ScanGearMP
Exec=/usr/bin/scangearmp
Icon=scanner
Terminal=false
Type=Application
StartupNotify=true
Categories=Graphics

Save it as "scangearmp.desktop" in either /usr/share/applications/ (for all users) or ~/.local/share/applications/ (only for yourself)


Problems installing postgresql-9.4: Unable to locate package

You can install postgres 9.4 on Ubuntu 14.04!

Follow the instructions on http://www.postgresql.org/download/linux/ubuntu/:

  Create the file /etc/apt/sources.list.d/pgdg.list, and add a line
  for the repository:

deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main

  Import the repository signing key, and update the package lists:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
  sudo apt-key add -
sudo apt-get update

Now you can install with

sudo apt-get install postgresql-9.4


Search the repository to find the package:

sudo apt-cache search "glpk"

choose your relevant packages and install them using the command:

sudo apt-get install package1 package2

for case of the OP:

sudo apt-get install glpk-utils libglpk-dev glpk-doc python-glpk


how to install linux-headers-3.5.0-32-generic

If the following command works, then you should be able to install the package.

  apt-cache search linux-headers-3.5.0.32-generic

linux-headers-3.5.0.32-generic package is part of the software sources quantal-security, quantal-updates and quantal-proposed.

Hence one of the above software sources has to be ticked in

  Ubuntu Software Center >> Edit >> Software Sources >>> Updates


How to change the toolbar separator image?

You need to edit the theme's files (such as the gtkrc) to determine how the toolbars will look.


Execute a statement /bin/bash seems not to work in Virtualbox client

man bash

... i.e. try to adapt your code to bash -c 'echo Hello!'

Need to know more about bash?

http://tldp.org has at least two guides om bash - they will take you from a novice to an advanced level.


Ubuntu 18.04 is slow to boot, 53 seconds to reach multi-user target

This should answer your question:

Ubuntu 15.04 network manager causing slow boot

In short you can just disable the service.

systemctl disable NetworkManager-wait-online.service


1 GB is just barely enough to run Ubuntu, especially if you have an integrated graphics card stealing some of that.  32 bit might be slightly better, but you really just need more ram.  As an alternative, xubuntu or lubuntu need less ram.


No. It is physically impossible for an operating system to damage the LCD.

Most likely the problem was that the LCD's ribbon cable had a loose connection to the motherboard.

Either that or the display died on its own...


How do I get Wireless to work on a Asus Zenbook UX31(E)?

Upgrading the kernel to a newer version solves the problem.

In my case I downloaded a set of .deb packages from here:
http://people.canonical.com/~ogasawara/eugeni/rc6/amd64/

This kernel is patched for the Zenbook and works very well for me. Together with the instructions on this Wiki page, https://help.ubuntu.com/community/AsusZenbook, for a script to run before the suspend function, this makes for a fully functional system for me.


How can I change the default terminal window size in Ubuntu 18.04?

This is done through Profiles which is under in Preferences. You can create multiple profile and customize them.

Change Initial terminal size as shown in the image below. There are also many more customization choices there that you might be interested in. And even if you didn't find what you've been looking for, you always can use other terminal emulators like terminator instead of default gnome-terminal.


No option for 64-bit OS VirtualBox guest OS in Ubuntu 14.10 Dell OptiPlex 755

Enable Intel (R) Virtualization Technology and Intel (R) VT-d Feature in BIOS settings.


How can I extend the Tab key auto-completion in the terminal to text in the middle of a command?

Since you didn't mention the specific shell, one way is to install zsh.

sudo apt-get install zsh
# now change the default shell
chsh -s /usr/bin/zsh
sudo chsh -s /usr/bin/zsh

Now as you got zsh as the default shell instead of bash, to get a fuzzy completion add this to ~/.zshrc file:

zstyle ':completion:*' matcher-list '' \
  'm:{a-z\-}={A-Z\_}' \
  'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
  'r:|?=** m:{a-z\-}={A-Z\_}'

For example, this is how my ~/.zshrc looks like:

 # bash style (read as the adequate) for navigating words
 autoload -U select-word-style
 select-word-style bash

 # some plugins
 source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
 source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=7'
 zstyle ':completion:*' matcher-list '' \
         'm:{a-z\-}={A-Z\_}' \
         'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
         'r:|?=** m:{a-z\-}={A-Z\_}'
 bindkey \^U backward-kill-line

 #useful aliases
 alias grep1="grep --exclude-dir=\".*\""
 alias gdb="gdb -q"

NB: usefulness of zsh is that it is very extensible, and in many ways compatible to bash. On the opposite, e.g. fish (another alternative to bash, which is pretty much like a configured zsh) in my experience causes many incompatibility problems.

UPD: per OP comments: if you want to raise the requirement for letters to be close to each another (i.e. instead of fuzzy completion it's just a subsequence completion), then instead of regexp I mentioned you can put to ~/.zshrc this code:

zstyle ':completion:*' completer _complete
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*'
autoload -Uz compinit
compinit