Letting the users of my application select whether the app should start on login. Most cross-platform way to implement?

Distributions adhering to the X-Desktop specifications will autostart applications from a system wide directory XDG_CONFIG_DIRS/autostart, and from an autostart directory in the user's home. Only the latter will be accessible without root permissions.

Define an autostart application in HOME

1. Find autostart directory

We first need to know where out autostart directory resides. According to the X-Desktop specifications the location should be as follows:

  If the same filename is located under multiple Autostart Directories only the file under the most important directory should be used.

  Example: If $XDG_CONFIG_HOME is not set the Autostart Directory in the user's home directory is ~/.config/autostart/
  Example: If $XDG_CONFIG_DIRS is not set the system wide Autostart Directory is /etc/xdg/autostart/
  Example: If $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS are not set and the two files /etc/xdg/autostart/foo.desktop and ~/.config/autostart/foo.desktop exist then only the file ~/.config/autostart/foo.desktop will be used because ~/.config/autostart/ is more important than /etc/xdg/autostart/

In a standard Ubuntu installation $XDG_CONFIG_HOME is not defined. The autostart directory therefore resides in ~/.config/autostart. Any .desktop file located in this directory will start the corresponding application on login.

2. Create the autostart directory if not present

Before we can populate the autostart directory we need to check for its presence, and eventually have to create it.

3. Define .dektop file

For Unity and GNOME a minimum .desktop file will have the following content to enable autostarting an application:

[Desktop Entry]
Type=Application
Exec=</path/to/application>
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=<name of application>

We may distribute a template .desktop file with our application to copy it to or delete it from the autostart directory depending on user options set.

Define a system wide autostart application

To enable an autostarting application for all users we need to populate the system wide autostart directory (e.g. /etc/xdg/autostart) with our .desktop file.

To be able to do this from user options we need to temporarily allow root permissions. This can e.g. be done by calling a subprocess with pkexec from our settings dialog.

See also this related question:

How do I start applications automatically on login?


AlsaMixer Input Settings Reset on Reboot

I'm using the same Audio Card, and after dig a lot into this found that the default path is /etc/asound.state

After put the configuration into this path, and reboot the device all back to the correct way as defined into the State file.


Internet working on only one place ubuntu16.04

Thanks to this post I managed to solve my issue:
Internet connection working only on home WiFi

the problem was, that in

/etc/resolv.conf

the nameserver was 192.168.0.1
I changed it to 8.8.8.8 as the post suggested, and now everything works fine...


Copy the theme folder to ~/.local/share/themes, and activate it using Unity Tweak Tool.


Permission denied when trying to open a file in gimp

I was able to correct this error by giving the gimp snap access to the removable-media plug by entering the following command:

snap connect gimp:removable-media :removable-media

Best of Luck


Automatically detect which ethernet network I am plugged in to

Run this command in the terminal:

nm-connection-editor

A popup will appear.
Click the connection which you want to remove from default. Click Edit.
Click the Ethernet tab.
Uncheck the default option and click Save.
Then edit the connection you want to connect by default. Check the default option and then and the click the Save option.


wifi is not coming up in network connections in xubuntu 15.04

You tried everything but the correct command. To install firmware for your adapter you need to purge bcmwl-kernel-source and run

sudo apt-get install firmware-b43-installer


Distorted graphics resolution after updating quiet splash in Linux boot

So after searching a lot on the internet I finally corrected the graphics on my system.
I came upon a bug filed for Ubuntu 14.04.2, which is the version I am using.

Here is the link to the bug filed :bug #1424491

Scroll down to comment #24 by Nestor Acevedo. I followed the commands mentioned by him

sudo apt-get install libcheese*

followed by

sudo apt-get install xserver-xorg-core

and finally installed the fglrx updates through this command

sudo apt-get install fglrx

This corrected the graphics distortion on my system.


How to install Ubuntu GNOME on my HP Pavilion UEFI-based laptop running Windows 10

When dual-booting and starting with an existing Windows installation, it's almost always best to install Ubuntu in the same mode as Windows. In your case, since you've got Windows in EFI mode, you should install Ubuntu in the same way. From your description, it sounds like you're starting the process correctly.

Your partition layout looks complex, so I'd avoid the automatic options and use "Something Else" for partitioning. Several questions and answers on this site touch on how to do this, including:

Choosing "something else" when installing
Should I choose to Install alongside windows 8 or something else
How to use manual partitioning during installation?

One thing about your partitions jumps out at me: You have several small (465-841MiB) NTFS partitions following the unused space where you presumably intend to install Ubuntu. The first of those is over half used, but the other two are almost entirely unused. You might want to figure out what these partitions are, since you might want to delete or re-purpose one or more of them if they aren't in active use. Deleting such a partition might then necessitate moving another partition if you want to consolidate all the free space.


Stuffing In Multiple Bootable ISO's On The Same Pendrive

I googled "multiboot pendrive" and got this


RF stands for radio frequency. As per the Linux Wireless Wiki:

  rfkill is a small userspace tool to query the state of the rfkill
  switches, buttons and subsystem interfaces. Some devices come with a
  hard switch that lets you kill different types of RF radios:
  802.11 / Bluetooth / NFC / UWB / WAN / WIMAX / FM. Some times these buttons may kill more than one RF type. The Linux kernel rfkill
  subsystem exposes these hardware buttons and lets userspace query its
  status and set its status through a /dev/rfkill. Given that at times
  some RF devices do not have hardware rfkill buttons rfkill the Linux
  kernel also exposes software rfkill capabilities that allows userspace
  to mimic a hardware rfkill event and turn on or off RF.

As a side note if it hasn't become obvious yet, Wifi and Bluetooth devices are in fact radios and use digital modulation such as QPSK/DPSK instead of AM or FM (source - I'm an EET student). Note also that rfkill is a userspace command to expose functionality available in the Linux kernel's RFKill subsystem:

  Many computer systems contain radio transmitters, including Wi-Fi,
  Bluetooth, and 3G devices. These devices consume power, which is
  wasted when the device is not in use. RFKill is a subsystem in the
  Linux kernel that provides an interface through which radio
  transmitters in a computer system can be queried, activated, and
  deactivated. When transmitters are deactivated, they can be placed in
  a state where software can reactive them (a soft block) or where
  software cannot reactive them (a hard block).


How do I remap my capslock key to be alt + tab?

use xsetkbmap or xmodmap

Here is a quick into I have written no avoid forgetting how I did it. I wont tell you how to map those specific keys, but you will be well on your way. There are links to more thorough documentation.

umm... the link: http://genja.org/wordpress/2010/10/setxkbmap-genja/

You need something like the contents of /usr/share/X11/xkb/symbols/compose:
partial modifier_keys

xkb_symbols "caps" {
    key <CAPS> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] };
};

partial modifier_keys
xkb_symbols "102" {
    key <LSGT> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] };
};

partial modifier_keys
xkb_symbols "paus" {
    key <PAUS> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] };
};

partial modifier_keys
xkb_symbols "prsc" {
    key <PRSC> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] };

.. just study the links I gave you and the world will be under your domination in no time!


xubuntu 12.04 totally refuses to boot after install with wubi on old computer. any tips or suggestions on things i can do to fix this problem?

This almost sounds like a hardware problem.  You might try putting burning a disc or putting it on a flash drive so you can run the memory test that's available as a boot time option.

In the past, I had a computer that ran Windows fine, but could not install linux.  Ended up being bad memory that had to be replaced.


Having checked sysctl -a | grep swappiness to ensure that swappiness is set as desired, and swapon to ensure that the swap partition is mounted, there remains a possibility that the swap partition has been improperly formatted for some reason.

This can be corrected by

sudo swapoff -a
sudo /sbin/mkswap /dev/hda8
sudo swapon -a

where /dev/hda8 should be replaced with the partition or swapfile that is suspected of being bad.

The sources for this answer include https://help.ubuntu.com/community/SwapFaq in the section "Why is my swap not being used?", and Swap not being used


I got a fix for my Dell 5521 laptop, which works for Ubuntu 14.04 but it will work for kernels v3.13+

Open /etc/default/grub

sudo nano /etc/default/grub

Change line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video.use_native_backlight=1"

Then save Ctrl+O, exit Ctrl+X and run:

sudo update-grub

Reboot

Explanation is that acpi adds its own backlight control even if one is already present which is intel_backlight, adding this line forces acpi to use the Intel backlight.


netplan: ethernet preferred if available, otherwise wifi, but with same static IP address

This is much easier with static IPs than with dhcp, because all you need to do is declare the route metrics for each interface and when the ethernet has no carrier, networkd will not bring the routes up.  E.g.:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp2s0:
      addresses: [192.168.15.2/24]
      routes:
        - to: 0.0.0.0/0
          via: 192.168.15.1
          metric: 100
      nameservers:
        search: [mydomain, otherdomain]
        addresses: [192.168.15.1]
  wifis:
    wlx0013eff10948:
      access-points:
        "the-network":
          password: "the-password"
      addresses: [192.168.15.2/24]
      routes:
        - to: 0.0.0.0/0
          via: 192.168.15.1
          metric: 200
      nameservers:
        search: [mydomain, otherdomain]
        addresses: [192.168.15.1]

After running netplan apply, networkctl should then show output like:

$ networkctl
IDX LINK      TYPE     OPERATIONAL SETUP
  1 lo        loopback carrier     unmanaged
  2 enp0s31f6 ether    no-carrier  configuring
  3 wlp82s0   wlan     routable    configured

3 links listed.


How do I keep track of directories being created during installation of PostgreSQL?

First, why not just install from apt.postgresql.org?

If you're installing from source, don't bother with make uninstall.

PostgreSQL installs everything inside a single directory tree, which is specified with --prefix to configure. Use a unique prefix that doesn't yet contain anything. That way if you want to remove the PostgreSQL install, you just delete that directory and all its contents.

I usually:

sudo mkdir /opt/postgresql94
sudo chown $USER /opt/postgresql94
./configure --prefix=/opt/postgresql94
make
make -C contrib
make install
make -C contrib install

This lets me install without having to run a Makefile as root.

If I want to delete it I just sudo rm -r /opt/postgresql94.

To use the binaries installed I either:

export PATH=/opt/postgresql94/bin:$PATH

or add that to my .bash_profile.

You can just run the binaries directly, e.g.

/opt/postgresql94/bin/psql

but this won't work for initdb and pg_ctl so it's not that useful in practice.


I realized after posting this that my system is x86 and 18.04 is only available in x64. I'm installing 16.04 now. My bad.


Dual Boot: Ubuntu 18.04 and Windows 10 - Bitlocker Asking for a key

You probably activated Full Disk Encryption when installing Ubuntu 18.04, and doing this encrypted the Windows partition too. I don't think it's impossible to remove the LUKS encryption, but it's not easy at all for a beginner (see here and here). If you have all your data backed up, just do a fresh install of both Windows and Ubuntu. And don't activate LUKS again, try some other encryption technique if it's important for you to have encryption, this question may be a good starting point.


First you must set public ip or port forwarding from public ip, port 80, to your nginx server.

