Textual / speaking clock for Mate and other Ubuntu variants

Although the question was originally about Ubuntu Mate, luckily, from 15.10, indicators can be used on Mateas well. As a result, the answer below at least works for Unity and Mate and (tested) on Xubuntu.

A GUI to change settings is still to follow (working on it), but I tested the indicator below for at least 20 hrs, and (as expected) it did the job without an error.

Options

The indicator offers the following options:

Show the textual time

Show the textual "day-area" (night, morning, day, evening)

Show a.m. / p.m.

Show all of them at once (or any combination of the three)

Speak out the time every quarter of an hour (espeak required)
Optionally, the time is displayed fuzzy; rounded on five minutes, e.g.
10:43 -> quarter to eleven.

The script, the module and an icon

The solution exists of a script, a separate module and an icon, which you need to store in one and the same directory.

The icon:

Right-clck on it and save it as (exactly) indicator_icon.png

The module:

This is the module that produces the textual time and all other displayed information. Copy the code, save it as (again, exactly) tcalc.py, together with the icon above in one and the same directory.

#!/usr/bin/env python3
import time

# --- set starttime of morning, day, evening, night (whole hrs)
limits = [6, 9, 18, 21]
# ---

periods = ["night", "morning", "day", "evening", "night"]

def __fig(n):
    singles = [
        "midnight", "one", "two", "three", "four", "five", "six",
        "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen",
        "fourteen", "quarter", "sixteen", "seventeen", "eighteen", "nineteen",
        ]
    tens = ["twenty", "half"]
    if n < 20:
        return singles[n]
    else:
        if n%10 == 0:
            return tens[int((n/10)-2)]
        else:
            fst = tens[int(n/10)-2]
            lst = singles[int(str(n)[-1])]
            return fst+"-"+lst

def __fuzzy(currtime):
    minutes = round(currtime[1]/5)*5
    if minutes == 60:
        currtime[1] = 0
        currtime[0] = currtime[0] + 1
    else:
        currtime[1] = minutes
    currtime[0] = 0 if currtime[0] == 24 else currtime[0]
    return currtime

def textualtime(fuzz):
    currtime = [int(n) for n in time.strftime("%H %M %S").split()]
    currtime = __fuzzy(currtime) if fuzz == True else currtime
    speak = True if currtime[1]%15 == 0 else False
    period = periods[len([n for n in limits if currtime[0] >= n])]
    # define a.m. / p.m.
    if currtime[0] >= 12:
        daytime = "p.m."
        if currtime[0] == 12:
            if currtime[1] > 30:
                currtime[0] = currtime[0] - 12
        else:
            currtime[0] = currtime[0] - 12
    else:
        daytime = "a.m."
    # convert time to textual time
    if currtime[1] == 0:
        t = __fig(currtime[0])+" o'clock" if currtime[0] != 0 else __fig(currtime[0])
    elif currtime[1] > 30:
        t = __fig((60 - currtime[1]))+" to "+__fig(currtime[0]+1)
    else:
        t = __fig(currtime[1])+" past "+__fig(currtime[0])
    return [t, period, daytime, currtime[2], speak]

The script:

This is the actual indicator. Copy the code, save it as moderntimes.py, together with the icon and th module above in one and the same directory.

#!/usr/bin/env python3
import os
import signal
import subprocess
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, AppIndicator3, GObject
import time
from threading import Thread
import tcalc

# --- define what to show:
# showtime = textual time, daytime = a.m./p.m. period = "night"/"morning"/day"/"evening"
# speak = speak out time every quarter, fuzzy = round time on 5 minutes
showtime = True; daytime = False; period = True; speak = True; fuzzy = True

class Indicator():
    def __init__(self):
        self.app = 'about_time'
        path = os.path.dirname(os.path.abspath(__file__))
        self.indicator = AppIndicator3.Indicator.new(
            self.app, os.path.abspath(path+"/indicator_icon.png"),
            AppIndicator3.IndicatorCategory.OTHER)
        self.indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
        self.indicator.set_menu(self.create_menu())

        self.update = Thread(target=self.get_time)
        self.update.setDaemon(True)
        self.update.start()

    def get_time(self):
        # the first loop is 0 seconds, the next loop is 60 seconds,
        # in phase with computer clock
        loop = 0; timestring1 = ""
        while True:
            time.sleep(loop)
            tdata = tcalc.textualtime(fuzzy)
            timestring2 = tdata[0]
            loop = (60 - tdata[3])+1
            mention = (" | ").join([tdata[item[1]] for item in [
                [showtime, 0], [period, 1], [daytime, 2]
                ]if item[0] == True])
            if all([
                tdata[4] == True,
                speak == True,
                timestring2 != timestring1,
                ]):
                subprocess.Popen(["espeak", '"'+timestring2+'"', "-s", "130"])
            # [4] edited
            GObject.idle_add(
                self.indicator.set_label,
                mention, self.app,
                priority=GObject.PRIORITY_DEFAULT
                )
            timestring1 = timestring2

    def create_menu(self):
        menu = Gtk.Menu()
        item_quit = Gtk.MenuItem('Quit')
        item_quit.connect('activate', self.stop)
        menu.append(item_quit)
        menu.show_all()
        return menu

    def stop(self, source):
        Gtk.main_quit()

Indicator()
GObject.threads_init()
signal.signal(signal.SIGINT, signal.SIG_DFL)
Gtk.main()

How to use

The script needs espeak:

sudo apt-get install espeak

Copy all three files above into one and the same directory, exactly named as indicated in The script, the module and an icon
In the head of the script (moderntimes.py), define which information should be displayed, and how. Simply set True or False in the line:

# --- define what to show:
# time = textual time, daytime = a.m./p.m. period = "night"/"morning"/day"/"evening"
# speak = speak out time every quarter, fuzzy = round time on 5 minutes
showtime = True; daytime = False; period = True; speak = False; fuzzy = True

In the head of the module, you can change the hours when to start subsequently  morning, day, evening, night, in the line:

# --- set starttime of morning, day, evening, night (whole hrs)
limits = [6, 9, 18, 21]
# ---

Don't touch anything else in the script for now :)
Ubuntu Mate users need to enable the use of indicators on their system: choose System > Preferences > Look and feel > Mate tweak > Interface > "Enable indicators"

Run the indicator with the command:

python3 /path/to/moderntimes.py

Running it from Startup Applications

Remember that if you run the command from Startup Applications, in many cases you need to add a little break, especially (among others) on indicators:

/bin/bash -c "sleep 15 && python3 /path/to/moderntimes.py"

Notes

No doubt the script will be changed/updated in the next few days many times. One thing I'd like feedback on in particular is the "style" in which the digital time is converted into textual time. The way it is done now:

whole hours, e.g.:

six o'clock

less then 30 mins after the hour, e.g.

twenty past eleven

30 mins after the hour e.g.:

half past five

more the 30 mins e.g.:

twenty to five

15 minutes are mentioned quarter, e.g.:

quarter past six

exception is midnight, which is not called zero, but midnight, e.g.:

quarter past midnight

The script is extremely low on juice, due to the fact that after the first timecheck- loop, the loop is synchronized on the computer clock automatically. Therefore the script checks time/edits the displayed time only once per minute, sleeping the rest of the time.

Edit

As per today (2016-4-9), a ppa of a polished version is available. To install from ppa:

sudo apt-add-repository ppa:vlijm/abouttime
sudo apt-get update
sudo apt-get install abouttime

The day periods in this version are changed, compared to the script version above, now it is:

morning 6:00-12:00
afternoon 12:00-18:00
evening 18:00-24:00
night 24:00-6:00

... and the indicator has tho option to change the icon during daytime:
morning/afternoon/evening/night:

As mentioned, this version was tested on both Mate (from the original question) Unity and Xubuntu.


What decides an ubuntu version to be LTS or non-LTS?

https://wiki.ubuntu.com/LTS

  A new LTS version is released every 2 years. In previous releases, a
  Long Term Support (LTS) version had 3 years support on Ubuntu
  (Desktop) and 5 years on Ubuntu Server. Starting with Ubuntu 12.04
  LTS, both versions will receive 5 years support. There is no extra fee
  for the LTS version; we make our very best work available to everyone
  on the same free terms. Upgrades to new versions of Ubuntu are and
  always will be free of charge.


Dual-booting Ubuntu with Refind from an external hdd on a MacBook Pro

The "no bootable device" error probably indicates that rEFInd was detecting a BIOS-mode boot loader, but that the Mac's firmware was unable to launch it. This can happen with external disks on Macs, and there's not much that rEFInd can do about it -- booting external disks, especially in BIOS mode, is just flaky on some models. There are other ways to get Linux booted, though....

Try hitting the Esc key. Sometimes an EFI is sluggish about registering some filesystems, so they don't appear when rEFInd first starts up, but hitting Esc causes a re-scan and they'll appear. If this works, you can try adding scan_delay 1 to the refind.conf file. This will slow down rEFInd's bringing up its menu, but the options should all appear.

If that fails, then check the filesystem types. You say you've got the ext4fs driver installed, so that should enable rEFInd to scan ext2, ext3, and ext4 filesystems; but if you used something else on the external disk, you'll need to install a suitable filesystem driver (if one exists).

A last-ditch fix is to create a /boot partition for your external-drive installation, but on your internal drive. This can help if the firmware in your Mac is particularly recalcitrant about booting from an external drive, even in EFI mode. A /boot partition can be quite small, so this won't chew up a lot of disk space.

Your Windows installation will be harder to get booted. It will work better with an MBR disk, but you seem to be running into BIOS-mode boot problems with that. There's a very long thread on MacRumors about booting Windows natively in EFI mode on Macs. This is possible for some models, and is easier with Windows 8 than with Windows 7. With Windows 7, it's very difficult to get working.


The results of lsusb are below and as you can see the TV-tuner is listed. Unfortunately, that is as far as it goes. The adapter is not recognised by any apps. It's just sitting there so tantalisingly close yet completely out of reach.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 002: ID 413c:a005 Dell Computer Corp. Internal 2.0 Hub

Bus 001 Device 003: ID 07ca:0837 AVerMedia Technologies, Inc. H837 Hybrid ATSC/QAM

Bus 001 Device 004: ID 0b97:7761 O2 Micro, Inc. Oz776 1.1 Hub

Bus 001 Device 005: ID 413c:8103 Dell Computer Corp. Wireless 350 Bluetooth

Bus 001 Device 006: ID 0b97:7762 O2 Micro, Inc. Oz776 SmartCard Reader


Ubuntu Server 14.04 Apache 2.4 TLSv1.2/TLSv1.1 support

Problem fixed itself by now without any configuration change. Apparently libssl in 14.04 was initially compiled without TLSv1.1/TLSv1.2 support and that has been fixed by now.


How to change menu entries in AppIndicator, when it is running?

One has to use

GLib.timeout_add(10, handler_timeout)