Then you must have connection between nginx and apache 1, between nginx and apache 2 and between apache 1 and apache 2.

                  | port 80 | prublic ip or fw from public ip
              -----------------------
              |        nginx        |
              -----------------------
             / 10.10.10.1           \
            / 10.10.10.2             \ 10.10.10.3
    |---------|                  |---------|
    | apache1 |------------------| apache2 |
    |---------|                  |---------|

Connection between nginx and apache is user for load balancing

Connection between apach 1 and apache 2 is for app replication.
You must have the same, synced, app on both apache node.

The following load balancing mechanisms (or methods) are supported in nginx:

round-robin — requests to the application servers are distributed in a round-robin fashion,

least-connected — next request is assigned to the server with the least number of active connections,

ip-hash — a hash-function is used to determine what server should be selected for the next request (based on the client’s IP address).
Default load balancing configuration

The simplest configuration for load balancing with nginx may look like the following:

http {
upstream myapp1 {
    server apache1.example.com;
    server apache2.example.com;
}

server {
    listen 80;

    location / {
        proxy_pass http://myapp1;
        }
    }
}

More example of configuration and posibilitis you can find here


How to type a function using alias in fish shell?

function repeat
set n "$argv[1]";
set m "$argv[2]";
for i in (seq $n) ; set i $i+1
echo "Starting date";date
sleep 5;
echo "Before Waiting";date
sleep 10
echo "After Waiting";date
/usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
/usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
/usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
eval $m
end
end

Well this is the answer I have come up with and it works. It uses the mpv media player.
Let me know if any further changes can be done.


Removing /lib/firmware/amdgpu/raven_dmcu.bin and running sudo update-initramfs -u -k all solved this problem.


How to determine the HTTP status without downloading the complete page?

curl -I fetches only the HTTP headers; it does not download the whole page. From man curl:

-I, --head
      (HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature
      the command HEAD which this uses to get nothing but  the  header
      of  a  document. When used on an FTP or FILE file, curl displays
      the file size and last modification time only.

Another option is to install lynx and use lynx -head -dump.

The HEAD request is specified by the HTTP 1.1 protocol (RFC 2616):

9.4 HEAD

   The HEAD method is identical to GET except that the server MUST NOT
   return a message-body in the response. The metainformation contained
   in the HTTP headers in response to a HEAD request SHOULD be identical
   to the information sent in response to a GET request. This method can
   be used for obtaining metainformation about the entity implied by the
   request without transferring the entity-body itself. This method is
   often used for testing hypertext links for validity, accessibility,
   and recent modification.


What is filesystem and efi doing in file explorer panel?

There only possibility I can think of is that a recent update caused the appearance of drives/partitions on your pc. On my pc filesystem is merely a shortcut to your root folder.efi means Extensible Firmware Interface system partition or ESP is a partition on a data storage device (usually a hard disk drive or solid-state drive) that is used by computers adhering to the Unified Extensible Firmware Interface (UEFI).


how can I prevent nautilus from running when I plug in a USB stick?

On Ubuntu 12.04, You can follow this procedure:

First install dconf-tools by the command sudo apt-get install dconf-tools.
Then open the dconf-editor by pressing Alt-F2 and typing dconf-editor.
In the dconf-editor window, go to the following steps:

org -> gnome -> desktop -> media-handling

then uncheck automount_open options
Exit dconf-editor.

Source: This page on Ubuntu forums


Error in Bucket Brigade script I'm running

There is a fi that  should  not exist in the line 114. The correct code would be this:

#!/bin/bash

# Bucket brigade - brigade script
# The user defines a fire
# The user defines number of passers
# Then passers extinguish the fire

if [[ "$2" = *[!0-9]* ]]; then
    echo "The second argument may only contain digits"
    exit
fi

# $2 must be empty or contain only digits to pass this point

case "$1" in

    fire)
        if [ -z "$2" ]; then
            echo Please provide a fire size
            echo 'exe: brig fire 10'
        else
            echo "$2" > .fire.size
            echo "A fire of $2 intensity has started"
        fi
    ;;

    alarm)

        rm .report.pas.* 2> /dev/null

        if [ -z "$2" ]; then
            echo Please provide the number of passers
            echo 'exe: brig alarm 5'
        elif [ "$2" -lt 2 ]; then
            echo "There needs to be more than one passer"
        else

            passvar="$2"
            export totalpass="$2"
            #passers check exported variable to see if they are high number
            touch .keep.passing
            echo "$totalpass Passers have been activated"
            while [ "$passvar" -gt 0 ]; do

                bash passer "$passvar" &
                ((passvar--))
            done
        fi
    ;;

    status)

        firenow=0

        clear
        echo "Report of situation as of"
        echo $(date)

        if  [ -e .fire.size ]; then
            firenow=$(cat .fire.size)
        fi

        if [ "$firenow" -gt 0 ]; then
            echo "The fire is blazing with $firenow intensity"
        else
            echo "No fire is active"
        fi

        if [ -e .keep.passing ]; then

            touch .passers.pause
            sleep 3

            ls | grep bucket. > .current.buckets
            cat bucket.* > .bucket.contents

            echo "The current active buckets and contents:"
            paste .current.buckets .bucket.contents | tr '\t' '\n'

            rm .current.buckets
            rm .bucket.contents
            rm .passers.pause

        else
            echo "There are no buckets currently active"
        fi

    ;;

    quit)
        rm .keep.passing 2> /dev/null
        sleep 1
        rm .fire.size 2> /dev/null
        rm bucket.* 2> /dev/null

        if [ -e .report.pas.1 ]; then
            cat .report.pas.* >> .unified.report
        # This is the wrong "fi" ######################################## ;-)

            clear
            echo 'Generating Report for this session'
            sleep 3
            cat .unified.report | more
        else
            echo "No reports exist at this time"
        fi
    ;;

    *)
        echo 'Usage: brig [fire (n)|alarm (n)|status|report|quit]'
esac

Note that I've indented your code, Personally, I can give you a few recommendations:

Please, by the God sake! do not put semicolons and then newlines! ;-)
If do you want to make a good conditional take one of these examples:

then in the same line:

if [ "my coding style" == "can be improved" ]; then
    echo "I accept suggestions ;-)"
fi

then in a separated line:

if [ "my coding style" == "can be improved" ]
then
    echo "I accept suggestions ;-)"
fi