inside the indicator code, where 10 - is 10 milliseconds, time between refreshing, and handler_timeout - function to be called at each refresh. Inside this function one can do all the needed stuff, like checking for clipboard changes and editing the menu.


Comparing two text files and save the missing

It's not clear what "the differences" means, but here is something that meets your given inputs and output:

$ cat >1
Hello
Hi
Hola
Bonjour

$ cat >2
Hi
Bonjour

$ diff  --old-line-format=''  <(sort 1)  <(sort 2)  >new

$ cat new
Hi
Bonjour


Cannot see everything in the opened window

You can move a window without seeing its title bar:

Press Alt and start dragging with the primary mouse button (mostly the left one) at any part of the window.


Steam pops up with "out of date client" dialogue even though I used the .deb from the Steam website

The problem seems to be with the libpcre libraries in the version from Valve website, i fixed the problem by removing those libraries from the steam directory forcing steam to use the one installed on the system.

rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libpcre.so.3
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libpcre.so.3.12.1

You might have to redo this step after each update steam performs (unless they fix this).


When closing the lid of my laptop nothing happens instead of suspend)

These instructions follows this tips page:

Enable automatic shutdown, hibernate, or do nothing when laptop lid is closed.

Edit the logind.conf file

sudo gedit /etc/systemd/logind.conf

Uncomment the following line (delete the # character):

#HandleLidSwitch=suspend

to

HandleLidSwitch=suspend

Save the file and finally restart the systemd service:

sudo systemctl restart systemd-logind.service


New User - Installing Applications ie Android SDK - Where To ? ( Equivalent of Program Files ? )

The only location where your user has full control is your home folder - anywhere else on the system will be locked down by default and will require sudo. This is on purpose to make it harder to mess things up.

The best places to install the android SDK would be:

~/local/android-sdk/  - under your home folder, won't require special permissions
/usr/local/share/android-sdk/  - anywhere under /usr/local/ would be okay
/opt/android-sdk/  - fairly standard location for big standalone software like the android SDK

What I usually do is make sure my user is a member of the 'adm' group, then make sure that /usr/local and /opt are owned by that group and are set with group-write permissions, then install things there.  That will allow you to make changes inside of those without having to use sudo.

The purposes of the various directories can be found in the Linux File Hierarchy Standard:

http://www.pathname.com/fhs/pub/fhs-2.3.html


VLC does not start in Ubuntu 14.04 because of Qt error

It seems the problem is with QT. Try reinstalling it. (or installing if not yet).

sudo apt-get install libqt4-dev


Ubuntu 18.04 - Error in network definition

you need to add an space to indent routes section:

routes:
   - to: 0.0.0.0/0
     via: 10.11.0.6

not

routes:
- to: 0.0.0.0/0
via: 10.11.0.6


Duplicate events on Thunderbird Lightning

It's a bug. Please look at https://groups.google.com/forum/#!topic/provider-for-google-calendar/t0HWHX35LE0 and https://bugzilla.mozilla.org/show_bug.cgi?id=1079659.

The author of the GData plugin is actively working to correct the problem, and given the track record of the plugin, I am sure he will.

I can confirm  that removing the calendar from Thunderbird and adding it again seems to fix the problem (I am using the beta 1.0.1 from the aforementioned bug report).


Can't start MongoDB , mongod is always stop/waiting

According to this log line it is a permissions issue.

  /data/db/mongod.lock errno:13 Permission denied Is a mongod ins$
  2017-09-10T07:47:16.529+0200 [initandlisten] dbexit:

It appears that you changed the dbpath from the default /var/lib/mongodb in /etc/mongodb.conf

Fix the permissions and ownership on /data/db.  Assuming that you used a package the user:group should be mongodb:mongodb so the following commands should get it working in this custom location.

Change the permissions to mirror the package location:

sudo chmod 755 /data/db

Ensure that the directory ownership is the same as the official package:

sudo chown mongodb:mongodb /data/db


How to change the default application icons of Gnome Shell's top right area

These icons are from default placed at /usr/share/icons/IconTheme/apps/XXX/, where IconTheme is the icon theme that you are currently using (e.g. Faenza) and XXX the size of the icons.

It would be good to replace all of these icons to the ones you like. Be careful to keep backups, though, in case you are not sure that you want to do this. You can convert an image to many different sizes with the convert command of the imagemagick package:

convert 1.png -resize 100x100 2.png


How did you create the bootable USB? I've used unetbootin in the past, but it doesn't seem to work as reliably now, and I had this very problem. I've had good success using

sudo dd if=~/source.iso of=/dev/destination_usb

'if'  is input file, 'of'  is output file.


Redirect 2 commands to a file on the same line script

Write like this:

{ printf "$(date '+%H:%M') "; speedtest-cli --csv; } >> output.csv

Or like this:

echo "$(date '+%H:%M') $(speedtest-cli --csv)" >> output.csv

Your approach didn't work because the date command produces output with a newline automatically appended.

When wrapped in a $(...), the last newline is not printed.


Ubuntu keyboard backlight problem on Dell Vostro 5568, on battery works normally, on AC behaves strangely

I had the same problem on Ubuntu 17.04 on my Dell Vostro 5468. Has resolved by upgrading BIOS firmware to 1.1.1.
This can be done in a few steps:
1.Prepare USB drive via Gparted (format fat32) and Unetbootin (select freedos in the list of distros).
2. Eject the USB drive, then re-insert it so you can see the new FreeDOS file system.
3. Copy your BIOS update file to the drive.
4. Reboot, press F12 for the one-time boot menu, and boot from the USB Storage Device.
5. Choose "fdos".
6. Choose "4 - Load FreeDOS without drivers."
7. Execute the BIOS update.


Great question, I was wondering this myself.

I found that you can use the following to remove the openjdk-7-jre on Ubuntu 13.04:

sudo apt-get autoremove openjdk-7-jre

Press 'y' and then press enter when prompted to confirm this change. This should also clean up all the additional dependency libraries that were installed with it.

I also found you can use the following command to perform additional clean up:

sudo apt-get purge openjdk*

If you use the following command:

java -version

You should no longer see the openjdk-7-jre installed!

Hope this helps. :)


Finally, I was able to get to a stage where the system is no longer freezing.
First of all, I noticed that the system was freezing mainly when there were applications using the network, like Thunderbird, Chromium Firefox and the like, when clicking to access some content, but would not freezing if using applications not using it.
This prompted me to:

Check if the NetworkManager was posting any error in the logs by reviewing the journal with sudo journalctl -b. However, I could not see any error related to the network card or network configuration.
I also checked if the traffic of the network sockets was normal with ss -tan and ethtool eth0 and tcpdump -ni eth0 but I couldn't find anything strange with the output of these commands.
Therefore, I resolved to install strace with sudo apt-get install strace
Create a directory to store the strace output mkdir ./Downloads/strace
Run Chromium, Firefox or thunderbird under that tracer, for example strace -C -f -c ./firefox &>straceoutput.txt
Examined the output of the various programs with vi straceoutput.txt especially at the bottom of the file SHFT+g to see what the program was doing last, just before hanging
Noticed that the point where the programs were hanging showed access to networks services

[pid  1757] recvmsg(4, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) <0.000028> [pid  1757] poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=33, events=POLLIN}], 3, 0) = 0 (Timeout) <0.000028>
With this hint, I could only suspect that the access to the network was not working properly, therefore I disconnected the lan cable and connected to the WiFi so as to switch network access.
Changing the network access for the WiFi made the trick and allows me to work without hangs.
I can consider the issue of old PC hanging with the 18.04 SOLVED and will open a new question to understand why the NIC connection is failing.


As far as I can tell, install libopenjpeg5 libavcodec56 librtmp1 are not available for Ubuntu 14.04.

But if you want to install cums in 14.04, you have to enable universe repository first and then:

sudo apt-get update
sudo apt-get install cmus


Is the Ubuntu policy manual out of date?

When I go to the page in your link I see this at the bottom of the page

  UbuntuArchitecture (last edited 2010-06-05 19:40:17 by

So, the answer is - not so out of date as it used to be.


How to configure Gnome to use the icon from the .desktop file in the Dock?

GNOME uses the application launchers found in the ~/.local/share/applications directory. If you move your application launcher there, it should change the icon in both the applications dashboard and the dock. Desktop launcher files placed here will override desktop launchers in /usr/share/applications by the same file name for your user only.

As an example, I changed the icon for Google Chrome to the 2048 logo. It appears in both the application dashboard and dock:

 --

Contents of ~/.local/share/applications/google-chrome.desktop:

[Desktop Entry]
Version=1.0
Type=Application
Name=Google Chrome
Comment=Access the Internet
Icon=2048
Exec=/usr/bin/google-chrome-stable
Categories=Network;WebBrowser;


Ubuntu 15.04 freezing on shutdown/reset and having problem with Nvidia

Just install laptop-mode-tools to solve shutdown freeze problem:

sudo apt-get install laptop-mode-tools

If you have tlp installed on your system, you must remove it because it's conflicting with laptop-mode-tools:

sudo apt-get remove --purge tlp tlp-rdw


The below link helped me increase my font size for Skype 4.0 on Ubuntu
==> How to change font size in Skype 4.x?

Summarized content of the linked question

    Install qt4-qtconfig:

sudo apt-get install qt4-qtconfig

    run qtconfig, choose Gui Style to be Cleanlooks (for example), then save. Restart skype, and the new fonts will be applied. This does not work if the style is Desktop Settings.


Error while loading shared library libz.so.1 while cross compiling for arm-linux

I had the same problem - it is a bit confusing. The cross-compiler may be 32-bit (my case), so it is complaining about missing 32-bit library:

sudo apt-get install zlib1g:i386

Then cross-compiler should work.


You're trying to su to a user who's shell is /bin/false. /bin/false always exits with code 1, so you're never that user:

$ sudo su - dnsmasq
$ echo $?
1

If you want to start a shell with such a disabled user, use sudo:

$ sudo -u dnsmasq /bin/bash
$ whoami
dnsmasq

Note that dnsmasq usually has /sbin/nologin (a politer version of false) as the shell, so the same principle applies.


From Why is VirtualBox only showing 32 bit guest versions on my 64 bit host OS make sure that:

Intel Virtualization Technology and VT-d are both enabled in the BIOS
The Hyper-V platform is disabled in your Windows Feature list.


How can I safely allow a php based website to create a linux user and interact with the environment?

⚠ WARNING ⚠

This is an inherent security risk and has a lot of potential to go south at at any time. I'd highly advise against this setup, but oh well.
I'm not responsible for anything that happens as a result of you following anything given in this post, nor do I advise you to follow this system. This is mostly for educational/research purposes.

Linux has something known as setuid that allows any given program (like sudo) to run with privileges higher than the current executing user. You can write a shell script to do everything you need.
From there, because shell scripts can not be setuid, you need to convert this into a binary. You can use something like shc for this.
Once you have your shell pseudo-binary (example name: bootstrap_user) containing everything you need, you can do some fun alterations to get it ready. Namely, this:

Set it owned by root, and group www-data.
 chown root:www-data ./bootstrap_user

Assign RWX perms for owner (root), read and execute for group, none for anyone else:
 chmod 750 ./bootstrap_user

Move the binary to somewhere PHP can exec() it.

Finally, add the setuid bit to it, so that it's executed as root:
 chmod u+s ./bootstrap_user

In PHP, you can now call bootstrap_user as your executable, passing any required parameters. Be sure to take care to escape and sanitize input.


Upgrade from Ubuntu 10.04 to Ubuntu 16.04.1 LTS

The best thing to get a properly working operating system in this case would be to install Ubuntu 16.04 LTS right from scratch. Too many things changed in this long time frame since Ubuntu 10.04 was released. Many things may go wrong when doing an upgrade ... besides the fact that it would take much, much more time. Download Ubuntu 16.04.1 LTS and create an installation media, boot from it and select to use the whole disk from the installer, then start the installation process. This is the most easy way, in case you want to create new partitions yourself, choose 'Something else'.


Hostnames on VPN stop resolving after a period of time even though /etc/resolv.conf is correct

see this question: Looks like a problem with Networkmanager and dnsmasq.
But when i try to remove dnsmasq-base it would remove network-manager and teh desktop too. So not working here. BTW I have upgraded form 16.04 to 16.10.


I also found that audio.pulseaudio_device:auto also works. Perhaps anything explicit works, which would imply there's something wrong with the code that is supposed to set the default when there is no config file entry.


CopyAgent (Copy Cloud Storage) won't autostart at system startup (Linux/Xubuntu)

There are several ways of doing it.

In kubuntu/kde, go to directory ~/.kde4/Autostart (or more likely it is ~/.kde/Autostart) and create a symlink from /path/to/CopyAgent to ~/.kde/Autostart/CopyAgent

I do not know about Xubuntu, but regardless of whatever the desktop environment, this can be achieved too by creating a symlink from /path/to/CopyAgent to /etc/init.d/

This what works for me:

  sudo ln -s ~/bin/copy/CopyAgent /etc/init.d/CopyAgent

(you would need to modify this according to where you have your CopyAgent is installed)

After a reboot, CopyAgent is running.

Another way to do this is by editing /etc/rc.d/boot.local and put a /path/to/CopyAgent in there.


Why do I need to specify interface in /etc/default/isc-dhcp-server

Using the start up scripts, running dhcpd as a service is in my opinion the best way to run dhcpd. This means the OS handles startup, stopping and restarting as needed during upgrade of packages, and during boot and shutdown. It also means the OS can restart if dhcpd crashes.

This is the standard way of starting services/daemons in Linux, including Debian, RHEL, Ubuntu, OpenSUSE, Fedora and so on.

This does also mean that you have to inform the system which interfaces it should run dhcpd on. This is done, as you already know, with the /etc/defaults/isc-dhcpd file.

I can't see any good reason to run it directly like you've been doing. From time to time I've been running ISC DHCPD in the foreground to do debugging, but that's exceptional cases...

In short: unless you have good reasons not to, do follow the philosophy of the distribution. This also makes it easier for someone taking over. If I were taking over a debian/Ubuntu box with ISC DHCPD, I'd assume it was controlled by systemd, not homemade scripts.


As you probably figured the SATA mode is needed to be changed from RAID to AHCI, but I didn't have the option in BIOS.
The trick is that my acer laptop hides that option by default - and can be revealed by using CTRL+S in the BIOS main tab (this isn't prompted anywhere).

It is not needed to install windows, just change it to AHCI, if not possible to change press ctrl+s on the main tab in BIOS. You better disable secure boot and fast boot.
-- Acer Community Forums


Updating to latest gcc and g++ on Ubuntu 16.04

Run the following commands in sequence.  I was getting same error.  This worked for me.

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-snapshot
sudo apt-get install gcc-6 g++-6


Install all correct Drivers on UBUNTU 14.04 LTS

Unlike Windows, Linux systems generally come with all the needed drivers/modules. So it's basically plug and play: you insert something in your machine, it works.

But some companies like NVidia and AMD produce proprietary, optimized drivers. You can install them using Ubuntu's preinstalled "Additional drivers" program, search for it in the dash.

Proprietary drivers usually give more performance than their generic, open source ones, because they are made by the manufacturers themselves. But the system and your hardware should work fine without them.


Script to write at the beginning of every line of a text file the name of the file

You can use the following script,

#!/bin/bash
awk -v var="$1" '{print var" "$0 }' "$1" > /tmp/temp.txt
mv /tmp/temp.txt "$1"

Give the script execution permission, as chmod +x scriptname

Run the script as,

./scriptname test

assuming "test" is the file that you are going to modify and you are running the script from the same folder where the file "test" is located.


Type in "drivers" from the unity launcher. Open "Install Additional Drivers" from the menu. You should see two options to install latest drivers created by NVidia and tested by the Ubuntu team. This should work, but note that since it is a proprietary driver, you may have some issues.

I would recommend launching nvidia-settings from the terminal and seeing if there are any obvious settings that you can tweak to get some better performance.

If you are still having trouble, you could download the drivers straight from the NVidia site:

x86 - http://www.nvidia.com/object/linux-display-ia32-285.05.09-driver.html
x64 - http://www.nvidia.com/object/linux-display-amd64-285.05.09-driver.html

I would use installing from NVidia as a last step if you simple cannot get anything else working.

Best of luck!


Simple video editor - Rotate and cut operations for MPG clips

Suggest use OpenShot as per this step by step:

Add you clip to the track:

Then right click the video imported on the track to rotate:

Then export your video (note the picture is rotated in the preview)

Once you video has been exported create a new project and reload your newly rotated video
Use the razor tool to cut and split tracks:


1) Settings has a “Show Password” checkbox

2) Seahorse uses a end-aligned inline icon with the tooltip “Show/Hide password”


Solving $PATH obfuscation by /bin/sh (dash)

Option one is fairly simple. You just need to run:

sudo dpkg-reconfigure dash

And pick No. That'll push /bin/sh back to /bin/bash.

You could do this manually (removing the link, creating a new one) but this is the official method.


Wireless does not activate when the computer starts up. It works after the first hibernation

Please copy and paste this command:

echo "options asus_nb_wmi wapf=1" | sudo tee /etc/modprobe.d/asus_nb_wmi.conf

Reboot and wifi should work.

Here is the link with full details courtesy of varun and chili555.
http://ubuntuforums.org/showthread.php?t=2181558


Regarding "Host key verification Failed"

You can skip strict host key verification check using following command.

sshpass -p '<your_password>' ssh <your_server_ip> -o StrictHostKeyChecking=no

Note that above command will solve your problem when key is not present in /root/.ssh/known_host file, but if older key will be present than you have to remove that first by following command

ssh-keygen -R hostname


How to grep a identical word in json file format

Easiest way is to tell grep it needs to find the quotation marks too. You can avoid any escaping shenanigans by wrapping the search text in single quote marks:
aws logs describe-metric-filters --log-group-name mahi | jq '.metricFilters[].metricTransformations' | grep '"metricName"'


14.04 to 16.04 upgrade ignores NetworkManager.conf

After diligent research found the useful bit:

apt-get remove --purge dnsmasq

 resolvconf -u

 service network-manager restart

and all was as before the upgrade.


Can I use live USB to format HD and install Ubuntu with it?

Really if your computer is not booting up and the BIOS is playing sounds on the system speaker then it isn't an Ubuntu issue. It probably is a hardware based issue.


Broken grub rescue,due to corrupt Linux partition

I usually perform grub repair operations from a live CD. I am making the assumption that your HDD uses MBR structure. If you use EUFI and GPT, this will not work.

Boot into a live Ubuntu CD, select Try Ubuntu, NOT Install Ubuntu.

Open a terminal and mount your OS partition (lets assume it is /dev/sda1).

sudo mount /dev/sda1 /mnt

Install grub to the MBR of /dev/sda and tell it to use existing /dev/sda1 grub config

sudo grub2-install /dev/sda --boot-directory=/mnt/boot

You should see a message indicating grub is installed and no errors are reported.

Reboot.


Lost Ubuntu upon re-installing windows 7

If you used the built-in restore function for Windows, it goes back to a "pristine" factory original install. Back to a time before it had to share anything with anybody.

Now that you have it working again (your call), re-install Ubuntu as previously because the factory restore of Windows shows no mercy --- Ubuntu is gone.


I had this problem a while ago when one of the third party mirrors got out of sync with the main server. I just switched to a different mirror, and the issue went away. If you're having problems with the mirrors, try the main server for your region instead.

You can select a new mirror via the "Software and Updates" panel:


Can't connect to wifi with static IP on Ubuntu server

You have neglected to add DNS nameservers. I suggest you amend your /etc/network/interfaces to:

auto lo
iface lo inet loopback

auto wlo1
iface wlo1 inet static
 address 10.36.133.145
 netmask 255.255.248.0
 gateway 10.1.1.1
 wireless-essid ISU-CARDINAL
 dns-nameservers 8.8.8.8 10.1.1.1

Restart the interface:

sudo ifdown wlo1 && sudo ifup wlo1

Check:

ping -c3 10.1.1.1

If you get ping returns, you are ready to access the verification page and proceed.

I assume that all the numbers above are verified correct, possibly from other connected devices or from the college.


GNOME 3 shows a striped striped bar on top of the screen

It is known that gnome 3 does not work well with unity.
The libs for unity are not compatible with gnome 3 and the shell and vica versa.
If you must try it out here are the live cd's though only for suse or fedora
http://gnome3.org/tryit.html


Daemon for moving files between partitions?

Why don't you just point DC++ to save to another drive by default instead of constantly moving files around?

A solution similar to what you have asked for:

#!/bin/bash

srcPart="sda9"
dstDir="/media/drive/dir"

moveLargestFile(){
    largestFile="`ls -S -w1 "$1"/*.avi | head -n 1`"
    mv "$largestFile" "$dstDir"
}

your-app &
appPid=$!

while [ "`ps -A | grep $appPid`" ]; do
    usePercent=$(df -h | grep "$srcPart" | grep -o "[0-9]\{1,3\}%" | sed 's/%//')
    if [ $usePercent -gt 95 ]; then
        moveLargestFile "$HOME/Movies"
    fi
    sleep 60
done