I don't know why you're splitting short comments on various lines, I don't do that.
Please, indent your code 2, 4 or 8 spaces (I'd recommend 4).
Don't sleep 3 seconds while you're doing nothing.

Sorry if I made any mistake, English isn't my mother tongue.

Hope it helps.


Have you installed any drivers?

Run sudo add-apt-repository ppa:ubuntu-x-swat/x-updatesin terminal.

Then press ctrl-alt-f1 in desktop and run

sudo /etc/init.d/lightdm stop
sudo apt-get update
sudo apt-get install nvidia-current nvidia-settings
sudo reboot


You have included the header file in the compilation command. Use the following command:

g++ Vector3D.cpp -o prueba

This command will remove the warning for pragma. However, your CPP file does not contain any main function. So, g++ can not create an executable.

You can change the file to:

#include "Vector3D.h"

Vector3D::Vector3D(float ix,float iy,float iz){
    x=ix;
    y=iy;
    z=iz;
}

int main() {
    return 0;
}

If you don't want to add a main function in the source code, then you can compile it just to create an object file by adding a -c switch like this:

g++ Vector3D.cpp -c -o prueba


with this output i would try

sudo dpkg --no-act --configure  -a

To see if the system want to do something and if I like what it outputs

sudo dpkg --configure  -a

`


`pip3 search ` shows version that it refuses to install

The core issue, which we debugged via chat, is that you upgraded pip.  This causes some... incompatibilities (and there's terminal dumps in the chat room from a 16.04 container to support this).

Step 1: Remove the upgraded pip versions

This one's easy, since you installed it in your local data - pip3 uninstall pip

This will remove the version of it in your local userspace.

Step 2: Close your terminal or SSH session, then reestablish it.

This is so the session forgets about the local userspace pip3 binary.

Step 3: Run the installation steps again for the PyPI packages you're after - pip3 install --upgrade --user aiohttp stig (this also installs stig, too, which you mentioned in chat was your goal)

This should install aiohttp version 3.4.0 (latest in PyPI as of this post) and stig.

We did all this in chat, and it installed aiohttp without issues.  The problem with upgrading pip versions is it will increase the chances that pip will not work since newer pip versions rely heavily on also having an updated Python version.  And unless you are using virtualenvs for your Python environments, you're stuck on the system's Python 3.5.2, of which the newer pip does not behave with.  (Note that this was also recognized during our tests).

Also note that aiohttp has a requirement listed on PyPI of Python 3.5.3 or higher.  This is not going to be resolved within a 16.04 environment, so you may need to resort to Python virtual environments with more updated Python, or VMs running Ubuntu 18.04, or containers (such as LXD based containers) with 18.04.  This gives you a more updated Python version.


Trouble installing Ubuntu Studio on separate internal hard drive

If your drive is not completely full you can  resize your existing partition and create a new partition with  Ubuntu Lice CD.

Boot from media ie USB or CD and choose Try Ubuntu.
Now  open GParted partition editor.

In GParted window select your hard disk from the dropdown list present in  top right cornrer.(You partition arrangement will be different.)

You should create 2 partitions, one for mount / and the other for swap.
1 Gib swap partition is sufficient.
Click on the partition and select Resize/Move.

It will open a popup window. The easiest way to resize a partition is by clicking and dragging the handles at either side of the bar, although you can also enter exact numbers.

Once you are satisfied with your partition arrangement, Apply it. it will create some unallocated space.
Create 2 partitions in unallocated space .
Now you can install Ubuntu on this partition.
After starting the installation, select Something else when Installation Type window appears.
Select partition on which you wan to install Ubuntu, with  type as EXT4 and mount point as /.
Select swap partition and select type as  linux-swap.
As it is your internal hard drive, changing the place of grub installation is not necessary.
Now click Next to proceed the installation process.


Using the command below:

ps u -u "$USER" | awk '/xrdp/ && ! /awk / {system("kill "$2)}'

Replace $USER with another user name if the process is running with a different user than you
Replace xrdp with your process name


I found the culprit. Output from declare -p was being saved to an array with the command:
mapfile -t SaveVars <<< "$(declare -p)"

Each time ~/.bashrc was resourced the array was doubling in size, as was the contents of declare -p. Currently over 1.1 GB:
$ declare -p | wc
    123    8179 1,103,480,262

NOTE: Commas (,) added for readability.
Inserting one line to empty the array (and an appropriate comment line of course) results in this:
# Empty array to prevent doubling everytime ~/.bashrc is resourced
SaveVars=()
# Save variable list before user creates new ones in shell
mapfile -t SaveVars <<< "$(declare -p)"

After this fix the size of variables stays the same after resourcing:
$ declare -p | wc
    120    1008   30529

$ . ~/.bashrc

$ declare -p | wc
    120    1008   30529


Yes it Does you can take a look here Mentioning the remmina package and listed here as Remmina in Ubuntu-Desktop packages .Screenshots would help

And for Adding Configuration

For the DVD and CD difference you can refer here

Whats the difference between the 12.04 CD and DVD versions?

What is on the DVD Edition of Ubuntu?


How to turn off Compiz's "drag to maximize" behaviour?

You can disable it from ccsm :  Click to install

Go to Windows management-->  Grid --> Edges --> Re-size Actions

Top Edge: change it to none.


UEFI Installation Ubuntu parallel to Windows 10

It would be a advantage to install ubuntu in uefi mode.
Turn off the legacy mode. If you might be able to boot into Windows 10 you can make ubuntu by Using  win32 disk imager

And make bootable usb drive and then install ubuntu.
remember one thing in new Laptop if after installing Ubuntu the system may default loads into Windows. So either you can go into bios to select the boot order. The Ubuntu is displayed as seperated disk. Or Press boot menu button in the starting of your pc and select boot order as you are doing in case of selecting your usb drive.


How can I make Inkscape run fast, without using these tricks?

This might not be the kind of answer you are looking for, but one thing you can do to make Inkscape feel faster is to change the display mode from "Normal" to "No Filters". Obviously you don't see the filters in that mode, but the preview renders a lot faster.

The option is in the menu View > Display mode > No Filters


DockbarX inside AWN, preview window shifted on dual-screen after shifting from single-screen

Not a fix, I'm afraid - I have the same issue; and I've found that selecting a new theme and applying it sorts it too:

Right-click handle of dockbar
Select properties
Choose a new theme
Apply


This comes more or less close to the Ubuntu bash PS1

.zshrc:

alias ll='ls -al'

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

autoload -U colors && colors
PS1="%{$fg[green]%}%n@%m%{$reset_color%}:%{$fg[cyan]%}%1~%{$reset_color%} %% "


Bash script to backup/clone Ubuntu to another partition

Bash script to clone active Ubuntu Partition to clone partition
The clone-ubuntu.sh bash script will seamlessly and safely replicate 16.04 LTS into a partition for upgrading to 18.04 LTS:

Important points to consider:

You must create an empty ext4 partition large enough to hold a Ubuntu 16.04 clone
When calling the script clone-ubuntu.sh the partition cannot be mounted. The script automatically mounts and unmounts the partition.
The command rsync is used to copy files from / to the clone partition. The first time you run clone-ubuntu.sh it will take a few minutes. The second time you run the script only file changes are updated and it should take less than a minute.
You might run this script and reboot multiple times. Any new data on the clone target will deleted to mirror the current / files & directories.
All Cron /etc/cron.d (reboot) jobs are moved to a new sub-directory called /etc/cron.d/hold. After booting clone remember to run sudo crontab -e to prevent selected cron jobs from running.
The cloned file /etc/fstab is modified with the appropriate UUID for the partition it is on.
The cloned file /boot/grub/grub.cfg is modified with the appropriate UUID for successful clone booting. The cloned file's quiet splash is changed to nosplash so you get scrolling terminal messaging. This gives visual awareness booting a clone rather than "Real" version.
update-grub is run to update Grub with new menu options pointing to the cloned partition.
The cloned file /etc/update-manager/release-upgrades is modified to change Prompt=never to Prompt=lts. When you boot the clone and perform do-release-upgrade -d this allows Ubuntu 16.04 to be upgraded to 18.04.
Before cloning a confirmation screen is displayed (shown in the next section) and you must type y/Y to proceed.

Confirmation Screen
After selecting a target clone partition it is first verified to be ext4 partition type and is not already mounted. If this test is passed, a confirmation message then appears:
=====================================================================
Mounting clone partition /dev/nvme0n1p8 as /mnt/clone16.04

=====================================================================
PLEASE: Carefully confirm Source (Live) and Target (Clone) partitions

SOURCE (BOOT /):  /dev/nvme0n1p5      TARGET (CLONE):  /dev/nvme0n1p8
ID:               Ubuntu              ID:              Ubuntu
RELEASE:          16.04               RELEASE:         16.04
CODENAME:         xenial              CODENAME:        xenial
DESCRIPTION:      Ubuntu 16.04.3 LTS  DESCRIPTION:     Ubuntu 16.04.3 LTS
 Size  Used Avail Use%                 Size  Used Avail Use%
  44G   17G   26G  40%                  24G   17G  5.8G  74%

NOTE: If you are recloning, new files in clone will be deleted,
      modified files are reset to current source content and,
      files deleted from clone are added back from source.

Type Y (or y) to proceed. Any other key to exit:

In this example a previous clone has been selected for recloning. The available space on the clone is a mute point because we already know there is enough space available.
If you have multiple Ubuntu installations, please verify you have selected the right partition to clone the currently booted Ubuntu, mounted as / (root), to.
This is your last chance to abort by pressing any key except y or Y.

Output listing
When you run the script you will get this output (excluding the output already listed above):
=====================================================================
Using rsync to clone / to /dev/nvme0n1p8 mounted as /mnt/clone16.04
          6.11G  38%   86.46MB/s    0:01:07 (xfr#139123, to-chk=0/647700)

Number of files: 647,700 (reg: 470,100, dir: 104,694, link: 72,903, special: 3)
Number of created files: 127,824 (reg: 72,472, dir: 15,825, link: 39,526, special: 1)
Number of deleted files: 73,318 (reg: 59,766, dir: 9,701, link: 3,847, special: 4)
Number of regular files transferred: 139,123
Total file size: 15.92G bytes
Total transferred file size: 6.11G bytes
Literal data: 6.11G bytes
Matched data: 0 bytes
File list size: 8.50M
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 6.14G
Total bytes received: 7.82M

sent 6.14G bytes  received 7.82M bytes  89.74M bytes/sec
total size is 15.92G  speedup is 2.59

Time to clone files: 68 Seconds

=====================================================================
Making changes in: /mnt/clone16.04/etc/update-manager/release-upgrades
     from Prompt=: never
       to Prompt=: lts
Allows running 'do-release-upgrade -d' when rebooting clone target
Consider 'do-release-upgrade -d -f DistUpgradeViewNonInteractive' This
allows you to go to bed or go to lunch whilst upgrade runs.

* * *  When you Upgrade, TURN OFF screen locking for inactivity. * * *

=====================================================================
Making changes in: /mnt/clone16.04/etc/fstab
        from UUID: f3f8e7bc-b337-4194-88b8-3a513f6be55b
          to UUID: 113f9955-a064-4ce2-9cae-74f2a9518550

=====================================================================
Making changes in: /mnt/clone16.04/boot/grub/grub.cfg
        from UUID: f3f8e7bc-b337-4194-88b8-3a513f6be55b
          to UUID: 113f9955-a064-4ce2-9cae-74f2a9518550
Also change 'quiet splash' to 'nosplash' for environmental awareness
Suggest first time booting clone you make wallpaper unique

=====================================================================
Calling 'update-grub' to create new boot menu
Generating grub configuration file ...
Found background: /home/rick/Pictures/1600x900/21.jpg
Found background image: /home/rick/Pictures/1600x900/21.jpg
Found linux image: /boot/vmlinuz-4.14.34-041434-generic
Found initrd image: /boot/initrd.img-4.14.34-041434-generic
Found linux image: /boot/vmlinuz-4.14.31-041431-generic
Found initrd image: /boot/initrd.img-4.14.31-041431-generic
Found linux image: /boot/vmlinuz-4.14.30-041430-generic
Found initrd image: /boot/initrd.img-4.14.30-041430-generic
Found linux image: /boot/vmlinuz-4.14.27-041427-generic
Found initrd image: /boot/initrd.img-4.14.27-041427-generic
Found linux image: /boot/vmlinuz-4.14.15-041415-generic
Found initrd image: /boot/initrd.img-4.14.15-041415-generic
Found linux image: /boot/vmlinuz-4.14.10-041410-generic
Found initrd image: /boot/initrd.img-4.14.10-041410-generic
Found linux image: /boot/vmlinuz-4.14.4-041404-generic
Found initrd image: /boot/initrd.img-4.14.4-041404-generic
Found linux image: /boot/vmlinuz-4.14.2-041402-generic
Found initrd image: /boot/initrd.img-4.14.2-041402-generic
Found linux image: /boot/vmlinuz-4.13.9-041309-generic
Found initrd image: /boot/initrd.img-4.13.9-041309-generic
Found linux image: /boot/vmlinuz-4.10.0-42-generic
Found initrd image: /boot/initrd.img-4.10.0-42-generic
Found linux image: /boot/vmlinuz-4.9.77-040977-generic
Found initrd image: /boot/initrd.img-4.9.77-040977-generic
Found linux image: /boot/vmlinuz-4.4.0-104-generic
Found initrd image: /boot/initrd.img-4.4.0-104-generic
Found linux image: /boot/vmlinuz-3.16.53-031653-generic
Found initrd image: /boot/initrd.img-3.16.53-031653-generic
Found Windows Boot Manager on /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 16.04.3 LTS (16.04) on /dev/nvme0n1p8
Found Windows Boot Manager on /dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done

=====================================================================
Unmounting /dev/nvme0n1p8 as /mnt/clone16.04

rsync status display for new clone
When cloning for the first time, rsync will give an update from 0 to 100% of all files created. No files will be deleted or changed as the clone is empty:

rsync status display when recloning
When rsync reclones it never hits 100% because files that never changed are not copied. There will be delays in the update progress as rsync scans for the next file to be copied and when it deletes new files created in the clone that never existed in the original:

Bash script - clone-ubuntu.sh
#!/bin/bash

# NAME: clone-ubuntu.sh
# PATH: /usr/local/bin
# DESC: Written for AU Q&A: https://askubuntu.com/questions/1028604/bash-seemless-safe-script-to-upgrade-16-04-to-18-04/1028605#1028605
# DATE: Apr 27, 2018. Modified May 6, 2018.

# UPDT: May 02 2018 - Display selected parition and get confirmation.
#       May 06 2018 - Revise `do-release-upgrade -d` instructions.
#                     Correct listing of files in empty target partition.
#       Aug 09 2018 - Add --inplace parameter to `rsync`
#                     Comment out disabling `/etc/cron.d` on clone target.
#                     Users may uncomment and/or revise to their needs.

# $TERM variable may be missing when called via desktop shortcut
CurrentTERM=$(env | grep TERM)
if [[ $CurrentTERM == "" ]] ; then
    notify-send --urgency=critical \
                "$0 cannot be run from GUI without TERM environment variable."
    exit 1
fi

# Must run as root
if [[ $(id -u) -ne 0 ]] ; then echo "Usage: sudo $0" ; exit 1 ; fi

#
# Create unqique temporary file names
#

tmpPart=$(mktemp /tmp/clone-ubuntu.XXXXX)   # Partitions list
tmpMenu=$(mktemp /tmp/clone-ubuntu.XXXXX)   # Menu list
tmpInf1=$(mktemp /tmp/clone-ubuntu.XXXXX)   # Soucre (Booted) Ubuntu Info
tmpInf2=$(mktemp /tmp/clone-ubuntu.XXXXX)   # Target (Cloned) Ubuntu Info
tmpInf3=$(mktemp /tmp/clone-ubuntu.XXXXX)   # Work file used by DistInfo ()

#
# Function Cleanup () Removes temporary files
#

CleanUp () {
    [[ -f "$tmpPart" ]] && rm -f "$tmpPart" # If we created temp files
    [[ -f "$tmpMenu" ]] && rm -f "$tmpMenu" #  at various program stages
    [[ -f "$tmpInf1" ]] && rm -f "$tmpInf1" #  then remove them before
    [[ -f "$tmpInf2" ]] && rm -f "$tmpInf2" #  exiting.
    [[ -f "$tmpInf3" ]] && rm -f "$tmpInf3"

    if  [[  -d "$TargetMnt" ]]; then        # Did we create a clone mount?
        umount "$TargetMnt" -l              # Unmount the clone
        rm  -d "$TargetMnt"                 # Remove clone directory
    fi
}

#
# Function GetUUID () gets UUIDs of source and clone target partitions in menu.
#

GetUUID () {

    SrchLine="$1"                           # menu line passed to function
    UUID_col=0                              # start column of UUID in line
    lsblk -o NAME,UUID > "$tmpPart"         # Get list of UUID's

    while read -r UUID_Line; do             # Read through UUID list

        # Establish UUID position on line
        if [[ $UUID_col == 0 ]] ; then      # First time will be heading
            UUID_col="${UUID_Line%%UUID*}"  # Establish column number
            UUID_col="${#UUID_col}"         #  where UUID appears on line
            NameLen=$(( UUID_col - 1 ))     # Max length of partition name
            continue                        # Skip to read next line
        fi

        # Check if Passed line name (/dev/sda1, /nvme01np8, etc.) matches.
        if [[ "${UUID_Line:0:$NameLen}" == "${SrchLine:0:$NameLen}" ]] ; then
            FoundUUID="${UUID_Line:UUID_col:999}"
            break                           # exit function
        fi

    done < "$tmpPart"                       # Read next line & loop back
}

#
# Function DistInfo () builds information about source & target partitions
#

DistInfo () {

    Mount="$1"                              # Mount name is '/' or $TargetMnt
    FileName="$2"                           # "$tmpInf1" or "$tmpInf2" work file
    cat "$Mount"/etc/lsb-release >> "$FileName"
    sed -i 's/DISTRIB_//g' "$FileName"      # Remove DISTRIB_ prefix.
    sed -i 's/=/:=/g' "$FileName"           # Change "=" to ":="
    sed -i 's/"//g' "$FileName"             # Remove " around "Ubuntu 16.04...".

    # Align columns from "Xxxx:=Yyyy" to "Xxxx:      Yyyy"
    cat "$FileName" | column -t -s '=' > "$tmpInf3"
    cat "$tmpInf3" > "$FileName"
}

#
# Mainline
#

lsblk -o NAME,FSTYPE,LABEL,SIZE,MOUNTPOINT > "$tmpMenu"

i=0
SPACES='                                                                     '
DoHeading=true
AllPartsArr=()      # All partitions.

# Build whiptail menu tags ($i) and text ($Line) into array

while read -r Line; do
    if [[ $DoHeading == true ]] ; then
        DoHeading=false                     # First line is the heading.
        MenuText="$Line"                    # Heading for whiptail.
        FSTYPE_col="${Line%%FSTYPE*}"
        FSTYPE_col="${#FSTYPE_col}"         # Required to ensure `ext4`.
        MOUNTPOINT_col="${Line%%MOUNTPOINT*}"
        MOUNTPOINT_col="${#MOUNTPOINT_col}" # Required to ensure not mounted.
        continue
    fi

    Line="$Line$SPACES"                     # Pad extra white space.
    Line=${Line:0:74}                       # Truncate to 74 chars for menu.

    if [[ "${Line:MOUNTPOINT_col:4}" == "/   " ]] ; then
        GetUUID "$Line"
        SourceUUID=$FoundUUID
        # Build "/dev/Xxxxx" FS name from "├─Xxxxx" lsblk line
        SourceDev="${Line%% *}"
        SourceDev=/dev/"${SourceDev:2:999}"
    fi

    AllPartsArr+=($i "$Line")               # Menu array entry = Tag# + Text.
    (( i++ ))

done < "$tmpMenu"                           # Read next "lsblk" line.

#
# Display whiptail menu in while loop until no errors, or escape,
# or valid partion selection .
#

DefaultItem=0

while true ; do

    # Call whiptail in loop to paint menu and get user selection
    Choice=$(whiptail \
        --title "Use arrow, page, home & end keys. Tab toggle option" \
        --backtitle "Clone 16.04 for upgrade.  ONLY CLONES / PARTITION" \
        --ok-button "Select unmounted partition" \
        --cancel-button "Exit" \
        --notags \
        --default-item "$DefaultItem" \
        --menu "$MenuText" 24 80 16 \
        "${AllPartsArr[@]}" \
        2>&1 >/dev/tty)

    clear                                   # Clear screen.
    if [[ $Choice == "" ]]; then            # Escape or dialog "Exit".
        CleanUp
        exit 0;
     fi

    DefaultItem=$Choice                     # whiptail start option.
    ArrNdx=$(( $Choice * 2 + 1))            # Calculate array offset.
    Line="${AllPartsArr[$ArrNdx]}"          # Array entry into $Line.

    # Validation - Don't wipe out Windows or Ubuntu 16.04:
    # - Partition must be ext4 and cannot be mounted.

    if [[ "${Line:FSTYPE_col:4}" != "ext4" ]] ; then
        echo "Only 'ext4' partitions can be clone targets."
        read -p "Press <Enter> to continue"
        continue
    fi

    if [[ "${Line:MOUNTPOINT_col:4}" != "    " ]] ; then
        echo "A Mounted partition cannot be a clone target."
        read -p "Press <Enter> to continue"
        continue
    fi

    GetUUID "$Line"                         # Get UUID of target partition.
    TargetUUID=$FoundUUID

    # Build "/dev/Xxxxx" FS name from "├─Xxxxx" menu line
    TargetDev="${Line%% *}"
    TargetDev=/dev/"${TargetDev:2:999}"

    break                                   # Validated: Break menu loop.

done                                        # Loop while errors.

#
# Mount Clone Target partition
#

Release=$(lsb_release -rs)                  # Source version ie: '16.04'
TargetMnt="/mnt/clone$Release"

echo ""
echo "====================================================================="
echo "Mounting clone partition $TargetDev as $TargetMnt"
mkdir -p "$TargetMnt"                       # '-p' directory may already exist
mount -t auto -v $TargetDev "$TargetMnt" > /dev/null

# Confirm partition is empty. If not empty confirm it's Ubuntu. If not exit.
# If Ubuntu display prompt with the version it contains and get confirmation.

echo ""
echo "====================================================================="
echo "PLEASE: Carefully confirm Source (Live) and Target (Clone) partitions"

# Build source information (our current boot partition)
echo "SOURCE (BOOT /)=$SourceDev"  > "$tmpInf1"
DistInfo "/" "$tmpInf1"                     # /etc/lsb_release information
df -h --output=size,used,avail,pcent "$SourceDev" >> "$tmpInf1"

# Build target information (the partition selected for cloning to)
LineCnt=$(ls "$TargetMnt" | wc -l)
if (( LineCnt > 1 )) ; then
    # More than /Lost+Found exist so it's not an empty partition.
    if [[ -f "$TargetMnt"/etc/lsb-release ]] ; then
        echo "TARGET (CLONE)=$TargetDev" > "$tmpInf2"
        DistInfo "$TargetMnt" "$tmpInf2"    # /etc/lsb_release information
    else
        # TO-DO: might be cloning /boot or /home on separate partitions.
        #        the source partition is still `/` so can display message.
        echo "Selected partition has data which is not Ubuntu OS. Aborting."
        CleanUp                             # Remove temporary files
        exit 1
    fi
else
    echo "Target (Clone) partition appears empty" > "$tmpInf2"
    echo "/Lost+Found normal in empty partition" >> "$tmpInf2"
    echo "Head of '/Clone/' files & directories:" >> "$tmpInf2"
    ls "$TargetMnt" | head -n2 >> "$tmpInf2"
fi

# Target device free bytes
df -h --output=size,used,avail,pcent "$TargetDev" >> "$tmpInf2"

# Display source and target partitions side-by-side using bold text.
echo $(tput bold)       # Set to bold text
paste -d '|' "$tmpInf1" "$tmpInf2" | column -t -s '|'
echo $(tput sgr0)       # Reset to normal text

echo "NOTE: If you are recloning, new files in clone will be deleted,"
echo "      modified files are reset to current source content and,"
echo "      files deleted from clone are added back from source."
echo ""

read -p "Type Y (or y) to proceed. Any other key to exit: " -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]] ; then
    CleanUp             # Remove temporary files
    exit 0
fi

# Copy non-virtual directories to clone. Credit to TikTak's Ask Ubuntu answer:
# https://askubuntu.com/questions/319805/is-it-safe-to-clone-the-current-used-disk?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

SECONDS=0
echo ""
echo "====================================================================="
echo "Using rsync to clone / to $TargetDev mounted as $TargetMnt"
rsync -haxAX --stats --delete --info=progress2 --info=name0 --inplace  \
      /* "$TargetMnt"                                                   \
      --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}
# For 16GB on Samsung Pro 960: First time 98 seconds, second time 27 seconds.
rsyncTime=$SECONDS
echo ""
echo "Time to clone files: $rsyncTime Seconds"

# Change /etc/update-manager/release-upgrades prompt from never to LTS
echo ""
echo "====================================================================="
echo "Making changes in: $TargetMnt/etc/update-manager/release-upgrades"
echo "     from Prompt=: never"
echo "       to Prompt=: lts"
echo "Allows running 'do-release-upgrade -d' when rebooting clone target"
echo "Consider 'do-release-upgrade -d -f DistUpgradeViewNonInteractive' This"
echo "allows you to go to bed or go to lunch whilst upgrade runs."
echo ""
echo "* * *  When you Upgrade, TURN OFF screen locking for inactivity. * * *"
echo ""
sed -i 's/Prompt=never/Prompt=lts/' "$TargetMnt"/etc/update-manager/release-upgrades

## This section commented out to prevent surprises. You may uncomment.
## You may want to revise to include `cron.daily`, `cron.hourly`, etc.
# Move `/etc/cron.d` reboot jobs to `/etc/cron.d/hold` to prevent running
# scripts such as daily backup or Ubuntu 16.04 specific problem fixes.
#echo ""
#echo "====================================================================="
#echo "Moving '$TargetMnt/etc/cron.d' to '.../hold' to prevent running."
#echo "After booting clone, move back individual files you want to run"
#if [[ ! -d "$TargetMnt"/etc/cron.d/hold ]]; then
#    mkdir "$TargetMnt"/etc/cron.d/hold
#fi
#cp -p  "$TargetMnt"/etc/cron.d/* "$TargetMnt"/etc/cron.d/hold/
#rm -fv "$TargetMnt"/etc/cron.d/*

# Update /etc/fstab on clone partition with clone's UUID
echo ""
echo "====================================================================="
echo "Making changes in: $TargetMnt/etc/fstab"
echo "        from UUID: $SourceUUID"
echo "          to UUID: $TargetUUID"
sed -i "s/$SourceUUID/$TargetUUID/g" "$TargetMnt"/etc/fstab

# Update /boot/grub/grub.cfg on clone partition with clone's UUID
echo ""
echo "====================================================================="
echo "Making changes in: $TargetMnt/boot/grub/grub.cfg"
echo "        from UUID: $SourceUUID"
echo "          to UUID: $TargetUUID"
echo "Also change 'quiet splash' to 'nosplash' for environmental awareness"
echo "Suggest first time booting clone you make wallpaper unique"
sed -i "s/$SourceUUID/$TargetUUID/g" "$TargetMnt"/boot/grub/grub.cfg
sed -i "s/quiet splash/nosplash/g" "$TargetMnt"/boot/grub/grub.cfg

# Update grub boot menu
echo ""
echo "====================================================================="
echo "Calling 'update-grub' to create new boot menu"
update-grub

# Unmount and exit

echo ""
echo "====================================================================="
echo "Unmounting $TargetDev as $TargetMnt"

CleanUp             # Remove temporary files

exit 0

Copy and paste the bash code above to a new file called /usr/local/bin/clone-ubuntu.sh. Then make the new file executable using:
sudo chmod a+x /usr/local/bin/clone-ubuntu.sh

To call the script use:
sudo clone-ubuntu.sh

How to upgrade 16.04 LTS clone to Ubuntu 18.04 LTS
This is a "bonus" section that may interest many people.
Reboot your machine. The grub menu will contain a new menu option pointing to the cloned partition. You can also select a specific kernel version from the clone's Advanced Options menu.
One way to convert the cloned 16.04 LTS to 18.04 LTS is to run:
sudo do-release-upgrade

Note the -d flag was required prior to July 26, 2018 but is no longer necessary.
Read the 18.04 upgrade confirmation carefully.
Before proceeding ensure inactive screen locking is turned off. The upgrade process could crash if your computer goes to the lock screen due to keyboard inactivity.
Summary of 18.04 upgrade process
This section will be machine specific because different apps are installed by different users. Here is a brief summary I made based on notes and memory:

confirmation to proceed: ENTER
packages will be removed: Y
replace longind.conf: Y
Configuration file '/etc/sane.d/dll.conf', default N, take Y
'/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf' Take default N
Configuration file '/etc/pulse/default.pa' default N, take Y
Configuration file '/etc/grub.d/30_os-prober'' default N, take N
Full screen grub menu config appears. Take option: keep the local version currently installed
Configuration file '/etc/cron.d/anacron', default N, take Y to see what
An error message multiple times: /sbin/ldconfig.real: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf: No such file or directory
Non-standard: Configuration file '/etc/vnstat.conf' (display differences 1.13 vs 1.18) take Y
220 packages are going to be removed. (can take hours) enter Y
To finish the upgrade, a restart is required. Take Y

Note step 10 most people will never see. I have an old nVidia driver installation on my Ubuntu 16.04 I never got around to fully removing. It's included because you might have similar old packages never fully removed.
Grub changes boot menu to clone under UEFI
Unlike 18.04 upgrades I found the 18.04.1 upgrade changed the Grub UEFI configuration to use the clone's grub menu instead of the original grub menu as per this answer: Dual boot and the files /boot/grub/grub.cfg -- which one is used?
$ sudo cat /boot/efi/EFI/ubuntu/grub.cfg
search.fs_uuid b40b3925-70ef-447f-923e-1b05467c00e7 root
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

$ sudo grub-install
Installing for x86_64-efi platform.
Installation finished. No error reported.

Running sudo update-grub after booting the original partition isn't enough to change which grub.cfg is loaded by grub. You need to use sudo grub-install to force grub to use the original partition's configuration.
Both the original partition and clone partition can use update-grub to maintain their own /boot/grub/grub.cfg file but only one can be used during boot.
Of course if you want grub to use the Clone's grub menu do not do the above steps on the original's partition.

Edit history
Edit May 6, 2018 - Information display for an empty clone (target) partition corrected.
Edit August 26, 2018 - Use --inplace option with rsync so large files such as a 2 GB trash file are not duplicated on clone during copy process. This can lead to "out of disk space" error. Comment out /etc/cron.d overrides because users may want to keep or want a different directory altogether. Update instructions to use do-release-upgrade without -d flag because Ubuntu 18.04.1 LTS is now released.


How to make persistent changes to /etc/resolv.conf Ubuntu 18.10

I am reproducing section "1.11.2. Configure /etc/resolv.conf file" from my answer Part-I Preinstallation: How to install Oracle 18c (Enterprise Edition) on Ubuntu 18.04?

To display what network interfaces are available in the system, issue the following command:

$ ip link show

Figure-39: The WiFi network adapter wlp5s0 is active, up and running.

Network configuration file /etc/netplan/.yaml should be checked for configuration details. To display the contents of the file, issue the following command:

$ cat /etc/netplan/01-network-manager-all.yaml

Figure-40: Network Manager file 01-network-manager-all.yaml is not configured yet.

Find out whether /etc/resolv.conf is a static file or symlink by the following command:

$ ls -l /etc/resolv.conf

Figure-41: File /etc/resolv.conf is a symlink pointing to stub file 'stub-resolv.conf'.

In fact, @igor, the symlink what you removed from other post was really the link to stub file stub-resolv.conf.

After severed the symlink between /etc/resolv.conf and stub-resolv.conf which carried  the nameserver 127.0.0.53,  /etc/resolv.conf was left alone and it was you who made /etc/resolv.conf as a static file!

The fact is, @Igor, you were not really offered any solution by that act of severance.

Now, display contents of /etc/resolv.conf by the command:

$ cat /etc/resolv.conf

Figure-42: The contents of symlink '/etc/resolv.conf' having 127.0.0.53 as nameserver.

The dns shown by /etc/resolv.conf, is 127.0.0.53 but not the default nameserver configured for dhcp.

Issue the following command to find out the default dns server:

$ systemd-resolve --status wlp5s0

Figure-43: The default DNS server for WiFi network adapter is 192.168.43.1.

Display contents of /run/systemd/resolve/resolv.conf, by the command:

$ cat /run/systemd/resolve/resolv.conf

Figure-44: The contents of '/run/systemd/resolve/resolv.conf' indicating default nameserver.

From figure-44, you can observe that /run/systemd/resolve/resolv.conf is the one which really is carrying the default name server 192.168.43.1.

Issue the following command to change the symlink /etc/resolv.conf to point default dns server 192.168.43.1 instead of 127.0.0.53.

$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

$ ls -l /etc/resolv.conf

Figure-45: File /etc/resolv.conf is a symlink pointing to default nameserver.

After setting up sysmlink as shown in figure-45, you must make sure that your Wi-Fi is connected, up and running, by issuing the following command:

$ nmcli device

Figure-45-a: Wi-Fi network interface adapter 'wlp5s0' is connected, up and running.

Conclusion:

Under the circumstances, the symlink is the not only best answer you got but also a decent and acceptable solution.


Setting Read/Write/Execute Permissions in Linux

From the commandline the command is "chmod"

The Read/write/execute permissions is in the form of User/Group/Others.

If you want to remove the permissions you can issue the command:

$ chmod ugo-wrx testfile

That will take away all the permissions from the testfile.

If you want to have only the User (the owner of the file) have access you can issue:

$ chmod u+wrx testfile

After removing all the permissions now the only permissions on the file would be (w)rite, (r)ead, e(x)ecute by the owner of the file.

You could add the group full access to the file with:

$ chmod g+wrx testfile

You can also give everyone full access to the file by issuing:

$ chmod ugo+wrx testfile

Notice in the commands there is either a minus "-" or a plus "+".  The minus removes the specific permission the plus adds the permission.

You can get more details of the usage by issuing at the command prompt:

$ man chmod

You can check the permissions of the file with the "ls -l" command:

$ ls -l testfile

The argument of ls is specifying the long output.


Make sure you have these packages installed:

sudo apt install gnome-control-center gnome-online-accounts

Now open your gnome-control-center and go to Online Accounts and add your google account. After setup you can go to the File Browser and navigate to your drive location then press CTRL+L to show the URL.

Now configure timeshift to store backups at this URL by setting the "Storage Path" in the timeshift config. There may be a bit of extra work needed to "map" between the GVFS mount URLs and the local paths if timeshift doesn't support the way google drive is mounted.

See http://www.omgubuntu.co.uk/2016/08/use-google-drive-ubuntu-16-04-linux-desktops


If you haven't already, you need to configure the cluster to manage DHCP and DNS on the network that the new nodes are going to be on. You can find instructions for that here.

Once DHCP is configured, you can delete the existing node (it's easier to start with a clean slate). The simplest way to add a new node to a MAAS cluster is as follows:

In the node's BIOS, change the boot order so that it boots from the LAN first. This will allow it to PXE boot from the MAAS cluster controller.
Power the node on. You don't need to have a CD in the machine; it should boot from the network.
Once the node has booted from the network it will show up in MAAS as "declared". You can then accept the node into your MAAS and begin the commissioning process.

The full instructions for adding new nodes can be found here

As far as your second problem is concerned, I think this is down to two things:

An incorrect power type (if you don't have a specific power controller for the node then Wake-on-LAN makes sense, but if the node's not configured to Wake-on-LAN it won't work).
MAAS hasn't actually seen the node on the network yet.

If you follow the procedure above, the node should show up in MAAS automatically, without you having to add it manually.


The command

mount | awk '$3 == "'"$HOME"'"'

would give you an output line if your home is a mounpoint, with information about the type of filesystem. This should also allow to detect a truecrypt home folder.


Sorry, this is exactly what you didn't want.

You can do this using the Gnome Tweak Tool, although you'll need to do some basic math :)

So first, install the gnome-tweak-tool package, or click here install it.

Then go to the Fonts tab and change the Text scaling factor

Then a little bit of math :)


Why fonts are different on Dolphin, Skype and VLC?

It happens because those programs do not use GTK+. When someone say that a program is native it means it was develop following a set of rules of software development in a operating system.

Dolphin: Is the KDE file manager and use Qt (KDE is based on the Qt framework, so all programs made with Qt will look native on KDE) instead of GTK+ the default widget toolkit of Ubuntu and Lubuntu.

VLC: This media player also use Qt.

Skype (for Linux): This program also use Qt.

It means that those programs will never look native on Lubuntu, because they do not use GTK on its interfaces.

So, to change the font of this programs will need to use another program that is used to modify Qt interfaces.


From my experience i see this as a kernel error. I had a similar problem in which my system wasn't shutting down just getting as stuck as yours. When starting your system, choose advanced options from the GRUB menu and select a different kernel and it should boot properly.

GRUB menu:
    Here is the GRUB menu.

And you should see a kernel list here:
Select a lower version of kernel (generic) from the menu.

This should start your system properly.


Your host has multiple IP addresses, so you need to specify one IP address for the swarm advertising purposes:
sudo docker swarm init --advertise-addr <IP_address>
See this example from the docker docs:
docker swarm init --advertise-addr 192.168.99.121
Swarm initialized: current node (bvz81updecsj6wjz393c09vti) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join \
    --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \
    172.17.0.2:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

I recommend using the IP address connected to the subnetwork from which you can reach the other worker nodes.


Can't upgrade 11.04: flashplugin-nonfree: Package is in very bad, inconsistent state

Did you try sudo dpkg --configure -a. Also, you can try sudo apt-get update --fix-missing, it's a very basic answer, but it may help.


try instead

cat > "${INSTALL_DIR}/.config" << EOF
#!/usr/bin/env bash
export INSTALL_DIR="${INSTALL_DIR}"
export TARGET="${TARGET}"
export BUILD64="${BUILD64}"
export CC="${CC}"
EOF

source "${INSTALL_DIR}/.config"

you should still get variable expansion inside the heredoc, but you can get rid of messing quoting.


If you know the command for it, install dconf-tools , then open dconf-editor (alt+f2 dconf-editor) add an exception to the whitelist. You can also replace the whitelist with "all" to allow all applications.

You need to run alt+f2 unity --replace afterwords.


A QT account is not required, all a QT account does is determine to install the commercial version of QT or the open source. More information is available at the QT.io blog.

But long story short you are not required to have a QT account.


Get the path of a file using locate command, but not working for some files

Probably the file is recently created and you need to manually update the locate's command database. You could do that by the command:
sudo updatedb

This command will update the database file /var/lib/mlocate/mlocate.db. Usually Ubuntu updates that file automatically few times in a day.


Reverting to open-source Radeon driver shows low resolution graphics

The following seem to have done the trick. It seems like some packages were not included in the uninstall in the above link I provided.

sudo apt-get remove --purge fglrx fglrx-amdcccle fglrx-updates fglrx-amdcccle-updates


Neither the most "juju"an way, nor the most elegant, but you can try reseting the admin password from command line. Check out this link:

https://stackoverflow.com/questions/16768272/openstack-change-admin-password-for-the-dashboard

It says this:

$ export OS_SERVICE_TOKEN=$servicetoken(/etc/keystone/keystone.conf)
$ export OS_SERVICE_ENDPOINT=$http://ipoftheserver/v2.0 then use this syntax

  to change the password

$ keystone user-password-update --pass <password> <user id>

For the newer versions of OpenStack, use the "openstack" command instead of "keystone".

Alternatively, you can also set the admin_token on the keystone.conf.


I think the standard procedures here would be

A) Disable root ssh

and

B) Disable password authentication - use public key instead

To disable root ssh login, in /etc/ssh/sshd_config set
    PermitRootLogin no

There are plenty of tutorials that'll walk you through setting up public key authentication for ssh but it boils down to:

Create a public/private key pair on your client machine with ssh-keygen
Copy the public key to the server with ssh-copy-id
In /etch/ssh/sshd_config (on your server) set PubkeyAuthentication yes
Log in using the public key to verify it worked (if not check file permissions for /.ssh/ and /.ssh/authorized_keys, they usually give me trouble)
In /etc/ssh/sshd_config set PasswordAuthentication no


The invoke-rc.d command is for sysv init scripts (as its manpage says), not Upstart or systemd. Nginx still has a sysv init script (look for init.d in the filelist), which is probably why invoke-rc.d works for it (or seems to, anyway).

Even though the Debian guides use invoke-rc.d, on Ubuntu, prefer using the service command. It is a wrapper script that can handle sysv init, Upstart and systemd files.

The systemd documentation recommends using service too:

  If your distribution removes SysV init scripts in favor of systemd
  unit files typing /etc/init.d/foobar start to start a service will
  not work, since the script will not be available. Use the more correct
  /sbin/service foobar start instead, and your command will be
  forwarded to systemd. Note that invoking the init script directly has
  always been suboptimal since too much of the caller's execution
  context (environment block, umask, resource limits, audit trails, ...)
  ended up being inherited by the service, and invocation via
  /sbin/service used to clean this up at least partially. Invocation
  via /sbin/service works on both SysV and systemd systems. Also, LSB
  only standardizes invocation via /sbin/service anyway. (Note that
  some distributions ship both systemd unit files and SysV scripts for
  the services. For these invoking the init scripts will work as
  expected and the request be forwarded to systemd in any case.)

Of course, for Ubuntu, service is located at /usr/sbin/service.


How to make a full Ubuntu install with a LiveCD-like bootloader?

The problem was with the files on the UEFI partition. This answer did it for me: https://askubuntu.com/a/740482/11397

Horay!


Boot Repair Disk not running; No internet access

Try preparing a USB flash drive or CD-R with my rEFInd boot manager. When you boot with that disk, you should get the rEFInd menu, which should enable you to boot either Windows or Linux. If this works, do the following:

Boot to Linux using rEFInd.
Open a Terminal window.
In the Terminal, type sudo mkdir -p /boot/efi
In the Terminal, type sudo parted /dev/sda print.
Examine the output from parted to identify your EFI System Partition (ESP): It should have a FAT filesystem and the word "boot" under the "Flags" column. It's usually the first or second partition.
Mount the ESP to /boot/efi by typing sudo mount /dev/sda1 /boot/efi, changing /dev/sda1 to some other partition, if necessary.
Download the Debian-package version of rEFInd.
Install the Debian-package version of rEFInd by typing sudo dpkg -i refind_0.7.5-1_amd64.deb, changing the path to the file if necessary. (If somebody reads this in the future, the version number may be different, too.)
Reboot and enter your firmware setup utility. This is usually done by hitting Del or a function key as the computer powers up, but details depend on the computer.
Locate the option to support BIOS-mode (aka CSM or legacy) booting and disable it. Alternatively, there may be a boot order option that will enable you to set rEFInd to boot before the computer tries any sort of BIOS/CSM/legacy-mode boot. Unfortunately, options in firmware setup utilities vary greatly from one computer to another, so it's hard to be specific about what you should do. If you can't find anything relevant, just reboot normally and hope for the best.

With any luck, this procedure will get rEFInd working as your primary boot manager; it should boot Windows or Linux.

If you can't get rEFInd to boot or if you have problems with the procedure, please run the Boot Info Script. This will generate a file called RESULTS.txt. Post it to a pastebin site and post the URL that it provides you here. This will give us more information about your setup, which is necessary to give you more customized advice.


Milo83! I also have this problem and the code below worked for me.

#!/bin/bash

#make sure you have git. if you don't, run: sudo apt-get install git

#copy and paste this code into a .sh file. e.g. vmwareFix.sh

#run: chmod 744 <filename.sh, e.g. vmwareFix.sh>

#then run this file: /path/to/this/script

VMWARE_VERSION=workstation-15.0.4

TMP_FOLDER=/tmp/patch-vmware

rm -fdr $TMP_FOLDER

mkdir -p $TMP_FOLDER

cd $TMP_FOLDER

git clone https://github.com/mkubecek/vmware-host-modules.git

cd $TMP_FOLDER/vmware-host-modules

git checkout $VMWARE_VERSION

git fetch

make

sudo make install

sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1

sudo ln -s /lib/x86_64-linux-gnu/libz.so.1

/usr/lib/vmware/lib/libz.so.1/libz.so.1

sudo /etc/init.d/vmware restart

The instructions are in the comments above. Bye.


Unable to use sudo command (Ubuntu 16.04.1 LTS)

Run pkexec chmod 755 /etc to fix this.
As steeldriver suggested, this error is because /etc has the wrong permissions. The permissions shown from ls -ld /etc should look like:
drwxr-xr-x

But yours look like:
drw-rw-r-x

This is preventing sudo from traversing /etc to access /etc/sudoers.
The "permission denied" error message just trying to retrieve metadata on (i.e., to stat) a file nearly always means the file is missing or directories leading to it cannot be traversed, and when you ran ls on the file, it was shown to exist.
I have tested this (on a virtual machine) by breaking permissions on /etc with chmod ug-x, and was able to produce your exact error message. (You shouldn't run chmod with ug-x on it -- that's how I deliberately broke the permissions, not how to fix them.)
To fix the permissions on /etc, give the user and group owners executable permissions. The absence of those permissions is the cause of this problem. In addition, by default /etc doesn't need the group owner to be given write permissions, so unless you know you want this, I recommend changing that back too.
This command will reset /etc to the default permissions:
pkexec chmod 755 /etc

That should work for you since you were able to run other commands as root with pkexec. Other users who find this by searching will usually be able to fix it the same way, but for systems without pkexec (or where pkexec will not work) it may be necessary to boot into recovery mode or from a live CD/DVD/USB to fix the permissions. You shouldn't need to do that, though. Just run that one simple command, and sudo should work again.


Xfreerdp Upgrade to version 1.1 to support Multi Monitor

FreeRDP has been above version 1.1 since Vivid - so the easiest way to get a compatible version is now to just install a recent version of Ubuntu. That said, Windows still imposes restrictions on which editions support multi monitor on the server.

There are no versions of Windows that support multimon on a Home edition server (the computer you're connecting to).

Windows 7 only supports it on Ultimate and Enterprise editions and not Pro.

Windows 8 and 10 support it on Pro and Enterprise editions (and there is no Ultimate edition).

Old answer preserved below.

The easiest means of getting a version of FreeRDP that supports multimon seems to be via this PPA :

https://launchpad.net/~9v-shaun-42/+archive/freerdp

(the usual warnings about using a PPA for software apply).

That said... I tried this and still no joy. Why?

I'm running Windows 7 Professional on the server machine I want to use. Which doesn't support multimon as a server, just as a client. So FreeRDP enters span mode anyway, which is not what I need because my monitors have different vertical resolutions.

This is by design, apparently. Multimon RDP service is only supported by Windows 7 Ultimate or Enterprise, even if the RDP client on other editions supports using it.  [1]

I can't imagine the number of hours of productivity that have been lost by people trying to get this to work and finally discovering it's not supported on their edition of Windows.....

[1] http://social.technet.microsoft.com/Forums/windows/en-US/75f72cb1-fa8b-46bd-ad95-8a8d22042db0/multimonitor-on-windows-7-professional-running-rdp?forum=w7itproperf


Go to the Software Center (eg. hit the Windows key, type in "Software Center" in the Dash, and click on the icon labelled "Software Center").
Click in the search bar in the Software Center and type "unity8 desktop"
Click on the search result labeled "Unity8 desktop session for Mir" and select "Install"
When it's finished installing, log out and then select "Unity 8" as your session from the LightDM prompt.
Log in to your Unity 8 desktop.  Enjoy.

Mir will not work with proprietary video drivers, so be forewarned.


Make a HDD partition work like USB bootable in Ubuntu

Boot ISO from Grub

Place the Ubuntu ISO at the root of the sda3.

Modify /boot/grub/grub.cfg on sda1 as shown:

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry "Ubuntu-18.04 64-bit ISO" {
    set root=(hd0,3)
    set isofile="/ubuntu-18.04-desktop-amd64.iso"
        loopback loop $isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile splash --
        initrd (loop)/casper/initrd.lz
}
### END /etc/grub.d/40_custom ###

If you want persistence:

Add the word "persistent" to the menuentry:

linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile splash persistent --

Either create an ext4 partition labeled casper-rw.

Or create a casper-rw file and place it next to the ISO:

sudo dd if=/dev/zero of=casper-rw bs=1M count=512
sudo mkfs.ext3 -L casper-rw -F casper-rw

(where count=512 is persistence size, with max 4GB).


"Unable to stop drive - timeout was reached" message long after safely removing USB drives

Same problem here. All 18.04s & derivatives come up with this message, with my Toshiba external HD. However if I use the gnome-disk-utility to unmount & power down all is well.


passwd: permission denied error when trying to update a user's password

Sol:

vi /etc/pam.d/common-password
password        [success=3 default=ignore]
pam_unix.so obscure sha512

=> Change it to "success=2"

Smile!


HOW TO INSTALL MAYA2012X64BIT in Ubuntu

Step 1

Download Autodesk Maya 2012 Hotfix 4 from here.

Step 2

We have to install required packages. Open Terminal and paste these codes:

sudo apt-get install csh tcsh libglw1-mesa libglw1-mesa-dev mesa-utils libaudiofile-dev libaudiofile0 libaudiofile0-dbg elfutils gamin libxp6 libxpm4 libxt6 libxp6 libxmu6 libxau6 libxinerama1 libxprintapputil1 libxprintutil1 xfs xfstt ttf-liberation ttf-mscorefonts-installer xfonts-100dpi xfonts-75dpi alien

Step 3

Copy the downloaded tar file (autodesk_maya_2012_english_linux_64bit_hf4.tgz) in  /home/Username/Maya2012_setup

Step 4

Go to terminal and type:

cd /home/username/maya2012_setup

Step 5

tar -zxvf utodesk_maya_2012_english_linux_64bit_hf4.tgz

Step 6

For i in *.rpm; do sudo alien -cv $i; done

Step 7

sudo dpkg -i adlmapps4_4.0.35-1_amd64.deb
sudo dpkg -i adlmflexnetserver_4.0.35-1_amd64.deb
sudo dpkg -i adlmflexnetclient_4.0.35-1_amd64.deb
sudo dpkg -i maya2012-0-64_2012.0-327_amd64.deb

Step 8

Create a temporary folder for Maya:

sudo mkdir /usr/tmp
sudo chmod 777 /usr/tmp

Step 9

$ sudo sh -c “echo ‘setenv LC_ALL en_US.UTF-8′ >> /usr/autodesk/maya2012-x64/bin/maya2012″

Step 10

$ /usr/autodesk/maya2012-x64/bin/licensechooser /usr/autodesk/maya2012-x64/ standalone unlimited

Step 11

Export a couple of variables

sudo -i
export MAYA_LOCATION=/usr/autodesk/maya2012-x64
export LD_LIBRARY_PATH=/opt/Autodesk/Adlm/R4/lib64/

Step 12

Pass the serial number and the product key to Maya

/usr/autodesk/maya2012-x64/bin/adlmreg -i S 657D1 657D1 2012.0.0.F serial_number /var/opt/Autodesk/Adlm/Maya2012/MayaConfig.pit

Step 13

Navigate to our Maya2012_setup folder

cd /home/Username/Maya2012_setup

Step 14

Create a file named mayaInstall.c in Maya2012_setup. Open it with your text editor and paste this line:

int main (void) {return 0;}

Save and compile it with this command:

gcc mayainstall.c

Now you should have a file called a.out. Backup your /usr/bin/rpm with this command:

sudo mv /usr/bin/rpm /usr/bin/rpm_backup

and replace rpm with a.out:

sudo cp a.out /usr/bin/rpm

Step 15

Type following command:

./setup

This will start setup, deselect DMM, backburner and go next

Use these serial:

serial      :666-42943644
product key :657D1

Step 16

cd /usr/autodesk/maya2012-x64/lib/
ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.4.3.4 /usr/lib/libtiff.so.3
ln -s /usr/lib/x86_64-linux-gnu/libssl.so.0.9.8 /usr/lib/libssl.so.6

Step 17

Open /usr/autodesk/maya2012-x64/bin/maya2012 with a text editor and add the command

setenv LC_ALL C

After this line

setenv LIBQUICKTIME_PLUGIN_DIR "$MAYA_LOCATION/lib"

Step 18

Go to terminal and type:

maya

Enjoy Maya and make cool effects and Animations.


16.04, cinnamon, logging in to background only

The GPU was jostled during transit to the new floor. So I reseated the GPU. Now the desktop environment loads.
I now need to reset my theme settings, re-add icons to the tray, etc.


Joining MP3's via commandline with background track

You should be able to do this with sox, a cli audio manipulation tool. For example to concat two files, and mix in a third, then play it:

sudo apt-get install sox libsox-fmt-all
sox Audio1.mp3 Audio2.mp3 out1.mp3
sox -m out1.mp3 BackgroundMusic.mp3 out2.mp3
play out2.mp3


If you want to reinstall ubuntu only to change the partition size, you don't need to do that. You can use GParted (System - Administration) to resize the partitions, reducing Windows D partition and increasing Ubuntu's partition without reinstalling.

To install gparted:

sudo apt-get install gparted

If you need to reinstall for another reason, you can also use gparted to resize the partitions before reinstalling ubuntu with the live CD. I think it is safer than to do it with the installation program as you can control better what you are doing.

EDIT after question edit:
I think you can get the same result with the installer and with gparted alone but I feel you have more options and control using gparted before than within the installer.


Migrated from FreeNAS. How do I convert my ZFS Zpool into Linux Raid 5 equivalent

I installed WEbmin for ease, and noticed that the volume isn't showing in the raid section. I can see the individual disks on the partitons sections, but nowhere else.

Because ZFS is not using DM-Raid to manage redundancy.

It's still redundant. Nothing has changed with the file system; you simply mounted it on a different system.

You cannot convert it. You can delete what you have, and set up a new file system, either using btrfs to manage redundancy, or dm-raid. But I see no reason to do so; zfs is supported.

But you cannot use the dm-raid tools, which is what webmin shows in the raid section, to manage redundancy on zfs. You have to use zfs-tools.


Any way to remove Totem but still have video thumbnails in Nautilus?

It's not actually uninstalling it but if you do sudo cp /usr/share/applications/totem.desktop ~/.local/share/applications/totem.desktop and then gedit ~/.local/share/applications/totem.desktop and add a new line Hidden=true the desktop will completely forget totem exists. It will no longer be used for file associations and will not show up in the menus but the thumbnailer should continue to function.


'software-properties-gtk' does not work in Xubuntu 14.04

One way to fix your system would be to replace all packages from that PPA with the official packages. It can be done this way:

sudo apt-get install ppa-purge
sudo ppa-purge ppa:anton+/photo-video-apps

That would also disable the PPA from /etc/apt/sources.list.d.


Go to System Settings > Brightness & Lock. There you can tick "Require my password when waking up from suspend".


Netplan on VPS with 5 NICs doesn't work simultaneously

precursor to a final .yaml file...

replace all of your .yaml files with this...

I have two examples for you...

Example #1

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: yes
    enp2s0:
      addresses: [51.38.110.9/32]
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      routes:
        - to: 145.239.244.1/32 # this might be wrong
          via: 51.38.110.9 # this might be wrong
          scope: link
      optional: true
    enp3s0:
      addresses: [51.38.110.8/32]
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      routes:
        - to: 145.239.244.1/32 # this might be wrong
          via: 51.38.110.8 # this might be wrong
          scope: link
      optional: true
    enp4s0:
      addresses: [51.38.110.7/32]
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      routes:
        - to: 145.239.244.1/32 # this might be wrong
          via: 51.38.110.7 # this might be wrong
          scope: link
      optional: true
    enp5s0:
      dhcp4: no
      dhcp6: no

Example #2

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: yes
    enp2s0:
      addresses: [51.38.110.9/32]
      gateway4: 145.239.244.1 # don't use together with routes:
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      optional: true
    enp3s0:
      addresses: [51.38.110.8/32]
      gateway4: 145.239.244.1 # don't use together with routes:
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      optional: true
    enp4s0:
      addresses: [51.38.110.7/32]
      gateway4: 145.239.244.1 # don't use together with routes:
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      optional: true
    enp5s0:
      dhcp4: no
      dhcp6: no

sudo netplan --debug generate # generate config files

sudo netplan apply # apply configuration

reboot # reboot the computer


The locales in Ubuntu are provided by glibc, so you'd propose the new locale to be included there. Example bug report:

https://sourceware.org/bugzilla/show_bug.cgi?id=23208


Viewing and editing system files composed of unreadable text and symbols

All files that live on filesystem or memory are technically editable just gotta use the right methods. You encountered a binary data file, particularly pertaining to dconf database of settings judging by the name in the nano's filename line, and the keyword GVariant in the file itself. Accordingly, you should use dconf-editor GUI tool or dconf command-line tool.

  How do I figure out what type of file it really is, if it's a running file and what I need to find out both its code and what the file imports/exports/is dependent on.

Typically you can make use of file command to figure out the particular file type.

$ file /etc/passwd
/etc/passwd: ASCII text

Whether the file is executable, you can use ls -l filename or stat to determine whether the executable bit is set for owner, group, and other users. See a related post that explains permissions on files quite well. There's also  Access Control Lists, which are used to create more fancy permissions than the basic Unix permissions allow.

As to what software to use, it depends on each file, and there's many types of software for same filetype. Binary files in general often can be viewed via hexdump or od commands in hex format, and to edit - there's hex editors, which are often used in reverse engineering and security applications.

  I was under the impression that basically all files in a Unix system are editable, at the very least viewable.

Well, there's a bit of truth that has to be shed on the words "Everything is a file in Unix/Linux". There's files that can live in filesystem, and that's what most people know as files. In reality, a file ( i.e. a particular chunk of data organized together somewhere) can live in memory or filesystem, i.e. there can be anonymous files.  Sockets  and unnamed pipes are files, they just don't have a name, only a handle which kernel keeps track of.  Can all of them be edited ? Yes, again, with the right methods. Pipes have one process writing to it, while another reads, so writer can edit the pipe. Files mapped in memory can be edited if your program can access that particular memory chunk.  So everything is a file, you just need to understand in which context the file is applied.


To make the script run at both shutdown and restart symbolic links must be created in both /etc/rc0.d and /etc/rc6.d. The link file should be the same name as the script but with S10 prepended to the script name so that it will run early. I used "touch" to create a file just before the hwclock command and just after. It appears to work but I don't understand all the options available in the INIT section of the script. –


Can I run alsa and pulse side by side ? I think there is some problem with the alsa ! My ubuntu login sound and alert sound are not working?

If Ubuntu login sound and alert sound are not working then here's how to fix it:

Download dconf-editor if you haven't already. Then click in this order org -> gnome -> desktop -> sound. Once in sound, click on theme-name. The default value is freedesktop. Change it to ubuntu (lowercase!) and exit. Log out and log back in to hear the glorious drums!!


You have a mismatch between the landscape root-url in the "LDS Settings" page and what you are actually using in your browser to access it.

Either change the way you access landscape in your browser (have it match what is in root-url currently), or change the root-url value. If the latter, you have to restart the landscape services after the change with "sudo lsctl restart" on the landscape machine(s).


After upgrade to 19.10 screen lock pops up 5-10 minutes after I log in

I discovered in the 19.10 change notes that xfce-screensaver had "replaced" light-locker. But light-locker was still running on my system. I uninstalled it and killed the running process. That has fixed things.


That's a neat idea but this certainly isn't the platform to share it.

You might be able start a discussion thread on the Ubuntu Forums in the 'Other Discussions and Support' or other relevant section. Ubuntu Forums

If you have some technical skills, you could probably even mockup a wireframe/illustration of how this feature might look like or try and make a gnome extention that would allow you to add this feature to any file manager. It's an idea certainly worth investigating and you could do some basic dirty coding to make a simple prototype for the same even if I you can't build the actual feature completely. Put it out in the forums and see what other folks have to say about it :)


Ubuntu wakes up immediately after suspend when USB mouse is connected

I was having a similar issue to this one. Apparently, there's a known bug where the bluetooth service is causing Ubuntu to wake up immediately upon suspending https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1774994

This was the first link I found when I was googling an answer, which is why I'm posting this solution here.

The solution is basically to have a script ran before and after suspending to start and stop the bluetooth service.

#!/bin/bash
# Makes sure bluetooth service is not running while suspended.

if [ "${1}" == "pre" ]; then
    service bluetooth stop
elif [ "${1}" == "post" ]; then
    service bluetooth start
fi

Save this script as bluetooth-suspend under /lib/systemd/system-sleep and make sure the script can be executed with chmod +x bluetooth-suspend.

That seemed to fix the issue for me.


ssh deals with the log in credentials and the public key for providing access.

the public key is saved in ~/.ssh/known_hosts file on local machine.

@Nani, what you are getting on the prompt is "you are being asked to save the public key on your local machine."

You need to answer yes, so that the key is saved and it will not ask you again. (Unless the public key of remote machine is changed.)

If public key of the remote machine is changed, you have to remove the previously saved key from the ~/.ssh/known_hosts


Update of /lib/firmware/iwlwifi-8000C-34.ucode by simple copy is not working

Please click the Download button here: https://github.com/LibreELEC/iwlwifi-firmware/blob/master/firmware/iwlwifi-8000C-34.ucode

By default, downloads automagically go to the folder Downloads. From the terminal, verify this:

cd ~/Downloads
ls | grep 8000C

Copy it to /lib/firmware:

sudo cp iwlwifi-8000C-34.ucode /lib/firmware

Verify that it is there:

ls /lib/firmware | grep 8000C

In my case, I now see:

iwlwifi-8000C-13.ucode
iwlwifi-8000C-16.ucode
iwlwifi-8000C-21.ucode
iwlwifi-8000C-22.ucode
iwlwifi-8000C-23.ucode
iwlwifi-8000C-24.ucode
iwlwifi-8000C-27.ucode
iwlwifi-8000C-31.ucode
iwlwifi-8000C-34.ucode

Reboot and tell us what firmware loaded:

dmesg | grep iwl

And if it solves your issue.


VLC not displaying video properly in FullScreen?

In Tools > Preferences > Video > Output change to "OpenGL GLX video output(XCB)", save and restart vlc:

If you use Intel GPU, following setting speeds up decoding.
In Tools > Preferences > Input/Codecs > Hardware-accelerated decoding chant to "VA-API video decoder via X11":


I assume you would like to disable mouse acceleration automatically and not running mate-control-center every time. The command to control mouse acceleration is

xset m <acceleration> <threshold>

I guess

xset m 0 0

would disable acceleration completely. You can experiment with parameters until you find the setting you like. When you are satisfied with the settings you can start the program with your settings (How do I start applications automatically on login?).

This is copy from xset manual for the mouse parameters explaining the parameters:

The m option controls the mouse parameters; it may be abbreviated to 'm'. The parameters for the mouse are 'acceleration' and 'threshold'. The acceleration can be specified as an integer, or as a simple fraction. The mouse, or whatever pointer the machine is connected to, will go 'acceleration' times as fast when it travels more than 'threshold' pixels in a short time. This way, the mouse can be used for precise alignment when it is moved slowly, yet it can be set to travel across the screen in a flick of the wrist when desired. One or both parameters for the m option can be omitted, but if only one is given, it will be interpreted as the acceleration. If no parameters or the flag 'default' is used, the system defaults will be set.

If the 'threshold' parameter is provided and 0, the 'acceleration' parameter will be used in the exponent of a more natural and continuous formula, giving precise control for slow motion but big reach for fast motion, and a progressive transition for motions in between. Recommended 'acceleration' value in this case is 3/2 to 2, but not limited to that range.

If you will not be able to get the proper xset settings, I have found also that disabling acceleration with xset is not a proper to do any more. It says on https://wiki.archlinux.org/index.php/Mouse_acceleration#Disabling_mouse_acceleration:

Disabling mouse acceleration

Mouse acceleration has changed dramatically in recent X server versions; using xset to disable acceleration doesn't work as it used to and is not recommended anymore.

Recent changes on PointerAcceleration can be read here.

To completely disable any sort of acceleration/deceleration, create the following file:

/etc/X11/xorg.conf.d/50-mouse-acceleration.conf

Section "InputClass"
    Identifier "My Mouse"
    MatchIsPointer "yes"
    Option "AccelerationProfile" "-1"
    Option "AccelerationScheme" "none"
    Option "AccelSpeed" "-1"
EndSection

and restart X.

Since libinput1.1.0-1 and xf86-input-libinput0.15.0-1 you can use a flat acceleration profile which will give a 1:1 mapping of physical to virtual mouse movements. To enable it put this in the following file:

/etc/X11/xorg.conf.d/50-mouse-acceleration.conf

Section "InputClass"
    Identifier "My Mouse"
    Driver "libinput"
    MatchIsPointer "yes"
    Option "AccelProfile" "flat"
EndSection

and restart X.


No sound with HTML5 video player under firefox or chromium with Ubuntu Gnome 15.04

I found the solution!

It was not related to chromium or firefox, it was a configuration setting. In pulseaudio, sound stream from this 2 applications were configured to go to HDMI audio output, instead of built-in speakers.

As you can not change this setting for each application in the default "sound" application, I had to install pavucontrol and then I could redirect the streams correctly.

sudo apt-get install pavucontrol


ulimit -c unlimited only effects your current shell.

You can confirm this by looking at output cat /proc/$(pidof -s apache2).

I added ulimit -c unlimited to /etc/default/apache2 and now cat /proc/$(pidof -s apache2)/limits includes

Max core file size        unlimited            unlimited            bytes


GNOME auto arrange 2 windows horizontally?

gTile should do the trick.

Check out https://superuser.com/questions/1120700/how-to-snap-a-window-to-the-top-bottom-with-gnome
Here is the extension page: https://extensions.gnome.org/extension/28/gtile/


How to use Ubuntu in full screen mode on virtualbox?

In virtualbox [Host Key]  + F works for fullscreening.

By default your Host key will be Right Ctrl in VirtualBox.
You can also change your host key,to change your host key open virtualbox and then goto File menu and choose preferences.
In preferences choose input,you can see your host key there.

You can change it if you need.
Also you have to install Guest Additions to enable full screen mode.

Installing Guest Additions for full screen

Go to Devices and choose Install Guest additions on the top of your virtualization window.

Open the Guest Additions folder which should be on your Desktop in Ubuntu or in Places menu, and open Autorun.sh in terminal by double clicking on the autorun.sh file and picking run in Terminal from the pop-up window button options.Type in your password and wait a few minutes to install guest editions.

After installing Guest additions restart your virtual machine(ubuntu).

Now you will have better performance and bigger display resolutions.


Error, even with sudo: "dd: failed to open ‘/dev/sda1’: Permission denied" (dd input piped from gzip)

You are missing sudo in the other side of the pipeline:

sudo gzip -dc sda1.image.gz | sudo dd of=/dev/sda1

In a <command> | <command> | [...] command format, each command of the pipeline which requires sudo should be run using sudo, not only the first one.

In this case you might not need to use sudo on gzip -dc sda1.image.gz, unless you don't have read permission on the file:

gzip -dc sda1.image.gz | sudo dd of=/dev/sda1

In general, if all the commands to be run in a pipeline require sudo, one way around having to write sudo in each command is to run the whole command in a subshell invoked using sudo:

sudo bash -c '<command> | <command> | [...]'


How to install Monodevelop in 20.04 and get it to build something?

I managed to fix this on Ubuntu 20.04.

First, add mono-project's repo for 18.04 by following the official instructions, pasted here for convenience:

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

Then install mono-roslyn using:

sudo apt install mono-roslyn

Rebuild your project.


This worked for me:
sudo apt-get remove timidity
sudo reboot


Contents of my ~/Desktop directory not actually displayed on the desktop

This is the same answer I gave on the Unix & Linux Stackexchange. Reposting it here, so the question doesn't show up as unanswered:

  Since the application responsible for
  drawing the desktop, is nautilus not
  gnome-panel, you might have more luck
  by looking at nautilus' settings.

  Specifically, if the gconf-key
  apps/nautilus/preferences/show_desktop
  is set to false, nautilus won't show
  any desktop icons. So if the key is
  set to false, you should change it to
  true.

  If that's not the case, you might try
  to backup and delete your nautilus
  settings same way you did with your
  gnome-panel settings.


Using apt-get install in a live environment

It writes it to the available RAM, thus when you restart your computer it will be gone... That is unless you are using a persistent USB Live Disc, Then it will put it on the flash drive, but at 2GB's you are going to fill it pretty quickly...


How do I make a keyboard shortcut open an existing window?

The basic way to run-or-raise an application, i.e., switch to it if it is running, else run it, is a one-line terminal command. It  uses wmctrl. Install it with sudo apt install wmctrl. Then enter the following command for your shortcut key:
sh -c "wmctrl -x -a Gnome-terminal || gnome-terminal"

wmctrl checks if a window with class Gnome-terminal exists. If that fail (||) the second command is executed, which is just launching a new instance of gnome-terminal. sh -c is needed to wrap it all in a single command.
You can find the window class of an open window by running xprop | grep WM_CLASS in a terminal, then clicking on the window.
You can delete the default Ctrl+Alt+t keybinding and replace it by your own custom version.
An option on steroids that I use is a script jumpapp. The GitHub page explains how to install it in Ubuntu as a .deb package, so it is registered in the package management system. The command for your shortcut key becomes as simple as:
jumpapp gnome-terminal

The added value over the basic way is that jumpapp will allow you to cycle through multiple open windows when you repeatedly hit the shortcut key, and can accomodate some specific cases. Read all about it in the excellent man page, man jumpapp.


Laptop display shutting off on hinge adjustment

This is a hardware problem

As the problem continues with LiveUSB as well as installed Ubuntu, we know that the lid switch is probably broken or there is a loose connection to the display.

Try this

Click on the battery icon on the top right corner and select Power Settings.

Change the option of When the lid is closed to Do nothing for both "On battery power"  and "When plugged in".

I don't know if this will work around the problem, but its worth a shot.

Hope this helps