This sript will launch your app (don't forget to specify it) in the background and will monitor the selected partition srcPart until you quit the application. If during its executing, filesystem usage goes over 95%, we'll select the largest avi file in $HOME/Movies folder and move it to the specified location.


Wifi signal weak all of a sudden, Broadcom BCM4313

So this got resolved, it was a problem with eduroam. I reported it to the university yesterday and they power cycled the access point just there and the signal returned.

The signal also boosted on my netbook also running Ubuntu 16.04 with an Intel N6320 wireless card. So I'm not sure what happened the router that didn't affect Android or Windows but did affect Ubuntu. I should have tried another Linux distribution just as a test.

I work in a university and have never experienced this with eduroam in the past but if it does happen again I'll know to check eduroam first and maybe test some other distros to see if it's a Ubuntu thing.


inox browser: build and patch chromium from source

(Note that the link to Ubuntu's instructions for building Chromium appears to be heavily outdated.)

Disclaimer: I'm the maintainer of the Chromium Beta and Dev PPAs.

If you run apt-get source chromium-browser, you'll get the source code for the current stable version of Chromium that's in the repos along with the patches that Ubuntu applies on top of Chromium (which are in the debian/patches folder). You can add additional patches to be applied to Chromium here, but note that some of the patches you add may conflict or be the same as the patches Ubuntu uses. Also, update the series file, which describes what patches to apply and in what order.

The build script is at debian/rules. It's quite long, but the most important variable you'll probably be interested in is GYP_DEFINES, which is where you would specify the build flags to build Chromium with. For example, if you wanted to build Chromium with enable_google_now=0, then add a line saying GYP_DEFINES += enable_google_now=0 (you can add it around the other lines starting with GYP_DEFINES). Note that some build flags on that page conflict with the build flags Ubuntu uses (I know enable_webrtc is set to 1 in debian/rules).

As for building it, the simplest way would probably be to run dpkg-buildpackage -b from the chromium-browser-* directory. This will apply the patches, run through the debian/rules file, and then make several deb files. If there are build dependencies missing, it should notify you of those and stop the build. You can then install those deb files.

Note that building Chromium takes about 4-5 hours on a 4-core machine and takes about 15 GB of space (with debugging symbols included). Without debugging symbols (if you comment out the line that adds the -g flag), I'd estimate that it would take about 7-8 GB of space.


Visual GUI no keyboard/mouse input possible

Nevermind, I solved it. I just reinstall the xorg-stuff, as shown here: http://www.ubuntugeek.com/ubuntu-tiphow-to-removeinstall-and-reconfigure-xorg-without-reinstalling-ubuntu.html

sudo apt-get remove --purge xserver-xorg
sudo apt-get install xserver-xorg
sudo dpkg-reconfigure xserver-xorg

Everything works fine again.


How to disable changing desktop background (wallpapers) automatically in Ubuntu 12.04?

When you right click on your desktop and select "Change My Desktop Background" (alternatively type "Appearance" in the Dash). You will see little Icons on some of the wallpaper selections.

These represent the slideshow you want to remove.  Select an alternative Wallpaper (with no icon) and this effect will be removed.  See my comments above if you want to add your own wallpaper.

For additional information the dynamic wallpaper slideshow wallpapers are driven by the contest.xml file hosted in usr/share,backgrounds


What is GRUB (2)'s role in the suspend/hibernate process?

Grub has no role in the suspend-to-RAM/resume-from-RAM-suspend process.

Grub has a role to play in the resume-from-hibernation process: it loads the kernel, which then finds a system image in the swap partition and resumes it.

If grub2 breaks hibernation with a video-related problem, while grub1 doesn't, it could be something to do with mode setting.  Either GRUB2 itself is trying to change the video mode, or it's configured to pass some kernel command-line option for changing the video mode.

If hibernation doesn't work right out of the box, that's a bug in Ubuntu, and it would be a good idea to report it (using ubuntu-bug).


New Linux/Ubuntu Missing a .ko file WiFI adapter driver rtl8822b

Another option would be to install drivers from Cilynx's GitHub repo for RTL88x2BU drivers.

As detailed in the repo, you can install the drivers using DKMS installation method:

cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo dkms build -m rtl88x2bu -v ${VER}
sudo dkms install -m rtl88x2bu -v ${VER}
sudo modprobe 88x2bu


Absolutely. An easy fix to this is to add the following argument to the command.

chromium-browser --disk-cache-size=n

say n is 500000000 this would be 500 MB

You can check to make sure it increased it by typing the following in your browser and then looking at the Max Size value.

chrome://net-internals/#httpCache


What do numbers between parentheses in bash man pages mean: bash(1), ssh_config(5), sshd(8),

Sections of the man pages

  This page describes the conventions that should be employed when
         writing man pages for the Linux man-pages project, which documents
         the user-space API provided by the Linux kernel and the GNU C
         library.  The project thus provides most of the pages in Section 2,
         as well as many of the pages that appear in Sections 3, 4, 5, and 7
         of the man pages on a Linux system.  The conventions described on
         this page may also be useful for authors writing man pages for other
         projects.

  Sections of the manual pages
         The manual Sections are traditionally defined as follows:

   1 User commands (Programs)
             Those commands that can be executed by the user from within
             a shell.

   2 System calls
             Those functions which wrap operations performed by the
             kernel.

   3 Library calls
             All library functions excluding the system call wrappers
             (Most of the libc functions).

   4 Special files (devices)
             Files found in /dev which allow to access to devices
             through the kernel.

   5 File formats and configuration files
             Describes various human-readable file formats and
             configuration files.

   6 Games   Games and funny little programs available on the system.

   7 Overview, conventions, and miscellaneous
             Overviews or descriptions of various topics, conventions
             and protocols, character set standards, the standard
             filesystem layout, and miscellaneous other things.

   8 System management commands
             Commands like mount(8), many of which only root can
             execute.

See man man for details =)

http://manpages.ubuntu.com/manpages/vivid/man1/man.1.html


Lubuntu 14.04 black screen upon start-up

If the information at the link My computer boots to a black screen, what options do I have to fix it? with relevance to Ubuntu does not get the job done then perhaps the advice there about using the install menu's F6 to change the nomodeset option was not sufficient or the recommendation about using GRUB to also apply nomodeset was similarly lacking.

The answer in this post is specific to Lubuntu and contains no screen shots of Ubuntu that are not exactly what the Lubuntu user will encounter. This answer is specific to Lubuntu 14.04.

The tested recommendation that did succeed for this particular hardware is:

Reboot from the ISO image but highlight Try Lubuntu without installing. While it is highlighted notice that the cursor keys allow you to cursor (horizontally) through the list of configuration keywords. It might not be obvious. What is obvious is that if you can cursor through them you can edit them. Replace the words quiet and splash with the words nomodeset and xforcevesa. The nomodeset will cause the kernel not to set video parameters and leave it to other parts of Lubuntu. The xforcevesa has to do with forcing VESA configurations, probably in X support.
It might not be obvious that Try Lubuntu without installing will provide a way to conveniently install, so to merely "try Lubuntu" is not a waste of time. Once the edits have been made proceed to invoke Try Lubuntu without installing. In a little while, the desktop will show an icon that allows you to actually install Lubuntu. Right click it and invoke it. (Note that the selection Install Lubuntu back in the install menu (not to be confused with the desktop icon for installing) also allows horizontal cursoring and option editing and so it probably is the alternative solution. However, as suggested, to merely "try" was not a terribly inefficient route.)

Perhaps it is not obvious but apparently the option edits that were done in step 1 will persist over shutdowns and reboots.


Route stops working suddenly in LTS 14.04

Never route one address range towards another address range...  That'll always end up with trouble eventually.
Option 1: Both address spaces are on the same physical LAN and the same VLAN:

Do a DHCP reservation on both DHCP servers of your MAC address
Define both IP addresses statically on your machine
Restart networking

Option 2: Both address spaces are on different physical LANs

Add an additional NIC to your machine
Do a DHCP reservation on the additional DHCP server of your additional MAC address
Restart networking

If that's impossible:

Add an additional IP address of the additional LAN statically on your additional NIC.

Option 3: Both address spaces are on the same physical LANs but different VLANs:

Add an additional NIC to your machine
Add the additional NIC/physical switch port to the additional VLAN
Do a DHCP reservation on the additional DHCP server of your additional MAC address
Restart networking

If that's impossible:

Add an additional IP address of the additional LAN statically on your additional NIC.

What probably happened is that security got tightened behind your back and the "old" system doesn't work any more on a router level: talk to IT about the above solutions.


Ubuntu has policy of only including only one version of a package. In ubuntu 11.11 the version of mono that is included supports .net 4. So any program referencing .net 2.0 assemblies will not work. You need to change your project to .net 4.0 and update your references to use the .net 4.0 version of the assemblies you need.


First Check the Output for rfkill list all. It will tell you about the issue. If it's fine use:
rfkill unblock bluetooth # to start bluetooth
and
rfkill block bluetooth # to stop bluetooth
It has already solved your issue. I just wanted to post an answer for future reference.


Rhythmbox syncing windows games sound files. Any way to use windows media player on ubuntu?

The Windows Media Player itself can be made to work but is not a good fit for Ubuntu. As I don't like rhythmbox neither, so I just use VLC player to play all of my media.

The advantage of VLC (for me, might be  a disadvantage to you) is that it doesn't contain a media library at all!

To remove rhythmbox and install VLC player:

sudo apt-get purge rhythmbox*
sudo apt-get install vlc


I have exactly the same problem. I managed to by pass that by cutting everything and pasting it in an other folder and do the opposite manipulation. Then it synchronises. But that would be cool to not have to do that


Ubuntu installation on old laptop : This kernel requires an x86-64 CPU, but only detected an i686 CPU

It appears that you downloaded a 64-bit image, but your laptop only has a 32-bit CPU. Seeing as this is an older computer, I would recommend that you try Xubuntu 32-bit.


Can't copy highlighted text from Tomboy to Thunderbird (or other apps)

Start up Tomboy Notes, Go to Help>About

This will tell you what version you are using. I'm using version 1.4.2 on Ubuntu 10.10 Maverick AMD 64Bit and I can highlight and right click to copy, and I can right click and paste into any other program. I can also do a CTRL C to copy and Ctrl V to paste using keyboard shortcuts with no problems.

I have tested this on a Netbook Acer One Inspire running Ubuntu 10.04 i32bit. On an HP Pavillion with Ubuntu 10.10 i32bit, and on a Compaq Presario CQ62 running 10.10 64 bit amd version. Tested on Evolution mail, Thunderbird, LibreOffice Writer, OpenOffice Writer, Gedit. No problems.

Unfortunately, the formatting is lost with Tomboy and Gnote when pasting to other applications. (Gnote is the same program but ported to C+++ and a bit faster.)

SOLUTION: You could however, export your note as an HTML file, Save it to your desktop or folder, then open it with Firefox, copy and paste to any application and this will preserve the formatting of the original note.

To do this open a note with Tomboy, click on the tool icon (gear looking icon), and select Export to HTML.

You can also go to Edit>Preferences>Add-ins.
There are many addins for this program. The only thing that is very cryptic is that you need to click on the tool icon on an open note to see the print menu.

This is important in case you need to Back up your notes.

Your notes are just a simple xml format files. They are kept in a hidden folder under your home folder. In Ubuntu Hidden folders start with a period. To see them you need to enable it under the View Menu or do CTRL H. Once you know this, it is very easy to backup your notes. :-)

.local/share/tomboy

Click Places, Click Home Folder, Click View, Click Show Hidden Files, double click .local folder, double click share folder, double click tomboy folder.

Just copy your tomboy folder and paste a copy of it for safe keeping.

You can also use other apps to see your notes.
Navigate to the hidden folder .local/share/tomboy
Right click on a note, select open with other application, REMEBER TO REMOVE the check-mark that says to, "Remember this application for "application/x-note type" files. You can choose, a web browser, LibreOffice Writer, Gedit etc. to see the note, with fancy xml tags.


Recover files from lost+found to original location

See here. It is a simple script, but still seems to be useful.


Simple, remove the new line you added from the file ~/.bashrc. Here's a quick guide:

Open a terminal.
Type in gedit ~/.bashrc.
In the editor, look for the line that has . torsocks on on it.
Remove that line and save using CTRL + S or pressing the Save button.
Open a terminal and confirm it no longer shows up (you may also need to reboot the system).

Hope this helps.
Edit: After re-reading through that guide you linked, you may also need to run source torsocks off in a terminal.


Not able to see Ubuntu 14.04 screen via X2GO

Well, the solution I imagined was quite simple: I run Putty to connect with SSH to the server. Then I listed the processes that were running and I killed the one that caused me the trouble.


Python command in bash does not find -c flag

Get_wPassword=python -c 'import keyring; keyring.get_password("WinMount", wUsername)'

should probably be

Get_wPassword=$(python -c 'import keyring; keyring.get_password("WinMount", wUsername)')

and if you want wUsername to be given by the shell variable with the same name

Get_wPassword=$(python -c "import keyring; keyring.get_password('WinMount', '$wUsername')")

(note how the double quotes became single and vice versa)


So I was having a similar problem getting bonding + bridging working on Ubuntu 14.04. There were three key things I had to do:

Disable bios dev names, and update grub.
Create my own udev rules name file.
Have the bridge take the IP, not the bond.

Ok step 1. Make sure you have LOCAL access to this box. Keyboard and monitor. We're going to break your network. Edit this file: /etc/default/grub and change this line:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 net.ifnames=1 biosdevname=0"

(We don't use IPV6, so we disable that as well)

Next, run sudo update-grub and reboot.

Ok step 2. Next, login to your box and run the following: sudo dmesg | grep eth

With any luck, you should find your devices so we can write udev rules. Normally people rename their network devices by MAC address, but bonds tend to confuse udev because the bond might take one of your NIC's MAC addresses in certain configurations, so just don't go down that road. Instead you can do it by device ID. I have Intel NICs, so this is my output. Your mileage will vary:

[   17.888965] igb 0000:07:00.0: added PHC on eth0
[   17.888969] igb 0000:07:00.0: eth0: (PCIe:2.5Gb/s:Width x1) d0:50:99:xx:xx:xx
[   17.889097] igb 0000:07:00.0: eth0: PBA No: 001300-000
[   17.932484] igb 0000:08:00.0: added PHC on eth1
[   17.932488] igb 0000:08:00.0: eth1: (PCIe:2.5Gb/s:Width x1) d0:50:99:xx:xx:xx
[   17.932615] igb 0000:08:00.0: eth1: PBA No: 001300-000

Ok, so my device IDs are 0000:07:00.0 and 0000:08:00.0. These are unique to every hardware setup.

Edit this file, and remove any existing lines from it: /etc/udev/rules.d/70-persistent-net.rules

Add your desired device names like this (notice where to sub the 0000:07:00.0 and 0000:08:00.0):

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="0000:07:00.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="0000:08:00.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Woot. Almost done.

Step 3. For whatever reason, I couldn't get networking to work if the bond took the IP address, but it seems to be working just find if the bridge does. I use this /etc/network/interfaces (I also use DHCP instead of static BTW, just keep those stanzas in):

auto lo
     iface lo inet loopback

auto eth0
iface eth0 inet manual
     bond-master bond0

auto eth1
iface eth1 inet manual
     bond-master bond0

auto bond0
iface bond0 inet manual
     bond-slaves none
     bond-mode 802.3ad
     bond-miimon 100
     bond-downdelay 200
     bond-updelay 200

auto lan0
iface lan0 inet dhcp
  bridge_ports bond0
  bridge_fd 0
  bridge_maxwait 0

Reboot and cross your toes. Good luck!

EDIT

Ubuntu has a few bugs with ordering in this configuration. I inserted some post-up delays because I wasn't consistently able to pull and IP address over DHCP:

/etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual
    bond-master bond0

auto eth1
iface eth1 inet manual
    bond-master bond0

auto bond0
iface bond0 inet manual
    bond-slaves eth0 eth1
    bond-mode 802.3ad
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200
    bond-xmit-hash-policy layer3+4
    up sleep 2

auto lan0
iface lan0 inet dhcp
    bridge_ports bond0
    bridge_waitport 10
    bridge_fd 0
    bridge_maxwait 0
    bridge_stp off
    pre-up sleep 2


Communication between Linux Containers (lxc)

The problem is not with containers but with mysql configuration. By default mysql listens on localhost only. You need to change it to 0.0.0.0 bind address.

E.g. before change you can see 127.0.0.1:3306. It should be 0.0.0.0:3306

root@mysql:~# netstat -anp |grep LISTEN
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      418/mysqld

edit /etc/mysql/my.cnf

edit the bind-address line to look like this:

bind-address            = 0.0.0.0

Then restart mysql service.

Connect to mysql in the mysql container and create the root@"all" user with the below command.

  GRANT ALL PRIVILEGES ON . TO 'root'@'%' WITH GRANT OPTION IDENTIFIED BY 'PASSWORD'; flush privileges;

Remember: replace PASSWORD with a root password for root@all that you want to have


Try to install the library before:
sudo apt-get install --reinstall libgl1-mesa-dri:i386
Than install Steam:
sudo apt-get install -y steam

Source: https://ubuntuforums.org/showthread.php?t=2233005


This is likely a problem with manual installation of fonts. Install MS fonts from ttf-mscorefonts-installer package to ensure all font files are installed, and if you installed these fonts manually, remove them from your personal fonts folder (~/.fonts).


Allow an active directory group to ssh into server

Figured it out. Apparently linux removes the upper case letters and puts them to lower case...


How do I clean up desktop containing shortcuts of Home directory?

They aren't shortcuts but they are the actual files. ~/.config/user-dirs.dirs is a file which contain details about the default user folders. It looks it was somehow messed up. Lets fix it up.

Create the deleted folders.

mkdir Desktop Templates Public Documents

Fix ~/.config/user-dirs.dirs file

Open terminal and run

gedit ~/.config/user-dirs.dirs

Append correct paths of folder in front of respective folder name so that it looks like

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

and save the file using Ctrl+S.

Now navigate to Desktop to see if it's empty (since the folders are created recently and no file was added to that).


How to update additional driver (Nvidia GPU and CPU)

When you mean security updates - you will receive them for the drivers that you have installed from the Ubuntu repositories. When you want feature updates, you have to install new drivers from the Proprietary GPU Drivers PPA ... the latest official NVIDIA drivers currently are 361.28.

It is recommended to use the drivers from the repositories. When you nevertheless want to install the newer drivers from the NVIDIA long-lived branch ... open a terminal and execute :

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-361 nvidia-prime
sudo reboot

Processor microcode contains updated system processor microcode for
Intel x64 x86 processors.
Intel releases microcode updates to correct processor behavior as documented in the respective processor specification updates. It is not necessary to use these drivers - but you can if you want.


Is running Cinnamon on Lubuntu a good idea?

You should be able to install Cinnamon just fine in Ubuntu.  You can install it with these commands.

sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
sudo apt-get update
sudo apt-get install cinnamon

After installing you need to select it at the login screen to use it.

Running Cinnamon on Lubuntu defeats the purpose of Lubuntu.  The LXDE desktop enviroment is what makes Lubuntu so fast.  Installing and using Cinnamon defeats that purpose as you would be using Cinnamon and not LXDE.  It will work, just not be as fast as LXDE. However from my experience Cinnamon is a pretty fast environment.

Removing Cinnamon

To remove Cinnamon, first purge the Cinnamon package.

sudo apt-get purge cinnamon

Then see these instructions on removing a PPA.

Resources:

Is it possible to use multiple desktop environments on same system?

Removing PPAs

How do I install the Cinnamon Desktop?


"Network is unreacheable" but internet is working

I find the solution from the Ubuntu Server Guide:

sudo ufw allow 443


"GNUTLS ERROR: A TLS packet with unexpected length was received" when I connect my iPhone 3G

You don't have to jailbreak your Iphone with Ubuntu however you will probably have to add a new "PPA source" to your Ubuntu installation to get the required packages for Ubuntu to Recognise your phone.

The ppa you will need to add is ppa:pmcenery/ppa to add this open a Terminal from the accessories menu and type this at the prompt.

sudo add-apt-repository ppa:pmcenery/ppa

and hit enter once this has been added type this command in the same terminal

sudo apt-get update

and after

sudo apt-get upgrade

this should upgrade your package libimobiledevice to version 1.0.4 from 1.0.1 enabling you to access your Iphone

PPA Reference:

What are PPAs and how do I use them?

edit

Having had a a good look around for Idevice mounting tutorials I found this at ubuntugeek it goes through the procedure of manually mounting the device including all of the required packages and file edits to get this to work hopefully this is the solution to your problem. Bearing in mind that the tutorial was written for Ubuntu 9.10 and for an Ipod touch there is a quote at the end of the tutorial

  Update from our reader :- It works for
  Iphone 3g. But at the end of
  preparation procedure you need to
  restart both your computer and the
  iPhone device.

Edit 2

if you receive this error message when trying to mount with Ifuse

GNUTLS ERROR: A TLS packet with unexpected length was received

You need to pair the phone with your pc to do this enter this command

idevicepair unpair

Your Iphone or other Idevice will automatically try to re-pair. You can then unplug it and plug it back in and it should mount correctly.


Accidentaly created a different user when reinstalling Ubuntu

I would first backup all the important data you want to keep, including the currently encrypted files in your olduser home. Does ecryptfs-recover-private not work to decrypt your old home files? It should, if you remember the old login passphrase, or you have the mount passphrase.

I don't think renaming the olduser home to something else is needed, the next step should just use the existing folder as the home for the "new olduser".

Then create a new user with your desired name, probably "olduser"? Use the same login passphrase from before, then it will hopefully decrypt the home successfully when you login. Using the gui tools might have an option or checkbox to encrypt the user's home, I think it just runs ecryptfs-migrate-home on the new user, so I don't think you want that. Or just use adduser in a terminal. This should use the existing home files in olduser.

Then if the olduser files aren't still in the olduser home, copy them back from the backup.

Then try logging in as "olduser". Hopefully it will decrypt the home (using the same login passphrase from before the reinstall) and work ok.

If it doesn't work, then renaming your old home, creating a new user "olduser" with the encrypted home checkbox, or using ecryptfs-migrate-home and then logging in as newuser and copy back the old home files from your backup should work.


you will find a documentary about installing bluetooth here :

Bluetooth installation guide


How to compare two (vague) file lists and print the duplicates?

You're going to have to pre-process the files to "fix" the irregularities:

fixfile() { sed -r 's/([[:alpha:]])([[:digit:]]+)$/\1.\2/; s/\./_/g' "$1"; }
comm -12 <(fixfile backup.txt | sort) <(fixfile backup2.txt | sort)

auser_backup
auser_backup_2


Remapping the AltGr key to Control  with setxkbmap

Thanks to the suggestions of the Xorg community I found out the correct setxkbmap command:

setxkbmap -option ctrl:ralt_rctrl


Ran sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock now the keyboard or the mouse does not work on login screen

I don't see removing the lock file effecting your keyboard, however what happened to produce the orphaned lock file could be related. try doing

apt-get -f install


How can I play a song in the background via my command line?

Backgrounding play with & fails because play wants to output its status, e.g.

In:12.7% 00:00:27.31 [00:03:07.52] Out:1.20M [!=====|=====!] Hd:0.0 Clip:0

but cannot if backgrounded. So it keeps waiting until aborted.

To solve this, simply run play with the -q (quiet) switch. This will successfully background it and play will terminate when the song ends.

(sleep 10 ; play -q Desktop/SONGS/01\ -\ Oh\ Baby\ Girl.mp3 ) &

  You can stop it by either typing killall play (if no other play instances are running), or by kill $! (if you haven't backgrounded other processes in the same terminal after starting play -- $! gives you the PID of the last backgrounded process)


How To Rename Multiple Photos and Videos Based on EXIF Data?

I needed to rename my photos and found this question here -- I just found out that exiftool handles it natively:

From http://www.sno.phy.queensu.ca/~phil/exiftool/filename.html

exiftool -d %Y-%m-%d_%H-%M-%S%%-c.%%e "-filename<CreateDate" DIR

If you want to keep track of original filename and write extension lower case:

exiftool -d %Y%m%d_%H%M%S%%-c-%%f.%%le "-filename<DateTimeOriginal" [.|DIR]

The same works also with the whole filename in lowercase:

exiftool -d %Y%m%d_%H%M%S%%-c-%%lf.%%le "-filename<DateTimeOriginal" [.|DIR]


Forced UEFI when installing 17.04. Way to undo this?

Based on the comments, it's clear that you're in data-recovery mode now. There are numerous questions here on this subject, but in brief, you may be able to use TestDisk to recover entire partitions or PhotoRec to recover individual files. These aren't the only tools that can do this, and it sounds like you've found at least one other. There are also professional data-recovery services -- you send them your disk and they recover your files. Such services are pricey, though. Whatever tools or services you use, this is likely to be a painful task, and it's very unlikely that you'll recover your Windows installation to a bootable state. You'll probably have to re-install Windows before moving on to a Windows/Ubuntu dual-boot.

To that end, it's important that you understand the difference between an old-school BIOS, the new-fangled EFI/UEFI, and the perils of the CSM. In sum:

BIOS -- This was the original PC firmware. It was written in 16-bit code in 1980 or 1981 and is very primitive by modern standards. It's been holding back PC development for years. In late 2011, manufacturers began a stampede to replace their BIOSes with UEFIs, likely because Microsoft required a specific UEFI feature (Secure Boot) to certify hardware for Windows 8.
EFI/UEFI -- This is the successor to BIOS. (UEFI is EFI 2.x. I generally use "EFI," as it's the more generic term, except when I really mean the 2.x version.) Confusingly, many people, and even companies, refer to EFIs as "BIOSes." Because EFI is such a radical departure from BIOS, though, using "BIOS" to refer to an EFI is a mistake, IMO, because it leads people to think the differences are smaller than they are. This leads to untold problems. Importantly, EFIs requires entirely new boot loaders compared to BIOS. Some boot loaders, like GRUB, have been ported to both types of firmware, which can help hide the differences; but others are BIOS-only (such as LILO) or EFI-only (such as the EFI stub loader).
CSM -- The Compatibility Support Module (CSM) is a backwards-compatibility layer for EFI; it enables an EFI to launch an older BIOS-mode boot loader or OS. You can think of the CSM being to EFI much what dosemu is to Linux -- both tools let you run programs for an older environment (BIOS or DOS) on a newer and more capable one (EFI or Linux). The CSM is sometimes necessary, but if it's activated, it makes it uncertain which way a boot medium that supports both modes will boot. This in turn can lead to problems, including the one you encountered -- you told the installer to do something dangerous because you didn't understand the warning, and now you're picking up the pieces. For more on the CSM, see this page of mine.

At this point in time, most people doing fresh installations to blank disks are best served by disabling their CSMs and installing all OSes in EFI mode. Fortunately, this is something of the default, since the vast majority of new computers come configured this way. Windows 7 and later, all current versions of Ubuntu, most other current Linux distributions, all versions of OS X/macOS that run on Intel-based Macs, and several more obscure OSes all support EFI-mode booting. Some very old or very obscure OSes don't support EFI, but they can often be run in a virtualized environment (via VirtualBox, VMWare, etc.) just as well as on the "bare metal." The most common path to CSM-related problems results from bad Internet advice to enable it, and/or people poking around in their firmware setup utilities to get around boot problems with an OS installer. (Recall that BIOSes and EFIs require different boot loaders. If an installation medium was improperly prepared, it may lack an EFI-mode boot loader but have a BIOS-mode boot loader, so enabling a CSM may seem to work around a boot problem -- but this just leads to bigger problems down the road.)

Based on your description, it sounds as if you enabled your CSM and (re?-)installed Windows in BIOS mode. Presumably you had some reason for doing this, but when you booted the Ubuntu installer in EFI mode, it set you on course for disaster. When it comes time to re-install, it's probably best to disable the CSM and go with an all-EFI installation. OTOH, if you had a compelling reason to boot in BIOS mode, you should at least be aware of what all this entails, so that you don't repeat the mistake, or make some other equally devastating mistake.


Why am I not being able to import dateutil module in Python 3?

First make sure that you are not trying to import the module after activating the virtualenv. If you have your virtualenv activated and didn't supply the argument --system-site-packages while creating it, the module won't be available to you to import in virtualenv.

If you are not using a virtualenv and still unable to import the module, then make sure that you are using the Python 3 interpreter and not the Python 2 interpreter. Since you installed the package for python3, it won't be available to import in python2 interpreter. Next try to purge and reinstall the module using:

sudo apt-get purge python3-dateutil
sudo apt-get install python3-dateutil

Purging the package and reinstalling it should fix any issues which was restricting to import the module.


How to retain back to the last permission of file or directory

There's no such thing as "I messed up, go back to last state".
You either need to know the permissions the file / directory had before or look up that information somewhere. If you don't have access to that information, you're out of luck.
Always make backups!


Enable dragging between workspaces, Gnome-Shell

If you know Javascript, you can write an extension. Otherwise, AFAIK, there is no way to do this in GNOME Shell.


How does linux understand multiple periods in changing directories

Answering my own question as my initial question itself was flawed

Linux doesn't actually understand multiple periods. It's actually zsh which interprets it as going up multiple parent directories.

So if you are using zsh and are on say /a/b/c and use the command cd ..., it will take you back to /a. If you are using bash, it will correctly tell you that no such file or directory exists. It works the same way for other commands such as ls so you can actually do ls ... to see the files in the parent's parent directory. Just keep adding periods to go up one more parent.

It's a neat little feature hidden in zsh that I didn't know earlier. Thanks for the help everyone :)


Cryptsetup does not accept passphrase after installation

You can try to redo the installation and go to 'Try Ubuntu' before doing the actual installation. There you can set the keyboardlayout and it should become effective.

There is even a comment about this on the bug tracker.


Simply download https://files.pythonhosted.org/packages/e4/83/c66a1934ed5ed8ab1dbb9931f1779079f8bca0f6bbc5793c06c4b5e7d671/python-docx-0.8.10.tar.gz (or a later version found at https://pypi.org/project/python-docx/#files)

Then un-tar it with tar -x, (or python -mtarfile -e python-docx-0.8.10.tar.gz python-docx).

Finally change directory to where you extracted it and run python setup.py install

Note that you will have to ensure that the dependencies are met first, at the time of writing they are:

behave>=1.2.3
flake8>=2.0
lxml>=3.1.0
mock>=1.0.1
pyparsing>=2.0.1
pytest>=2.5

But the latest will be in the requirements.txt file within the tar file.


Please help me with resolving HDD mounting error code

Try to read the error message, the last part say:

  Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the 'ro' mount option.

Just choose one of those options, and your mount will succeed.


OpenStack Havana with Juju/MAAS : no Quantum API server listening for requests

The Neutron API server resides on the Nova Cloud Controller (this will probably change for 14.04 and bit split out to be its own charm).

I'd check to ensure that neutron-server is installed on the nova-cloud-controller node:

apt-cache policy neutron-server

Question: when did you configure the network-manager for the nova-cloud-controller service?


Follow these simple steps.

Download the robomongo: https://robomongo.org/download
Extract the .tar.gz downloaded from above
Change directory to extracted folder.
You'll find a bin folder. Go in there, then double click on robomongo.

Anytime you'll wanna run robomongo, you will have to do something like this from terminal:

/path/to/robomongo_dir/bin/robomongo

You might wanna add a link to robomongo from your /usr/bin which will allow you to do something like this anywhere from terminal:

for that

navigate to robomongo_dir/bin
right click on robomongo executable file and click on Make Link, Link to robomongo executable file will be created there
rename Link to robomongo to your wish ( let say robo_)
move this link to /usr/bin directory with below command on terminal

sudo mv /robomongo_dir/bin/robo_ /usr/bin

Now you can run robomongo from terminal OR from run command (Alt+ F2) by typing robo_


How do I fix "can't open /dev/sr0: No medium found" on USB boot?

I've had the same problem the entire night. It's due to the installer not recognizing the USB drive after it's booted to BusyBox.

To fix this, you need to press F6 and modify the boot options. First, remove "quiet splash" from the options and add "break debug" in it's place. Continue installation as normal from this point. Eventually, it will break and you'll be presented with the BusyBox shell, and see plenty of the errors relating to this.

Are you ready for the next step? I promise you, it's an advanced manuver that even Han Solo himself would struggle to attempt.

Step 1: Unplug your USB drive

Step 2: Plug your USB drive back in

Step 3: Type exit and press <Enter>

Step 4: Wait 5-30 seconds and you'll be booted into your Ubuntu graphical installer.

Note: I've verified this works for Ubuntu and Linux Mint. I've been working on this problem for about 4 hours tonight and this is what worked for me, after trying every imaginable method of configuration flags for both the installer and BIOS. I am using a Toshiba Satellite C655D and using a 32GB USB 3.0 flash drive as the installation media.

I hope this helps someone, as I was about to go back to Windows after this nightmare.


Can not safely remove external hard drive?

I have a cheap WD Black that has the same issue and there is no firmware update available.  As I use it as a back-up drive that I only attach 1/week, I stopped worrying about it and unmount all partitions and then just unplug it...

Has been successful for the last 4 years or so.


Is there an equivalent of Gnome Tweak Tool for XFCE?

You simply do not need one, XFCE is very customizable by default, you can do anything the tweak tools can do, right from the system settings.

You can change theme and icons through Settings → Appearance and window borders through Settings → Window Manager.

This link will give good detail on changing the various theme components.


Ubuntu 2D working fine, but not Ubuntu virtual machine in VMWare Workstation 9 Windows 7 Host

OK I fixed it! I just needed to turn off 3D Acceleration in the VMware. On the menu bar go to VM > Settings > Display > Uncheck Accelerate 3D graphics. ;)


How do multiple init systems coexist on Ubuntu?

Only one init system can be the primary on a given system. On 14.04 it's Upstart. On 16.04 and beyond it's systemd.

If you upgrade to 16.04 you can use systemd exclusively.


Ubuntu GNOME 17.04: wi-fi not working -- mac address keeps changing?

So Jesse discovered a solution and I'm going to share it here in answer form as clearly as I can muster. This fixed wifi for me using a Panda Wireless USB wifi adapter on Ubuntu 17.04:

For privacy reasons, the default settings for Ubuntu 17.04's network manager (ALL flavours, not just GNOME) cause the MAC address of the Wifi device to change constantly. To fix this, you just have to create a new config file as outlined below and then restart the network-manager service.

Open a terminal and run:

sudo tee /etc/NetworkManager/conf.d/wifi.scan-rand-mac-address.conf > /dev/null <<EOF
[device]
wifi.scan-rand-mac-address=no
EOF
sudo service network-manager restart

and wifi should work again! (unless something else is wrong).

This fix should work even on a live CD/USB session.


Latest Nvidia driver- how long for PPA version?

Add the Michael Marley Staging (DO NOT USE) PPA if you want the latest but this is a test PPA, Michael Marley is one of the guys working on the main Nvidia PPA so in time i'm sure he will update the main PPA or maybe you could contact him.


Try to install the following ubuntu package:

sudo apt-get install libqt5core5a

It seems to be missing.


Script to switch between two sound devices

I found the script finally. This script will move all input sinks (i.e. your music, video sound etc.) to your other sound device. If you run the script again it will move all sinks back to your original sound device. (I have only tested this on two sound devices).

Instruction on how to setup:

Paste the following code into a file using gedit.
Save the file as speakers.sh (or some other file name) in your home directory.
Change the file permissions to allow execution.

Right click the file and choose properties.
Select the permissions tab.
Tick the "Allow executing file as program" tick box

or

chmod +x ./speakers.sh

Double click the file and click run. It will change the output sound device.

I then added an option on the settings icon in the unity launcher for ease of access using Ubuntu Tweak. Enjoy!

Code:

#!/bin/bash

declare -i sinks=(`pacmd list-sinks | sed -n -e 's/\**[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`)
declare -i sinks_count=${#sinks[*]}
declare -i active_sink_index=`pacmd list-sinks | sed -n -e 's/\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`
declare -i next_sink_index=${sinks[0]}

#find the next sink (not always the next index number)
declare -i ord=0
while [ $ord -lt $sinks_count ];
do
echo ${sinks[$ord]}
if [ ${sinks[$ord]} -gt $active_sink_index ] ; then
    next_sink_index=${sinks[$ord]}
    break
fi
let ord++
done

#change the default sink
pacmd "set-default-sink ${next_sink_index}"

#move all inputs to the new sink
for app in $(pacmd list-sink-inputs | sed -n -e 's/index:[[:space:]]\([[:digit:]]\)/\1/p');
do
pacmd "move-sink-input $app $next_sink_index"
done

#display notification
declare -i ndx=0
pacmd list-sinks | sed -n -e 's/device.description[[:space:]]=[[:space:]]"\(.*\)"/\1/p' | while read line;
do
if [ $(( $ord % $sinks_count )) -eq $ndx ] ; then
    notify-send -i notification-audio-volume-high --hint=string:x-canonical-private-synchronous: "Sound output switched to" "$line"
    exit
fi
let ndx++
done;

All credit goes to the guys here, I just re-found the answer to my question.


What is "Unlock keyring" and how do I get rid of it?

The keyring can store passwords and encryption keys for you. They are protected with your login password and stored safely via encryption. It's like putting all your keys in a safe that just has one key. Every time you use an application (like e.g. Ubuntu One) for which you have stored a password for in the key ring, the key ring enters it for you. Beside the comfort factor that helps to counteract key-loggers and the like, as they need physical access to your key-ring data and your account password.
Normally, if you don't have auto-login activated, the keyring is unlocked, when you login to L/Uubuntu using your account's regular password. Since you seem to have enabled auto-login on start-up (just a guess), the keyring has to be unlocked manually with your accounts password (once on first use for each session) .
What you can try:
Auto unlock option
Usually there is an option to "Automatically unlock this keyring when I log in":

Unset keyring password
For obvious reasons this is very insecure. If no one but you has physical access to your computer this could be the way to go.
In Lubuntu you might not have already installed "Passwords and Keys" (seahorse). To install:
sudo apt-get install seahorse

or https://apps.ubuntu.com/cat/applications/seahorse/

Open the "Passwords and Keys" (in Menu/Preferences, or Alt-F2: seahorse)
On the appropriate folder corresponding to your user account click right
In the popup menu click "Change Passwords"
In the resulting dialogue enter your old account password and leave the new password blank

Sudoers file
You can try to edit your /etc/sudoers file like this:

Run sudo VISUAL=/usr/bin/gedit visudo

At the bottom of this file add the line
cipricus ALL=(ALL) NOPASSWD: /usr/bin/ubuntuone

Assuming "cipricus" is your account's username under Lubuntu.

Make sure everything is correct, close geidt, then run Run sudo -K to update your sudoers session.


It looks like libawt_xawt.so requires libXext.so.6 but can't find it.

To fix it, try: sudo apt install --reinstall libxext6

Source: http://packages.ubuntu.com/search?searchon=contents&keywords=libXext.so.6&mode=filename&suite=raring&arch=any


Interrupted Ubuntu installation and deleted(?) GRUB

See here first tbefore attempting: https://help.ubuntu.com/community/ReinstallWindowsWithoutLosingUbuntu

The graphical way

Turn off machine and insert installation usb, boot your machine and select try ubuntu.
Install and run Boot-Repair
Click "Recommended Repair".
Now reboot your system. The usual GRUB boot menu should appear. If it does not, hold Left Shift while booting. You will be able to choose between Ubuntu and Windows.

Source:

https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows


How block a country from connection to a port

The hardest part is working out which IP ranges belong to which country. There may be a way of doing this yourself but (at least for IPv4) the easiest way of doing this at the moment is using a service like ip2location.

They'll give you an entire list. They'll actually give you a list in iptables format.

Get what you need, run them (to block them immediately) and then save them into /etc/network/iptables.rules so they're picked up next boot. Or use iptables-persistent.

That will block from any port. If you want to just block a single port from that list, you'll need to condition it by adding a --dport 27115 to each line:

sed -i 's/ -j/ --dport 27115 -j/' downloaded.rules

Then load them up.


Nautilus doesn't allow me to access files

Start nautilus as super-user
Right-click on said folder
In the pop-up menu select "Properties"
In the "Properties" dialogue select the tab called "Permissions"
In the "Permissions" tab make sure that the Owner of the folder is you and that you have read/write access
Than click "Apply Permissions to Enclosed Files"

Note: It also doesn't hurt to set the right Group here. You can do the same in the shell by typing:

sudo chown -R username:group /path/to/folder  # substitute your username and group for
sudo chmod -R ug+rw /path/to/folder           # "-R" means recursive - it will be applied to subfolders and files therein


Reboot and Select Boot Device after full format/install from 14.04 live cd

I eventually found a solution in this post on the Ubuntu Forums.

  From the live cd:

  Use the efibootmgr to set Ubuntu to boot like Windows.

sudo efibootmgr -c -L "Windows Boot Manager" -l "\EFI\ubuntu\shimx64.efi"

  From live installer mount the efi partition on hard drive; lines with # are comments only:

#Mount efi partition. check which partition is FAT32 with boot flag. Often sda1 or sda2 but varies.
mount /dev/sda1 /mnt
#only if not already existing,
mkdir /mnt/EFI/Boot
cp /mnt/EFI/ubuntu/* /mnt/EFI/Boot
# If new folder created, the bootx64.efi will not exist, skip this command
mv /mnt/EFI/Boot/bootx64.efi /mnt/EFI/Boot/bootx64.efi.backup
# make grub be hard drive boot entry in UEFI. If not existing, may have to update UEFI also with efibootmgr.
mv /mnt/EFI/Boot/grubx64.efi /mnt/EFI/Boot/bootx64.efi


Is there a way to see HDD temp.?? I am using lubuntu 12.04

sudo apt-get install hddtemp

That will install hddtemp. To find HDD temperature, use the syntax:

sudo hddtemp /dev/sda


No option to choose between Ubuntu or Windows at startup; tried many suggestions already

Try to reinstall now that EFI is disabled.  You could also use SuperGrubDisk

http://www.supergrubdisk.org/wizard-restore-grub/

I'm no expert but I suspect that EFI blocked Grub from being put on the MBR.


Can sshguard filter TCP+UPD ports? If so, how to prevent that?

Sshguard will not be filtering or unfiltering any of your ports.
It is reading log files, creates an iptables chain and "manage the rules" like adding/restricting ip addresses bruteforcing/exceeding connections limit on ports configured in sshguard.

So NO there won't be any conflict between sshguard and ufw.


Canonical livepatch service stopped working

After a while i was able to find a solution, so to speak. Well, sorta. Nevertheless, it works like a charm in my particular situation.
1) sudo canonical-livepatch disable
2) sudo snap remove canonical-livepatch
3) sudo cp /etc/machine-id /etc/machine-id.original
4) sudo cp /var/lib/dbus/machine-id /var/lib/dbus/machine-id.original
5) gedit /etc/machine-id
(remove everything and save empty machine-id)
6) sudo systemd-machine-id-setup

reboot
7) sudo snap install canonical-livepatch

Now proceed to (https://auth.livepatch.canonical.com/) and obtain the token, then
8) sudo canonical-livepatch enable [your token]

Your livepatch should work from this point pretty stable and apply necessary updates.

Source: Canonical livepatch failed when I tried to enable token


The volume “boot” has only 0 byte disk space remaining?

The easiest way is to install Ubuntu Tweaks:

Select the kernels you want to remove and go on --- I normally leave the newest of the current series and (if available) the older of the previous (like a 3.8 kernel).

Be careful that if you have some manually installed kernel (upstream, testing, etc) the janitor will remove all your automatically upgraded kernels if you tell him to remove all kernel in the list --- and then you need to reinstall manually linux-generic to go back to the standard kernel line. Do not delete the most recent old kernel as a rule of thumb and be safe.

Normally you have the error while upgrading, and that means you can have a failed upgrade linging; I would advise a

sudo apt-get install -f
sudo apt-get update
sudo apt-get dist-upgrade

after the cleanup.


Why doesn't my camera work when there's a kernel module for the driver?

Do you have "access" (the file permissions kind of "access") to /dev/video?
ls -l /dev/video

will show you.
sudo adduser $USER $(stat -G /dev/video)

followed by logout/login will give you "group" access to /dev/video.


This is what I do in Ubuntu 12.04 for a freeipa server 3.0.0

Install repos for sssd and freeipa-client

sudo -E apt-add-repository http://ppa.launchpad.net/freeipa/ppa/ubuntu
sudo -E apt-add-repository http://ppa.launchpad.net/sssd/updates/ubuntu
sudo apt-get update
sudo apt-get upgrade

Update or verify fqdn in /etc/hosts, you should have a line like this:

127.0.1.1 hostname.freeipa-domain-name hostname

Verify that your /etc/resolv.conf has a correct configuration and it is able to resolve freeipa generated entries for that domain, example:

dig freeipa.generated.entry

Install necessary packages

sudo apt-get install openssh-server freeipa-client sssd

Remove default configuration file

sudo rm /etc/ipa/default.conf

Create this folders or the script won't work

sudo mkdir /var/run/ipa
sudo mkdir -p /etc/pki/nssdb

Verify that you have a woking ntp client (configure /etc/ntp.conf)

ntpq -pn

Backup and revert reported version of ipapython so keys will upload

sudo cp /usr/share/pyshared/ipapython/version.py /usr/share/pyshared/ipapython/version.py.bak

sudo sed -i "s/API_VERSION=.*/API_VERSION=u'2.49'/g" /usr/share/pyshared/ipapython/version.py

Make --mkhomedir functional

sudo bash -c "cat > /usr/share/pam-configs/mkhomedir" <<EOF
Name: activate mkhomedir
Default: yes
Priority: 900
Session-Type: Additional
Session:
        required                        pam_mkhomedir.so umask=0022 skel=/etc/skel
EOF

sudo pam-auth-update

Finally, install client as root and answer installer questions

sudo su -
ipa-client-install -N --hostname hostname.freeipa-domain-name --mkhomedir

Restart sssd or reboot

/etc/init.d/sssd restart

ssh to that machine with a freeipa user so the home directory will be created

ssh freeipauser@hostname.freeipa-domain-name


As mentioned above in a comment; you should try to reset your router settings in order to make it work.

When you are connected to the router, it doesnt mean that the router allows you to go past it. So, it isn't for sure that you are on the world wide web only by connecting to router? So, firefox tells you that he tried to connect to the internet, and he failed because he didn't find any "servers" to connect to. If you ain't sure what you are configuring, don't configure it without having support or help from someone who does know what to do.


extracting numbers whose lengths are fixed from text file

Your grep command was almost correct, you just have to anchor the pattern to match only if there is a word boundary before or after it.

Word boundaries are zero-length patterns that match between a word-character (letters, digits, underscore) and a non-word charater (e.g. spaces, other punctuation, line end, and everything else).

In grep, you can either do this by surrounding your pattern with \b, or by using the -w switch to enable word matching:

$ grep -Po '\b\d{4}\b' data
2018
2014
2014

$ grep -Pow '\d{4}' data
2018
2014
2014


You can try to add

accept-ra: no

to your netplan config for the desired interface. According to the manpage of netplan

man netplan

this option prevents the kernel from configuring IPv6 by itself on basis of the Router Advertisment sent to your server.


Try QtCreator.

Or KDevelop if you use KDE.

If you need something more lightweight use CodeLite.


Not able to use internet despite being connected - 14.04

If /etc/resolv.conf does not exist. You must create one and enter the nameserver line

For Example

nameserver 8.8.8.8

Where 8.8.8.8 is the Google DNS Server. You need to put in your DNS Server IP Address.

Note:- /etc/resolv.conf Should automatically get generated but if it is absent you need to create it. After that it should stay there.


How can I change which driver is used for a sound card?

There is no standard that would allow the driver to detect DSD devices. Each device must be listed in the driver, and so far, nobody has known about the "mDSD".

The only way to get the mDSD to work is to recompile the driver.


You probably need to clean lens of your DVD drive or buy a new one. If system cant boot from it then its a hardware issue and Ubuntu has nothing to do with it.


Ubuntu 18.04 crashed all of sudden. Can anyone help me to figure out the problem and resolve this?

I had the same problem this morning. It have been resolved by doing a fsck on the corrupted disk. Hope this will help.


How come JAVA_HOME not automatically set for all users after installing openjdk-6 on Ubuntu 12.04?

Installing the packages typically sets up symlinks to the common Java binaries as /usr/bin/java, etc. and that's sufficient for most Java applications.

Some still want the legacy JAVA_HOME and for something like Hadoop, the best place to set it is in the global environment config file /etc/environment ; it will then be available in the console (TTY), terminals and the desktop.


No DEFAULT or UI configuration directive found!

I think I have managed. I was using a 8gb USB stick, then swapped it to a 2gb USB and used Universal USB Installer.
Didn't have to rename those 3 items.

I am now able to boot up Ubuntu and use the "Try Ubuntu" option.

Many thanks for your response and links to other answers.


How to force minimize or switch a video / game - Bug?

There is no standard way to switch out of fullscreen in Linux right now. Some apps will have a shortcut for it such as F11, Ctrl-f, Alt-Tab or Alt-Enter, but others do not and quitting them might be the only way and if they are buggy not even that might be possible.

For apps running in Wine there is however a workaround. If you run winecfg go to the Graphics tab and set Emulate a virtual desktop you can force all Windows applications to run in window mode. Furthermore you can use wmctrl to remove the borders of a window. I found that running applications in window mode and having this command bound to a key:

wmctrl -r ":ACTIVE:" -b toggle,fullscreen

Works quite well most of the time, as unlike fullscreen mode done by a game itself, this kind of fullscreen is done by the window manager and you retain normal Alt-Tab control. It however only works with games that run in the same resolution as your desktop.

I have also written some tools to further tweak fullscreen behavior:

https://github.com/Grumbel/fullscreen-tools

But they are not all that user-friendly, but might be interesting if you wanna tweak things a bit further, to disable decorations, keep a window on top and move it to 0,0 would look like this:

windowtool.py -d 0 -a 1 -m 0,0 ACTIVE


#!/bin/bash
mv /full_PATH/file1.bak config.yml
mv /full_PATH/file2.bak config2.yml
sudo ./config.yml

This should work..save this file with say "test.sh" and them in terminal type ./test.sh


How to hide the arguments sent to the executable from ps

Why not make a shell script with the same name that calls your command but filters the output with grep? Of course add the executable's directory to the beginning of $PATH so any call to your program will be your shell script. For example:

#!/bin/bash
/bin/ps | /bin/grep -v "Process name"

That will show all processes that ps shows except "Process name". Place it in a bash shell script using the full path for your commands. Place this command in /directory/x and add the below script to /etc/profile.d/path.sh

#!/bin/bash
PATH="/directory/x:$PATH";

This will override any reference to ps to your custom script. Lmk if you have any questions and hope this helps! :)


use *only some* 64-bit packages on 32-bit Ubuntu

32-bit and 64-bit refer to the size of memory registers in a computer's CPU. How do you suppose a 32-bit kernel should do that?

A 32-bit kernel can run 32-bit software.
A 64-bit kernel can run 64-bit software and 32-bit software.

You need a 64-bit kernel to run 64-bit software.

The only way to use 64-bit software on a 32-bit system is with virtualization: install a 64-bit system into vBox or VmWare but that requires some support from your BIOS (You need enable Intel (R) Virtualization Technology and Intel (R) VT-d. More on this here: Can I use virtualbox with a 64 Bit image in a 32 bit host ).


How to recover deleted .ssh/known_host entry?

Now when I try to connect to the droplet using ssh username@ipaddress it returns an error: username@ipaddress Permission denied (publickey). Is there a way to obtain the history of the known_hosts file? Maybe I need to copy-paste my public key somewhere?

known_hosts keep a history of the public server keys your client has seen. It is used to protect against a man in the middle-attack, as that would lead to a changed remote public key.

It is thus used to authenticate the server to the client, not the opposite way. If you connect to an unknown host, you will be prompted if you want to trust the key or not.

You deleting lines in known_hosts is not the reason why you get permission denied when you try to connect using a keypair. Run ssh -vvv user@host to get more information about why you get connection denied.


How can I uninstall/reinstall Ubuntu from a dual boot with Windows 8.1?

You can use the ubuntu installation disk to do that. You can use the "Try Ubuntu" option on the Live CD to back up your files and if you use the "Install Ubuntu" it  will recognize your windows and Linux partition and you will have the option to resize and format your partitions.


Missing UFW file - WARNING "Couldn't stat '/etc/ufw/before.rules'"

Very simple fix once I figured it out.
Use Sudo -i to change to root user
Use nano after the # and create the missing files
Now have /etc/ufw/ the before.rules, after.rules, before6.rules and after6.rules
Now I can setup my UFW


How to remove shortcut directory bookmarks in homes creen?

In your case just click Desbloquear do lançador (Unlock from launcher). In Ubuntu >= 18.10 it's rather Remove from favorites. Keep in mind that it will be still visible on your dock while it's opened.


What is equivalent to animation painter in Libreoffice Impress

Short of hacking the .odp file itself, as described in this related 2016 LibreOffice Forum thread and repeated here, there is currently no way to do what you're asking.

Open the file with some kind of archive management program.
Extract contents.xml.
Open in in a file editor. It better be one which can format XML files, since all text in the file is on the same line.
Find the relevant anim:par element.
Set smil:begin="1s" on the relevant elements.
Save the file.
Put the file back into the .odp file.

That said, I can confirm that the hack does work, as I've used it myself in the past for instances similar to your own.


In general if you have an x64 processor then you should choose an x64 operating system.


Can a script resume after computer comes out of hibernation?

As soon as you hibernate everything freezes in the status you left it (including your script). The script is not running during hibernation it simply resumes as if you actually never put the PC to sleep. All that changes for the script is the current time/date, so if the script relies on that you may have some issues.


apt, aptitude, synaptic etc. are frontends to the same tool: dpkg. dpkg is very low-level, and apt isn't particularly smart. So if package configuration was interrupted, apt tells you to descend to the lower level to fix it. Note that apt may not be aware of the packages which caused the problem (they may be manually installed local packages, and they may be a hundred packages and not one) and keeping it simple, it tells you to use the tool that is aware of them. Mitch has already posted what this command does.