How to remove all traces of python from Ubuntu I want to clean all traces of python from my Ubuntu. Is there any easy solution?
To start with I guess I should remove all pip packages. I tried command as suggested here, but got bunch of failure messages:
#pip3 freeze | xargs pip3 uninstall -y
Found existing installation: appdirs 1.4.4
Uninstalling appdirs-1.4.4:
  Successfully uninstalled appdirs-1.4.4
Found existing installation: attrs 19.3.0
Not uninstalling attrs at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'attrs'. No files were found to uninstall.
Found existing installation: Automat 0.8.0
Not uninstalling automat at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'Automat'. No files were found to uninstall.
...

What should I do? This answer asks to run:
sudo rm -rf /usr/local/lib/python2.7/dist-packages/twitter

Should I run? I have py files at following paths:

\usr\lib\python2.7
\usr\lib\python3\dist-packages
\usr\lib\python3.8

Also this unaccepted answer asks to do:
sudo apt remove python-numpy

I am currently on wsl2 Ubuntu. And am wary, because today only, I (possibly) screwed my another Ubuntu installation, by accidentally deleting all above pythonXYZ folders. Now I am neither able to remove all traces of python nor able to reinstall python on that machine. It keeps giving me some error (may be I have to ask separate question for that). But how do I fix this WSL Ubuntu?

Please don't.
Ubuntu relies heavily on different Python versions for functionality. New releases of Ubuntu are slowly shifting to Python3, but older versions of Python are still in use.
You can list some important Ubuntu and Gnome packages on your system that depend on Python3, for example, like so:
apt-cache rdepends -i --installed --recurse python3 | \
grep -v " " | sort -u | grep -E "ubuntu|gnome"

On Ubuntu 20.10 desktop, these important packages are among them:
gnome-control-center
gnome-session
gnome-terminal
network-manager-gnome
ubuntu-desktop
ubuntu-desktop-minimal
ubuntu-drivers-common
ubuntu-minimal
ubuntu-release-upgrader-core
ubuntu-release-upgrader-gtk
ubuntu-session
ubuntu-standard
ubuntu-system-service

Moreover, there is no such Python clean state. Each system update and each package you install might bring with it Python related dependencies.
You can however use pip or pip3 to uninstall only packages you previously manually installed and even this is not totally risk free.
If you have already removed Python, try this or this if you need a fix. Chances are little though. If you manage to fix it, you are lucky.
Golden rule... Leave the snake alone.

That being said, use a Python virtual environment for your Python projects and you shouldn't be needing to clean or go back to clean state Ubuntu system Python.
Python virtual environments create an isolated environment for your Python projects. This means that each project can have its own dependencies, regardless of what dependencies the Ubuntu system or other Python projects have.
This feature can be installed for Python3 like so:
sudo apt install python3-venv

To make a Python3 virtual environment for a project, you would first create a directory and cd to it like so:
mkdir my_env && cd my_env

Then, create a new Python3 virtual environment inside the directory like so:
python3 -m venv env

This will create a structure like this:
$tree -L 3

.
└── env
    ├── bin
    │   ├── activate
    │   ├── activate.csh
    │   ├── activate.fish
    │   ├── Activate.ps1
    │   ├── easy_install
    │   ├── easy_install-3.8
    │   ├── pip
    │   ├── pip3
    │   ├── pip3.8
    │   ├── python -> python3
    │   └── python3 -> /usr/bin/python3
    ├── include
    ├── lib
    │   └── python3.8
    ├── lib64 -> lib
    ├── pyvenv.cfg
    └── share
        └── python-wheels

To use this environment, activate it like so:
source env/bin/activate

Your shell prompt will show (env) like so:
(env) $

During this, Python3 commands, module installs or modifications will be contained locally in this virtual environment.
When you are done, deactivate this Python3 virtual environment like so:
deactivate

You are now back to the system-wide Python3 and commands will take effect globally so be careful.

I happily agree your heretic opinion that the life is much better on a system without python as with it. The problem is not only with the language implementation, but also with the concepts of it (it is a basic script language with a surreal syntax, yet it is used for complex OO projects). And the most important problem is the very low quality of the available software base, both of the libraries and of the end products, to the extent that it endangers even the open source community et al. But it is only my opinion, others have different, sometimes opposite opinions. Here I only explain, how to purge python from your system for all.
Contrary the popular belief, you can purge python from your whole system - it is not an essential package, fortunately. Some tools and softwares depend on it, so it is possible that you will need them. In this case, a minimal python (if you have luck, at least not python2) needs to remain. Other packages (like node.js) depends on it no reason, also they should be purged (alternatively, a sane re-packaging project not depending on them would be useful, hopefully someone will once do it).
The package dependencies are a DAG: all packages have a list of packages in which is depends on, also these depend on other packages and so on.
What you need: map these dependencies and find the root of them. For that, you have three most important commands:

dpkg -s <package> shows, which packages depend on <package>, if it is installed on your system. apt-cache show <package> does the same for a package in your apt cache (packages available for installation in your registered apt repositories).
apt-cache rdepends <package> shows, which packages depend on <package>.
dpkg -S /usr/bin/python3.6 shows, which package has /usr/bin/python3.6. Note, /usr/bin/python is typically a symbolic link somewhere into /etc/alternatives, where there is a symlink to the real package binary, and these are not part of the registered file lists of the packages (available in /var/lib/dpkg/info/*.list). So possibly you will need to map the symlinks to their real version with ls -l commands and then use dpkg -S to find the package.

Using these, you can find the package on which all python package depends on. In the case of python, it is libpython2.7-minimal, or libpython3.6-minimal. You can list them by a dpkg -l|grep libpython.*minimal.
Then an apt --purge remove libpython2.7-minimal will purge (delete without any trace that they ever existed) python completely from your system. It will also list for you, exactly which packages will be removed, if you have some what you really need, unfortunately you will need to keep python.
The same can work if you want to purge other large software distributions (like X11 from servers and similars).


How to get true, correct font rendering on Ubuntu 14.04+ Font rendering has always been a huge problem on Ubuntu.  I am hoping someone has a real solution to this problem.  I have a laptop with a 17" (382x215 mm) display running at 1920x1080, approximately 128 PPI (DPI).  I wish to get Ubuntu set up properly on this display.  This means that when I select a 72-point font, capital letters will be exactly 1" (2.54 cm) high, and applications such as LibreOffice will display documents with true-to-life measurements when scaled to 100%.

I have tried:

Starting X with -dpi 128 (by modifying /etc/lightdm/lightdm.conf), no apparent effect
Adding my display dimensions to my xorg.conf file, no apparent effect
Setting the DPI with xrandr --dpi 128, no apparent effect
Setting org.gnome.desktop.interface.text-scaling-factor to 1.33 (128/96), fonts get bigger, but are still not large enough

Increasing the text-scaling-factor to 1.93 displays fonts in the correct size (72pt M in character map measures 1 inch tall), however this makes the whole UI wacky, and requires to reduce my UI font sizes to 5-6 in order to be usable.  Unfortunately Unity itself does not pick up on these changes, and so searches in the dash, etc. have absurdly huge fonts.

In addition to all this, the non-font UI elements are still too large. I feel like I need to set com.ubuntu.user-interface.scale-factor to 7 (scale for menus and title bars = 0.875), which of course requires increasing the text-scaling-factor accordingly, and everything just looks like a mess.

Why is this so difficult?  Calibrating one's screen should be a simple, basic task that every user does when first installing Ubuntu.  What I am asking here is, how can I achieve the perfect setup, where fonts appear correctly sized, the UI isn't too huge, and layouts of Unity and other applications are all appropriate?

For LibreOffice, I just found a simple solution.

Click on Tools > Options > LibreOffice > View

Adjust the scaling figure (default 100%) to the size you need. For me setting it to 106% meant that when LibreOffice says a document is displayed at 100% it really is the width of the paper.


Can't Boot Ubuntu on Lenovo Ideapad 100s I just bought a Lenovo Ideapad 100s, and it's preloaded with Windows 10 Home Edition. The software on the computer doesn't allow me to access the boot menu to boot from the USB. Do any of you know a method to force the boot from the USB?

I, you can access the BOOT menu by F12, or with the NOVO button right the battery indicator.
Note that this PC is 32bit UEFI only, so you had to include bootia32.efi file in the BOOT folder in your USB drive. Here the precompiled file: https://github.com/hirotakaster/baytail-bootia32.efi.
The state of the art is that you can achieve WIFI working patching the kernel, see https://plus.google.com/+IanMORRISON works to get a custom ubuntu ISO (Wifi, in the latest, work out of the box). For the audio, check the merge in Linux-next and Linux 4.9, changes are working in the shadows ;)

Press F12 at boot time, select USB drive, and boot it in UEFI mode. Or, your computer does not support syslinux.


how to export bash arrays? any workaround tips? I am using the bash version 4.2.37 at ubuntu 12.10. But since ubuntu 12.04 I am unable to export arrays in bash...

This is an example (type these lines in the command line, it is not a script):

export astr=(a "b c" d)
declare -p |grep astr
bash
echo ${astr[@]}
declare -p |grep astr

echo outputs nothing...

declare -p |grep astr outputs nothing either...

What I am looking for is an workaround, because as far I know that is considered an known bash bug.

EDIT: btw, if possible, the workaround could avoid creating temporary storage files for the array as I may run the same script simultaneously on different shells.

It's not a bug with bash, there's just not any safe way to put a bash array in the environment.
As for workarounds, that depends on what you're trying to achieve with exporting arrays in the first place.
One possible workaround, for some cases, is to dump the array to a file and source that file where you need it.
astr=(a "b c" d)
declare -p astr > some_file

bash -c 'source ./some_file; printf "%s\n" "${astr[1]}"'

Another workaround could be to pass the array on as arguments to the next shell.
astr=(a "b c" d)
bash -c 'astr=("$@"); printf "%s\n" "${astr[1]}"' _ "${astr[@]}"

Wait wait wait... I know that I'm a little late here, but this question is still relevant when we are looking for exporting arrays on google so, my workaround was:

declare -a ASTR;
export ASTR=(`echo a b c`);

# Printing all elements content
echo "${ASTR[*]}";
# Printing a position
echo "${ASTR[2]}";

It will return c once arrays first position is 0.
I hope that helps someone looking for it.

Regards


Java plugins are not detected after upgrading After an upgrade to Trusty Tahr (14.04), it seems Java has ceased to work in several browsers (tested on Firefox, Chromium, and Chrome).

ubuntu-restricted-extras is installed, Oracle-Java was installed using the webupd8 PPA, and I also tried applying a fix to an update-alternatives error, and installing IcedTea, to no avail.

How to activate Java plugins in the browsers?

Check the symbolic link in your browser's plugin directory and make sure it's pointing to the correct installation of Java (eg /usr/local/java/jre1.x.xxx/lib/amd64/libnpjp2.so)


Why won't my WiFi work with a Belkin USB dongle and WPA2? I am using a Belkin usb dongle to connect to my wifi  network with a wpa2 key. Most of the times Ubuntu is not able to connect to the network automatically and keeps on asking for the key, even though the correct key has already been entered.

It connects after restarting networking multiple times.

I am on 11.04 with the latest updates.

Try using wicd instead of native network-manager. I had similar issues, mostly related to bizarre unexpected wifi disconnections - after upgrading to 11.04. I never had this problem on earlier versions of ubuntu to be honest.

I once had to use an Acer Aspire TimelineX that had an unsupported wireless card. I downloaded wicd via wired and it worked perfectly, although it doesn't show up in your panel.


missing syslinux.cfg file for ubuntu 16.04 iso installation on USB After using installing ubuntu-16.04-server-amd64.iso on to a USB stick (using  lili), I get the "boot:" console because the syslinux.cfg file is empty, as explained here.

Where can I find an example of the syslinux.cfg file for ubuntu 16.04?

I was able to successfully install the iso on my USB using the Pen Drive Linux installer.

I'm sure you found it by now but, copy and paste this into the "UUI" folder where it resides:

# This file was automatically populated by Universal USB Installer - http://www.pendrivelinux.com
prompt 0
DEFAULT append

LABEL append
CONFIG /isolinux/isolinux.cfg
APPEND /isolinux


How do I create a script file for terminal commands? In Windows I can write a file containing commands for cmd (usually .cmd or .bat files).  When I click on those files it will open cmd.exe and run them commands the file contains.

How would I do this in Ubuntu?

I'm sure this is a duplicate, but I can't find my answer.
Its similar to these questions, but they don't answer the question:

Store frequently used terminal commands in a file

CMD.exe Emulator in Ubuntu to run .cmd/.bat file

There are two methods.

First, the most common is to write a file, make sure the first line is

#!/bin/bash

Then save the file. Next mark it executable using chmod +x file

Then when you click (or run the file from the terminal) the commands will be executed. By convention these files usually have no extension, however you can make them end in .sh or any other way.

A few notes:

Any (and I mean any) file can be executed in Linux provided the first line is a path to the program that should interpret the file. Common examples include /bin/python,  /bin/sh, /bin/dash, but even odd ball things work like /bin/mysql
Bash is a full language. It is vastly more complex than cmd.exe in windows. It has a strong programming language that supports functions, loops, conditionals, string operations, etc.
These documents may help if you run into problems.
If you do not wish to make the file executable then you can run it by passing it as an argument to bash: bash file/to/run.sh

A Simple Bash Example

#!/bin/bash
echo "This is a shell script"
ls -lah
echo "I am done running ls"
SOMEVAR='text stuff'
echo "$SOMEVAR"

The second method is to record commands using script. Run script then just do stuff. When you are done doing stuff type exit and script will generate a file for you with all the "stuff" you did. This is less used but works quite well for making things like macros. man script for more info.

The equivalent to Windows batch files is shell scripts, and an excellent getting started guide is Bash Scripting.

For the most part, commands that you can enter on the command line can be placed in a shell script.

A couple of things that are different from Windows batch files:

There are different command interpretors, called shells. The default is bash, but if you are interested, there are others, such as zsh, ksh, dash, perl, python, etc.
To run a shell script, you need to make the file executable, which you can do with chmod +x <filename>
In Ubuntu, the current directory is not the program search path, so you need to run ./<filename>, not <filename>
Variable names are $<varname>, not %<varname>%
Commands in a shell script are not printed by default, as in a batch file.
The filename's extension can be .sh or (more customary) you don't need to use an extension. Put #!/bin/bash on the very first line of the file, which tells Ubuntu what program to use to run the file.
Comments start with #, not rem.

Hope this helps and have fun scripting!


svn checkout - An error occurred during decompression The following error occurs when I checkout a large repository:

E120104: ra_serf: An error occurred during decompression

What is the problem and how can I avoid it?

I tried cleanup and checkout thereafter, but it stopped with:

E120104: ra_serf: An error occurred during decompression

I am on Ubuntu 14.04, svn, version 1.8.8 (r1568071).

Editing ~/.subversion/servers, and having this:

[global]
http-compression = no

Solved it for me.

Set following key-value to SVN conf file. That should do the trick.

DeflateCompressionLevel 5

1 is the lowest value.
9 is the maximum value.


Xubuntu/precise: default programs chaos I'm using xubuntu "precise".

I have set up my preferred applications (Settings/Preferred-Applications or $ exo-preferred-applications):

web browser: chromium
mail reader: thunderbird
file manager: thunar
terminal emulator: xfce4-terminal

However, some programs have their own ideas:

clicking the terminal icon in the xfce panel opens xfce4-terminal but Thunar's "open terminal here" opens NextStep terminal.
clicking a link in thunderbird or the terminal opens it in chromium, clicking a link in a PDF in evince fails with "Failed to execute child process "/opt/google/chrome/google-chrome" (No such file or directory)". Clicking a link in OpenOffice opens firefox whereas alpine prefers to open links in epiphany.
"Open containing folder" in evince fails with "Failed to execute default file manager - Failed to execute child process "/usr/bin/Thunar" (Permission denied)." (Doubly odd as said application exists and runs fine on the command line.) Other programs prefer to launch nautilus instead.

What settings to I have to set so that every application that needs a browser/terminal/file manager uses the correct one? Getting evince to open hyperlinks correctly and Thunar my xfce terminal are my priorities, everything else would be nice.

You may have to change "desktop specific" applications (e.g. Nautilus to Gnome, Dolphin to KDE, ...) via the desktop specific control applications.
So for Gnome use gnome-control-center and for KDE systemsettings and set the default applications.


how to get the update manager window visible? I can see from the launcher that the Update Manager is running - it has the little triangle by it. However, I am having trouble seeing the window. If I click on it from one desktop, it switches to another, so I assume that the Update Manager has its window on that other desktop, but it still doesn't show anything.

If I click alt-tab to switch between apps, I can see that the Update Manager is there, but selecting it just shows me a blank screen. Also, when I select it, while still holding the alt-key, I see the top menu bar switch to 'Update Manager', but when I release alt, it changes back to Ubuntu Desktop.

It's almost like the app is off the screen somewhere, perhaps with just a single pixel showing or something like that.

disclaimer: One thing that might be affecting things is that I have 'focus follows mouse' configured, which makes things a bit funky with the menu not being on the window, where it should be (perhaps there's a way to put it back with the window?) - I like to be able to type into background windows, and manually control which window is in the foreground.

I am having the same issue with not being able to open / view the window using the Update Manager icon in the right side launcher.

Workaround: right-click the icon and Quit Update Manager from the quick list, then go to the top right Settings (gear) menu and click on Updates Available...

This would show the Update manager window.

Workaround: right-click the Update Manager icon on the quick list and select Quit (as noted earlier), and then use middle button on the same Update Manager icon.


Recursive Checksumming I've been using the following command line to do recursive checksumming of directories. It seems to get the job done, but still being a newbie I've been wondering, are there any potential problems with doing it this way? Is it possible for this command to miss files or otherwise mess up?

find ./dir/ -type f -exec sha1sum {} \; > files.sha1

There's nothing wrong I can see with your approach. You're excluding directories and  find will include hidden files by default. Yeah, it's fine.

But I'll offer you an alternative because that's what I do:

shopt -s globstar dotglob
sha1sum **

globstar enables a recursive match for ** and dotglob enables matching hidden files. Between them they expand to all the filenames and sha1sum can parse them all.

The main problem with this approach is it will pass all the filenames off to sha1sum in one fat pile. While this can be somewhat faster at small loads, it will explode if you have too many filenames. I don't know what the cut-off is.

Python script with hashlib and os.walk

Aside from using find and globstar, python has modules for hashsum calculation and recursive walk through directory tree. Thus, one can write a simple script just as presented below. In fact, this script is pretty much the same as what I've used for this answer with one minor difference.

This script assumes that you want to recursively walk through the current working directory, so make sure you cd to the desired top directory first.

I would also recommend that you save it in ~/bin directory and run source ~/.bashrc prior to usage, since that way, you can just type the name of the script on command-line.

The script gathers all files, including the hidden-ones ( with the leading dot in the filename ).

Script Source

#!/usr/bin/env python3
import os
import sys
from hashlib import sha1

def get_sha1sum(file_path):
    sha1sum = sha1()
    with open(file_path, 'rb') as fd:
        data_chunk = fd.read(1024)
        while data_chunk:
              sha1sum.update(data_chunk)
              data_chunk = fd.read(1024)
    return str(sha1sum.hexdigest())

def find_files(treeroot):
    for dir,subdirs,files in os.walk(treeroot):
         for f in files:
             full_path = os.path.join(dir,f)
             path_sha1sum = get_sha1sum( full_path  )
             print(path_sha1sum,full_path)

def main():
    find_files('.')

if __name__ == '__main__': main()

Demo Run

bash-4.3$ cd Wallpapers/
bash-4.3$ recursive_checksum.py
c66af072272d2c516e29832d0a86afa0e8e61d8c ./moon_moon.jpg
37829801c48ea0420414fc78de45adb13e4b117f ./wat.png
6cc3dd2541d00aa5fb8fd6ec703d3c7653ce4708 ./hard_drive_wallpapers/hard-drive.jpg
52fbff84cba6bbbfadc5777c1189ec39aef9176a ./hard_drive_wallpapers/hard-drive5.jpg
5bfe52eb8b31f50dc7bd1b1991dcc1d7260ec65e ./hard_drive_wallpapers/hard-drive4.jpg
f2f85eaa24c8c5b82bbedd55f887ea5fc520ac21 ./hard_drive_wallpapers/hard-drive3.jpg
bcdcf278c176fa93557627a33bedebe4e508e27a ./hard_drive_wallpapers/hard-drive2.jpg


How to make modem faster? I am new and I just installed Ubuntu on my desktop. Do I have to install drivers for my modem for it to download fast? Because the download speed I am getting is really slow compared to my mac.

Drivers are the programs to make communication between your System and device. Ubuntu is so powerful that it automatically recognize modems  so you don't need to install extra driver for it and main thing is that Your internet connection speed doesn't depends on modem driver.

Internet speed depends on RAM(fine if 2 gb) and CPU speed. Also, if u r opening many web pages, or running multiple applications at the same time, it can slow down or hang.Anyway, to check ur internet speed, close all the web pages and applications, open ur browser and run http://www.testinternetspeed.orgIf u r using usb modem, check if the usb port does not contain dust particles.


What is a  process, and why doesn't it get killed? The chrome browser was not responsive and I tried to kill it, but instead of disappearing the process had <defunct> at its right, and didn't get killed:

What is <defunct> for a process and why it doesn't it get killed?

From your output we see a "defunct", which means the process has either completed its task or has been corrupted or killed, but its child processes are still running or these parent process is monitoring its child process.
To kill this kind of process, kill -9 PID doesn't work. You can try to kill them with this command but it will show this again and again.
Determine which is the parent process of this defunct process and kill it. To know this run the command:
$ ps -ef | grep defunct
    UID          PID     PPID       C    STIME      TTY          TIME              CMD
    1000       637      27872      0   Oct12      ?        00:00:04 [chrome] <defunct>
    1000      1808      1777       0    Oct04     ?        00:00:00 [zeitgeist-datah] <defunct>

Then kill -9 637 27872, then verify the defunct process is gone by ps -ef | grep defunct.

Thank you Mike S. We took your line and wrote a script that will kill defunct processes whose parent is in.telnetd. We didn't want it to kill any parent process, just telnetd that we know is causing a problem and we'll run it multiple times to kill multiple ones if needed.

# egrep -v '^1$ = Make sure the process is not the init process.
# awk '{print $3}' = Print the parent process.

first_parent_of_first_dead_kid=$(ps -ef | grep [d]efunct | awk '{print $3}' | head -n1 | egrep -v '^1$')
echo "$first_parent_of_first_dead_kid"

# If the first parent of the first dead kid is in.telnetd, then kill it.
if ps -ef | grep $first_parent_of_first_dead_kid | grep in.telnetd;then
        echo "We have a defunct process whose parent process is in.telnetd" | logger -t KILL-DEFUNCT-TELNET
        echo "killing $first_parent_of_first_dead_kid" | logger -t KILL-DEFUNCT-TELNET
        kill $first_parent_of_first_dead_kid 2>&1 | logger -t KILL-DEFUNCT-TELNET
fi


Minecraft Launcher Crashing I just downloaded Minecraft on Ubuntu 12.04 lts. The launcher opens, but when I click play, it crashes and reopens with this error report.

---- Minecraft Crash Report ----
// Surprise! Haha. Well, this is awkward.

Time: 1/1/14 12:31 PM
Description: Initializing game

org.lwjgl.LWJGLException: Could not init GLX
    at org.lwjgl.opengl.LinuxDisplayPeerInfo.initDefaultPeerInfo(Native Method)
    at org.lwjgl.opengl.LinuxDisplayPeerInfo.<init>(LinuxDisplayPeerInfo.java:61)
    at org.lwjgl.opengl.LinuxDisplay.createPeerInfo(LinuxDisplay.java:818)
    at org.lwjgl.opengl.DrawableGL.setPixelFormat(DrawableGL.java:61)
    at org.lwjgl.opengl.Display.create(Display.java:846)
    at org.lwjgl.opengl.Display.create(Display.java:757)
    at org.lwjgl.opengl.Display.create(Display.java:739)
    at azi.ad(SourceFile:325)
    at azi.f(SourceFile:696)
    at net.minecraft.client.main.Main.main(SourceFile:152)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:

    `at org.lwjgl.opengl.LinuxDisplayPeerInfo.initDefaultPeerInfo(Native Method)
    at org.lwjgl.opengl.LinuxDisplayPeerInfo.<init>(LinuxDisplayPeerInfo.java:61)
    at org.lwjgl.opengl.LinuxDisplay.createPeerInfo(LinuxDisplay.java:818)
    at org.lwjgl.opengl.DrawableGL.setPixelFormat(DrawableGL.java:61)
    at org.lwjgl.opengl.Display.create(Display.java:846)
    at org.lwjgl.opengl.Display.create(Display.java:757)
    at org.lwjgl.opengl.Display.create(Display.java:739)
    at azi.ad(SourceFile:325)  `

-- Initialization --
Details:
Stacktrace:
    `at azi.f(SourceFile:696)
    at net.minecraft.client.main.Main.main(SourceFile:152)`

-- System Details --
Details:
    `Minecraft Version: 1.7.4
    Operating System: Linux (i386) version 3.5.0-23-generic
    Java Version: 1.6.0_27, Sun Microsystems Inc.
    Java VM Version: OpenJDK Server VM (mixed mode), Sun Microsystems Inc.
    Memory: 34158592 bytes (32 MB) / 55836672 bytes (53 MB) up to 477233152 bytes   (455 MB)
    JVM Flags: 1 total; -Xmx512M
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    Launched Version: 1.7.4
    LWJGL: 2.9.1
    OpenGL: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
    GL Caps:
    Is Modded: Probably not. Jar signature remains and client brand is untouched.
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: ~~ERROR~~ NullPointerException: null
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
    Anisotropic Filtering: Off (1)

How can I fix the error?

On Mageia 5 I just installed xrandr and ran it and it fix the problem. I don't know if by running it something was configured. But it works.


How do I prevent PolicyKit from asking for a password? For years, I've had the following in my sudoers file:

scott   ALL=NOPASSWD: ALL

For those who don't know, this prevents sudo and friends (gksudo, etc.) from asking for a password. However, over the years, more and more stuff that once used sudo has been switched to using PolicyKit.

I'm looking for an equivalent configuration for PolicyKit, such that it'll never ask me for my password.

For those who don't like my request, let me say this: I understand the reasons for the default configuration, and they are sound. I also understand the risks inherent in the configuration I want to make. Nevertheless, it's the way I want to set up my system. Those who don't fully understand the above shouldn't attempt what I'm attempting.

You can trick PolicyKit and suppress ALL password prompts by substituting the action with a wildcard.

DISCLAIMER: The following will suppress ALL password prompts globally for everyone belonging to the admin group, with the exception of the login screen. It is EXTREMELY dangerous and should NEVER be implemented because chances are YOU WILL END UP BREAKING YOUR SYSTEM!!

Don't say you weren't warned!

NOTE: If you are running 12.04 or later, substitute "admin" with "sudo"!

Replace "username" with your actual user name:

usermod -aG admin username

Switch to root:

sudo -i

Create a new policy:

gedit /var/lib/polkit-1/localauthority/50-local.d/disable-passwords.pkla

Add the following:

[Do anything you want]
Identity=unix-group:admin
Action=*
ResultActive=yes

Save and exit. Then go try something that usually requires a password. :)

NOTE: It doesn't matter what you use as your .pkla file name. You can name it anything you want.

And last, this is the ONLY policy you'll need when it comes to suppressing password prompts because again, it does so globally.

One option, if you know what you're doing, is to disable policy kit completely.

sudo apt-get remove libpolkit-agent-1-0


Create a single pdf from multiple text, images or pdf files I have a bunch of text files, images and pdf files which I want to convert into a single pdf file. How do I do it?

If you're willing to use a terminal, you can use ImageMagick.  Install it with

sudo apt install imagemagick

then you can do:

convert image1.jpg image2.png text.txt PDFfile.pdf outputFileName.pdf

It worked for me, but the problem is it converts the text.txt file into an image, so you can't highlight the text in the resulting pdf.

I use PDF-Shuffler for this kind of use, it works great.

sudo apt-get install pdfshuffler

It is a graphical tool. You simply load all the pdf files you want to fuse. You can change the page order as you wish.


How can I make the nfs server support protocol version 2 in Ubuntu 17.10? I have a linux embedded system that (when doing active development on it) mounts its root filesystem as an nfs share exported from my ubuntu box. So just to be extra clear: embedded linux is the nfs client, my ubuntu box is the nfs server. I don't have much control over the embedded system doing the actual nfs mounting.

When I upgraded to ubuntu 17.10, I found out this does not work any more.

After much debugging, I think I pinpointed the problem to a protocol version mismatch: while sniffing traffic with wireshark I found out the embedded system sends NFS packets with the old protocol version 2, but here's what I get on my ubuntu box I run

$ rpcinfo -p localhost
program vers proto   port  service
 100000    4   tcp    111  portmapper
 100000    3   tcp    111  portmapper
 100000    2   tcp    111  portmapper
 100000    4   udp    111  portmapper
 100000    3   udp    111  portmapper
 100000    2   udp    111  portmapper
 100005    1   udp  43512  mountd
 100005    1   tcp  39783  mountd
 100005    2   udp  35844  mountd
 100005    2   tcp  58287  mountd
 100005    3   udp  48188  mountd
 100005    3   tcp  60599  mountd
 100003    3   tcp   2049  nfs
 100003    4   tcp   2049  nfs
 100227    3   tcp   2049
 100003    3   udp   2049  nfs
 100227    3   udp   2049
 100021    1   udp  44366  nlockmgr
 100021    3   udp  44366  nlockmgr
 100021    4   udp  44366  nlockmgr
 100021    1   tcp  43079  nlockmgr
 100021    3   tcp  43079  nlockmgr
 100021    4   tcp  43079  nlockmgr
 100024    1   udp  50305  status
 100024    1   tcp  42983  status

so no nfs version 2, only 3 and 4.

Anyone knows how to add nfs version 2 support to my nfs server?

You need to modify /etc/default/nfs-kernel-server to have these lines:

RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"
# To confirm above mods are in effect after service restart use
#     cat /run/sysconfig/nfs-utils
#  or
#    service nfs-kernel-server status
#

and restart the service

service nfs-kernel-server restart

take care that after service restart you may need to re-start shares

zfs share -a

Finally confirm that protocol 2 is being supported (tcp and udp too if necessary)

rpcinfo -p servername | fgrep nfs

You should see this

100003    2   tcp   2049  nfs
100003    3   tcp   2049  nfs
100003    4   tcp   2049  nfs
100003    2   udp   2049  nfs
100003    3   udp   2049  nfs

I ran into the same problem with my embedded system (TI AM5728). Assuming you are using uboot, the trick is to change the command line being passed to the kernel. This is set by the contents of the bootargs environment variable. (see uboot documentation for details)

To fix you will need to add a ",nfsvers=3" addition onto the end of the
nfsroot portion of your kernel command line (bootargs variable)

On my system when booting into NFS, the bootargs variable line looks like the following:

bootargs=console=ttyO2,115200n8 root=/dev/nfs rw rootfstype=nfs ip=dhcp nfsroot=192.168.x.x:/path/to/share

This worked fine until 17.10 and then died - The following change forces the kernel to connect using NFS v3.

bootargs=console=ttyO2,115200n8 root=/dev/nfs rw rootfstype=nfs ip=dhcp nfsroot=192.168.x.x:/path/to/share,nfsvers=3


Why does Dropbox fail with a "dropboxd not found" error? This is a fresh install of Dropbox on a 12.04 server running on a 32bit system. It does not seem to fail the installation, but when I try to run it, I am told it can't find the file.

Following the instructions on the Dropbox site, I get the following message:

  ~/.dropbox-dist/dropboxd: 10: exec: ~/.dropbox-dist/dropbox: not found

Has anyone had this problem and know a work around? Running 12.04 server

Are you sure you installed the right dropbox architecture binary?

32bits version
64bits version

I was able to run dropbox using /usr/bin/dropbox
I installed the application while logged in as root.
Probably this is the reason ~/.dropbox-dist/dropboxd  and
/home/{user}/.dropbox-dist/dropboxd were not working.


Why isn't the Printscreen button working in Gnome? Printscreen button not working on Gnome. I have to Run Shutter to make printscreen. Is there any tutorial to make it work with printscreen button?

Actually it's working if you hear a sound. You screenshots are saved to the picture folder.

The Gnome guys changed the default behaviour, take a look at the Launchpad bug or at the upstream bug report for more details.

It doesn't work in Older Versions of Unity or gnome classic, try updating the kernel. What version are you using 12.10 or 12.04 11.10 11.04 Lucid Lynx? If you're using version 12.04 it's very simple http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.4-precise/
and download the correct ones for you arch like AMD64 or i386 or ARMS. Install them by the terminal:

cd Downloads
sudo dpkg -i Linux*.deb

This will install all the files. This fixed many errors with my keyboard like the back-lit and NumLock and hr volume controls or try switching over to KDE Kubuntu it worked for me.


default permissions for /var/www I was trying to open a file and write to it with PHP at /var/wwwfolder
but it wasn't working so I did

sudo chmod 777 /var/www

now I want to set the permissions for /var/www to the default.
what are the default permissions for /var/www?

The default permission for /var/www itself is a pretty standard one: owner root:root and mod 755.

As for anything inside /var/www, that is one of the rare directories where you have the privilege of deciding for yourself what to put in it and what permissions everything in it should have.  But what makes the most sense is:

Most files should be writable by whichever user or group is going to be writing to them most.  You can set them to be owned by your user account.  Or set up a custom group for your developers.  Or if the files will be modified rarely and you want good security, you can go with root:root and just sudo in on the rare occasions they'll be modified.
Most files should not be world-writable.  So, 644 for files, and 755 for directories is appropriate (or 664 and 775 if you want to give a group write access).
It is not recommended to set any of it to be writable by the web server, ie www-data, except for any specific files your web scripts to be able to write to.  If so, it's better to set the user or group of those files to www-data than to make them world-writable.  Note that any time the www-data user can write to any file within the web root, whether it's by setting the user or group on those files, or making them world-writable, it's a potential security problem.  World-writable is just the worse of the two.

sudo adduser $USER www-data
sudo chown root:root /var/www

sudo chown -R $USER:www-data /var/www/*
sudo chmod -R 755 /var/www


Where are the instructions for MAAS when one does not own the network? Where are the instructions for MAAS when one does not own the network?  Did I miss it? I see the instructions for using MAAS if I own the network and can setup my own DHCP server, but I failed to find the instructions for using MAAS when I do not own the network.  I would like to create a test cloud at work, but the network guys aren't going to allow me to run a DHCP server on their network, how do I do this?  The docs I saw at this URL:

https://wiki.ubuntu.com/ServerTeam/MAAS

claimed to cover the case:

You're experimenting while using someone else's network: you can't allow MAAS to own the network's DHCP.

but I did not see any instructions for that case.  What am I missing?  Thanks!

Instructions are the same but you have to manually edit your DHCP server configuration to include DHCP options 66 (PXE server) and 67 (filename which will be "/pxelinux.0")


How to know version of program in meta-package? How to know the version of a set of program to be installed through a meta-package?

If you're contemplating installing a metapackage and you want to know what all the packages are that will be installed as a consequence, and all their versions, one of the best ways to find this out is to simulate installing the metapackage.

First, update information about what packages and versions are available. (You should do this before installing most packages, especially metapackages that may pull in a lot of other packages. So you may as well do it before your simulation, so the simulation reveals the correct information.)

sudo apt-get update

Then run the simulation. For example, suppose you're contemplating installing the kubuntu-desktop metapackage:

apt-get -s install kubuntu-desktop

Replace kubuntu-desktop with the name of the metapackage you want to install. (This  actually works for any package available from any configured software source, and you can list multiple packages, separated by spaces, too.)

It looks like this (though yours will be different, in part because you have different packages already installed).

Usually, you can find out the version number of a program by typing

program -v

or something along those lines in a terminal, or by going to Help > About if it has a GUI.


LDAP authentication: not able to login through GUI but able to login from console I am building a LTSP environment with LDAP authentication. I have configured the LTSP,LDAP server and client perfectly. I checked with getent passwd command in LTSP/LDAP client. I can see my LDAP users details.

When I booted my LTSP thin client, I am able to login with LDAP user credentials in Alt+Ctrl+F1 mode. But, Not able to login through GUI( lightdm ). See the logs which is from LTSP/LDAP Client.

/var/log/ldm.log:

Apr 15 18:15:53: [ldm] INFO: started on client with IP address: 192.168.12.34
Apr 15 18:15:53: [ldm] INFO: calling rc.d init scripts
Apr 15 18:15:55: [ldm] INFO: authenticating with backend: ssh
Apr 15 18:16:09: [ssh] INFO: calling rc.d pressh scripts
Apr 15 18:16:32: [ssh] CRITICAL: no response, restarting
Apr 15 18:16:34: [ldm] INFO: started on client with IP address: 192.168.12.34
Apr 15 18:16:34: [ldm] INFO: calling rc.d init scripts
Apr 15 18:16:35: [ldm] INFO: authenticating with backend: ssh
Apr 15 18:17:55: [ssh] INFO: calling rc.d pressh scripts
Apr 15 18:18:18: [ssh] CRITICAL: no response, restarting

/var/log/auth.log ( LDAP Server ):

Apr 16 18:41:54 dennis sshd[2727]: Connection closed by 192.168.12.34 [preauth]
Apr 16 18:41:54 dennis sshd[2729]: Connection closed by 192.168.12.34 [preauth]
Apr 16 18:42:09 dennis sshd[2731]: Invalid user myusername from 192.168.12.34
Apr 16 18:42:09 dennis sshd[2731]: input_userauth_request: invalid user myusername [preauth]
Apr 16 18:42:09 dennis sshd[2731]: pam_unix(sshd:auth): check pass; user unknown
Apr 16 18:42:09 dennis sshd[2731]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.12.34
Apr 16 18:42:11 dennis sshd[2731]: Failed password for invalid user myusername from 192.168.12.34 port 38059 ssh2
Apr 16 18:42:11 dennis sshd[2731]: Connection closed by 192.168.12.34 [preauth]

How to solve this?

At the client side run the following:

#authconfig-gtk

Now, try setting the Authentication Configuration as LDAP Password(in the Identity and Authentication tab). It worked for me.


Make a .deb for a Node.js application How I make a .deb for a Node.js application that installs Node.js and its required npm modules on dpkg -i?

Which is the place in the filesystem where I have to put this application? (/opt,/usr/local).

Thanks in advance.

Here's an article + screencast on the subject:

How to create a .deb for NodeJS apps

I know this is kind of late.

Here is a ppa repo that might help you:
https://launchpad.net/~chris-lea/+archive/node.js/

This installs node to a standard location. I consider installing with npm to local directories (part of the application) the best practice.

Source: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager


Which Partition do I install alongside Windows on an HP Pavillion dv7? I'm trying to install along side windows on an HP Pavillion dv7.
I've installed ubuntu on other machines, so I know a little about the process.

If I remember right, my HD had too many partitions, and I would have to remove one to dual boot properly, so I put it off until now.

I'm using a live CD now, and I'm on the "Installation type" step.
I don't really understand what I'm looking at.

Let me try to explain this one.

Problem: If you already have four primary partitions, then you won't be able to create another partition on your hard disk.

Solution: Copy all the data from one of your partitions to another and delete that former partition. You can copy it to an external hard disk too. I seriously can't see any workaround for this.

In order to delete a partition, launch Gparted and right-click on the drive that you wish to delete. Refer to the figure below:

After deleting it proceed with inserting a Live CD and your ubuntu installation. When you reach the step that you have shown in the figure, select the "unallocated space" (We will have that since we just deleted a partition) and select "logical" from the small window that pops up.

I think you can complete the rest of the installation steps with your own logic. Do let me know if you need any more information. :)

You can see my logical partition as /dev/sda2. Once you have a logical partition, you can create as many individual partitions in it as you want. As for what's the exact difference between a primary and logical partition, I'm afraid I do not know.

Your screenshot makes it look like you're creating a custom partition. Assuming that's the case:

Create two partitions: one more than 7 GB for mounting the root filesystem, and another about 2-3 GB for your swap partition.
Create the root partition with ext4 filesystem and set the mount point to /.
And the swap partition as linux-swap.

If you want you can create another partition, around 4-5 GB, for as ext4 and mount /home on it. (This puts users home folders on a separate partition from the rest of the files on the computer.)


Messaging Menu Keyboard Shortcut In previous versions of Ubuntu, Super+M would open the messaging menu.  In 11.04, the Super key is captured by the launcher.  I have yet to find a way to quickly open the messaging menu from the keyboard.

As DoR said in the a comment, you can hit F10 , then hit the arrow keys to select the Messaging Menu.

Many good shortcuts are gone because Unity. Suggest to remap key in CCSM from "Meta" (or Super) to something else. Did that because of Gnome Do and some Compiz shortcuts


Network manager forgets wireless password after sleeping or powering off Every time I restore my computer from sleep or turn it on a window pops up asking for my wireless password. Once I enter it it connects successfully, but this happens every time. I'm using Ubuntu 11.10 with all updates installed. Shouldn't the password be remembered so you don't have to enter it every time I get on?

Anyone know why this is happening and how to fix it?

I had the same problem. To fix this. Go to your network connections. From there click on wireless tab. Choose your connection and then click the edit button. Make sure your password is entered then click on the wireless security tab. Then check the box in the bottom left corner that says available to all users. This is what fixed the problem for me.

I don't know how to fix that behavior but I do know an alternative method of security that's not as strong as the password but will still keep the many unwanted users off your network and not query you on every boot up. Set up MAC address blocking in your router and disable the password. Open up your browser and connect to the router. Frequently http://192.168.1.1, a router password will also be required. You'll then be able to look through the router's menu tree to find where it configures MAC address blocking. It's a good idea to set your router password to something other than the default. On my TRENDnet router the default password was "admin." You can find the correct IP and default password in the documentation that came with your router. If you can't find it you can download a new manual from the manufacturer.


How to get the MD5 hash of a string directly in the terminal? How do I get the MD5 hash of a string directly from the terminal?

For example, I want the string abcdefg hashed. Currently the md5sum command only accepts a filename as input. I want to simply enter the following line and everything be done with.

md5sum abcdefg
output: ac54bcf346e578feb46888b3ecd2344f

How can I achieve that?

You can also say something like this :

~$ echo -n Welcome | md5sum
83218ac34c1834c26781fe4bde918ee4  -

It basically does the same thing as described by @enzotib, but is perhaps a bit simpler.

For my case the best solution to hash a plain string is:
md5hash=$(echo -n "myhashedstring" | md5sum | head -c 32)

will result in 2e8f8b94e488a2f442a55951862612aa


How to prevent updating of a specific package? Because of bug #693758 I'd like to prevent apt-get upgrade and Update Manager from updating the "libgtk2.0-0" package.

How can this be achieved?

Holding
There are different ways of holding back packages: with dpkg, apt, dselect, aptitude or Synaptic.
dpkg
Put a package on hold:
echo "<package-name> hold" | sudo dpkg --set-selections

Remove the hold:
echo "<package-name> install" | sudo dpkg --set-selections

Display the status of all your packages:
dpkg --get-selections

Display the status of a single package:
dpkg --get-selections <package-name>

Show all packages on hold:
dpkg --get-selections | grep "\<hold$"

apt
Hold a package:
sudo apt-mark hold <package-name>

Remove the hold:
sudo apt-mark unhold <package-name>

Show all packages on hold:
sudo apt-mark showhold

dselect
With dselect, enter the [S]elect screen, find the package you wish to hold in its present state and press = or H. The changes will take effect immediately after exiting the [S]elect screen.

The following approaches are limited in that locking/holding a package within aptitude or synaptic doesn't affect apt-get/apt.
aptitude
Hold a package:
sudo aptitude hold <package-name>

Remove the hold:
sudo aptitude unhold <package-name>

Locking with Synaptic Package Manager
Go to Synaptic Package Manager (System > Administration > Synaptic Package Manager).
Click the search button and type the package name.
When you find the package, select it and go to the Package menu and select Lock Version.

That package will now not show in the update manager and will not be updated.

Occasionally one might want to hold back all the packages currently installed.  Here's how.

First save the current state, so you can undo:

dpkg --get-selections > current_selections.txt

Then, to hold back all the packages:

dpkg --get-selections | sed -r "s/\tinstall/hold/" |dpkg --set-selections

Finally, when you want to revert back to the previous state:

dpkg --set-selections < current_selections.txt

One use case for this might be when creating a VM or Amazon AMI snapshot to migrate from a QA to production environment.


Laptop battery critically low cannot remove notification I installed and used Linux for the first time - Ubuntu 18.04.01 LTS. My laptop's battery is almost dead sitting on 0% and the notification keeps popping every 5 minutes.

Is there any way to disable the notification?

tried dconf editor' tweeks set critical on -5 level instead of 0  but didnt work. i have read every other question here and didnt solve my problem .
also my latpop is a toshiba satelite p50-b which means battery cannot be unmounted

Here's a screenshot that might be useful:

sudo apt-get remove indicator-power

And reboot.

Open Settings and the click on the left side on Notification.

Now you can ether set off Lock Screen Notification or search under applications for Report a problem ... and disable notifications.


Remote connection from windows to ubuntu 20.04 I am new to Ubuntu. I have installed ubuntu 20.04 in my PC and want to remotely access it through windows on my laptop. I have successfully installed xrdp and it is working also. The only issue is that when I connect with my PC from my laptop, the interface is completely different and I am unable to see the applications which are running on my PC. I am able to see my files and folders but the terminal doesn't start neither does firefox. BTW, there is no icon for firefox. There is just a browser icon.
I ran a simulation in my PC but unable to see the progress.
Please help!!

Install NoMachine in your ubuntu pc and then you can access it from windows PC

I think that you connecting to a new session which is why you cannot see your running applications (simulation).  There may be a way to connect to your existing desktop with xrdp but I am not familiar enough with it to say.
If you want to see your active desktop I would look at running something like vncserver from your active session on your pc and a vncviewer on your laptop.


Applications not showing in Unity Dash I am running Ubuntu 12.04 on an IBM ThnkPad T42.  I just installed Gnome and Cinnamon but I am still using Unity.  The only problem is that in dash when I search for any application they don't appear.  I don't see recent applications either.  I fixed it by running unity --reset but the next time I turned on my computer it was broken again

Reinstall unity-lens-applications and unity-lens-files logged out and back in and it should work.

This command will restore the configuration of dash:

sudo dpkg-reconfigure -A

It should be working.


Can't connect to Internet via Ethernet wire I've instaled Ubuntu 16.04 yesterday, next to Windows7.
I am connected to router via Ethernet wire - it works fine on W7, but on Ubuntu I can't see any website, and can't ping anything.

WiFi connection works fine, but my room is too far from router. How can I fix this?

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 enp2s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enp2s0
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp2s0

cat /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

edit:

I've just observed that I can connect to Internet for about 45 seconds after pluging the Ethernet cable into my laptop. Ater 45 seconds there is no way to see any website again.

I also tried to update my drivers - didn't help.

Maybe this would be helpful:

piotr@Espadon:~$ sudo lspci | grep -i net
02:00.0 Ethernet controller: Qualcomm Atheros AR8161 Gigabit Ethernet (rev 08)
03:00.0 Network controller: Intel Corporation Centrino Wireless-N 2200 (rev c4)

There might be a problem with your network services. Try resetting them:
Open the terminal by pressing Ctrl+Alt+T and then type in: sudo service networking restart.
After the command has run, restart your machine, and it will reconfigure the settings upon restart.

However, there are issues whereby Ubuntu writes "Booting Up without full network config"...a second restart will do the trick.

If this doesn't work, and the problem continues to persist afterwards, open the command line and type in this:
echo on | sudo tee /sys/class/net/eth0/device/power/control

This should resolve it, and ethernet is bound to work afterwards.

Everything looks good, except one thing: You DEFINITELY need to fix your DNS.  replace that with

nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4

That way your router's DNS will be searched first, so if you want to use OpenDNS or something similar for site blocking you can.  After that, both of Google's Developer DNS servers will be searched.


How to install Eclipse? I want to install the latest version of Eclipse but the Ubuntu Software Centre contains an older version.

Is there a PPA or some other way to install latest Eclipse?
Please describe the steps for full installation.

If you've downloaded Eclipse from their official website, follow these steps for the installation.

Extract the eclipse.XX.YY.tar.gz using

tar -zxvf eclipse.XX.YY.tar.gz

Become root and Copy the extracted folder to /opt

sudo mv eclipse.XX.YY /opt

Create a desktop file and install it:

gedit eclipse.desktop

and copy the following to the eclipse.desktop file

[Desktop Entry]
Name=Eclipse
Type=Application
Exec=env UBUNTU_MENUPROXY=0 eclipse44
Terminal=false
Icon=eclipse
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse

and make sure that it has executable permission, then execute the following command to automatically install it in the unity:

sudo desktop-file-install eclipse.desktop

Create a symlink in /usr/local/bin using

sudo ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse44

For eclipse icon to be displayed in dash, eclipse icon can be added as

sudo cp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm

Don't forget that you need to have either OpenJDK or Sun Java installed to be able to run eclipse. Check this question for more information about Java installation.
Here is a simple example of installing Open JDK 1.6:

sudo apt-get install openjdk-6-jdk

Launch Eclipse and then give it the required permissions to modify the osgi file:

sudo chown -R $USER:$USER /opt/eclipse/configuration/org.eclipse.osgi

NB! You must launch Eclipse first, because the org.eclipse.osgi directory is created only after the first launch.

That's it.

I found it very easy to install from the repository. But because that is probably an outdated version, I also went to eclipse.org and downloaded from there; installing that is also very easy.

What you will get today, as of june 2016, is the eclipse Mars installer. Just save the download somewhere, untar with tar xvf bla...tgz, find the biggest file, i.e. eclipse-inst, file eclipse-inst will confirm that is an executable, and run it with ./eclipse-inst.

The installer gives you a choice of several kinds of eclipse. Choose one, and go ahead. After a few minutes you will see the button Launch, and you are running the recent version of eclipse.

I did not care about the dependencies, and everything just worked. I assume that by the previous install from the ubuntu repository, the JRE etc. are taken care of.

The only thing left is that the Ubuntu menu system only knows the outdated version from the repository. To start the new version, you would have to get to the executable in the location that is mentioned by the installer during the installation of the version you chose, most probably in a directory very near to that of the installer.

The easiest way to get the new eclipse in the menu system might be to use the ubuntu package classicmenu-indicator, enable the menu for Alacarte and use that to alter the icon for Programming/Eclipse to change the path from the old version from the repository to the new version from the download.


LPR on a Brother PT-P900 printer "Incompatible tape" with 12mm label The printer Brother PT-P900W does not print in linux with the Tape 12mm. It prints without problem with the tape 32mm. The error shown in the printer is "Incompatible tape".

Strange thing: on Windows it prints without any problems with both tapes.

Any idea on how to select the correct type in the lpr command on Linux?

Thank you.

Here  the commands (with text, pdf, and png) that I've tried until now without any success:

simone@simone-VirtualBox:~/Programs/qrcode-labels$ lpr -P PT-P900 -o PageSize=12x20 test.txt
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lpr -P PT-P900 -o PageSize=12x20 test.txt
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lpr -P PT-P900 -o PageSize=12x20 -o BrPriority=BrQuality test.txt
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lsusb
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lpr -P PT-P900 -o PageSize=12x12 -o BrPriority=BrQuality test.txt
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lpr -P PT-P900 -o PageSize=12x12 -o BrPriority=BrQuality back-label.png
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -p PT-P900 -o media=Custom.12x12mm back-label.png
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -P PT-P900 -o media=Custom.12x12mm back-label.png
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o media=Custom.12x12mm back-label.png
request id is PT-P900-32 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 test.txt
request id is PT-P900-33 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 back-label.png
request id is PT-P900-34 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 back-label.png
request id is PT-P900-35 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o media=Custom.12x12mm back-label.png
request id is PT-P900-36 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o orientation-requested=4 test.txt
request id is PT-P900-37 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o orientation-requested=4 back-label.png request id is PT-P900-38 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o scaling=50 back-label.png
request id is PT-P900-39 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o media=Custom.12x12mm back-label.png.pdf
request id is PT-P900-40 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o media=Custom.12x12mm back-label.png.pdf
request id is PT-P900-41 (1 file(s))
simone@simone-VirtualBox:~/Programs/qrcode-labels$ lp -d PT-P900 -o scaling=50 back-label.png request id is PT-P900-42 (1 file(s))

Looks like you have some installing to do. I wasnt able to find the specific LPR command, but it does look like you can access tape size by installing the Brother driver for linux Brother Linux utility/Drivers

Just do a CTRL+F and search tape in the page and you will see how to implement the option.

From the page: "The supported media length for continuous tape is about 100 mm.
Use the paper tool command to add a custom media size longer/shorter than 100mm.
For more information, see "Adding a custom media size for continuous tape (Linux)"."


Format thumb drive with unneeded bootable iso How do I erase/format thumb drives with installation iso on them? I saw a posting explaining this a few days ago, but I can't find it now.Does disk utility remove boot loader?Seemed to work on the one I formatted,but dont know how to verify.It shows a single empty partition now.Am I done?Dont have windows mackine to fix it on.Only Ubuntu 16.04.1

Follow these Steps:

In windows, open elevated command prompt (i.e. command prompt with admin privileges).
Type "disk part" in the elevated command prompt to open the disk partition utility.
Type "list disk" in the disk partition utility to display the available disk drives and find your usb drive number.
select your usb drive by using the command: "select disk"
for example if your disk is disk 1 then type "select disk 1".
It should say "disk 1 is now selected."
Type "clean"
Type "create partition primary".

That's it. done. your usb is now available to use.
Note that this USB will now be formatted and will not contain any data on it.

You can verify this by opening the disk management utility in windows. (to open just type "disk management" in search bar of windows 10 and open the "Create and format hard disk partitions" utility.

Your USB drive should be displayed as a single primary partition.


How can I change the default boot text (Ubuntu 14.04) to custom text? I am wondering how to change the text that displays "Ubuntu 14.04 . . . ." on boot to a custom text.

Edit: I am talking about the ASCII text during the boot process, not the Ubuntu logo.

I don't recommend it, but if you really need to customize the OS entry in the GRUB menu you just need to open (with sudo) the file /etc/default/grub and look for the line

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

You should replace

`lsb_release -i -s 2> /dev/null || echo Debian`

with the custom string you want.

Don't forget to run

sudo update-grub

after changing the file.


Upgraded to 13.10 now clock settings are all disabled and clock does not display I've upgraded to 13.10 and now I don't have the standard menu clock, which I need for work.

I checked and 'indicator-datetime' is installed.  I even uninstalled/reinstalled that applet with no luck.

Also my "clock" settings under System Preferences are all disabled.  I can't change anything.

Does anyone know how I can get the old menu clock back?

Alternatively is there another menu clock app I can download?

Edit 1

Thanks for the responses

I've restarted several times and that didn't fix the issue.
I just ran the 13.10 update today.  But I ran it again a few minutes ago.  I got   about 200KB in random updates.  The issue is still present after a reboot.
# apt-cache policy indicator-datetime
indicator-datetime:
Installed: 13.10.0+13.10.20131016.2-0ubuntu1
Candidate: 13.10.0+13.10.20131016.2-0ubuntu1
Version table:
*** 13.10.0+13.10.20131016.2-0ubuntu1 0
    500 http://us.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    100 /var/lib/dpkg/status

Edit 2

I believe the issue is related to 'rarings' changing the systray somehow...
http://www.omgubuntu.co.uk/2013/02/raring-retires-system-tray-whitelist

Or systray disappeared, although I haven't got that solution to work yet.

Edit 3

Because of a suggestion from RolandiXor I've check the binaries.  My system is missing 'libical.so.0' but it has 'libical.so.1'.

ldd /usr/lib/x86_64-linux-gnu/indicator-datetime-service
libical.so.0 => not found

Does anyone know how to get the libical.so.0 binary that the datetime service needs but doesn't install?

There's a bug report for that in Launchpad.

Quick fix:
Open terminal (ctrl + alt + T) and type

killall unity-panel-service

I had the same problem, (no clock displayed and settings disabled)
I had to select the default server for update in System Preferences.
Reboot, and the clock was back.


What is the terminal command to take a screenshot? What command(s) can I use in the terminal that's equivalent to the PrtSc (Print Screen) button?

I am running Ubuntu GNOME.

You can use import tool available in the ImageMagick package (you need to install this if its already not available on your system).

  Run the following command in a shell:

import screenshot.png

  and select the window you want to capture or select a region by pressing the left mouse button and dragging.

  import is a actually a very powerful command which can be used in many ways to capture the screen. For example, to capture the entire screen and after some delay and resizing it, use the following command:

import -window root -resize 400x300 -delay 200 screenshot.png

  To see all the options available with import command, go to ImageMagick’s website.

Another way to take a screenshot from the terminal is with scrot

To install
scrot type:

sudo apt-get install scrot

To take a screenshot in Linux from the terminal with scrot type:

scrot MyScreenshot.png

Some more options with scrot are here:

scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'

In this example,

-b specifies including the window borders
-d specifies a delay of five seconds
'%Y:%m:%d:%H:%M:%S.png' will save the screenshot with a name based on the current date and time and with the format specified, .png in this case
-e 'mv $f ~/Desktop/' tells scrot to save the screenshot to the Desktop

If you need just to peep into a remote computer via ssh, you can use this script.
#!/bin/bash
computer='JohnBrownsBody@10.0.0.11'
password='LiesAMoulderingInTheGrave'
path='/tmp/'
file='peepshow.png'

[ "$(whereis sshpass | cut -d: -f2)" == "" ] && sudo apt install sshpass
[ "$(whereis feh | cut -d: -f2)" == "" ] && sudo apt install feh

sshpass -p "$password" ssh $computer "export DISPLAY=:0; scrot $path$file;"
sshpass -p "$password" scp -r "$computer:$path$file" $path
# gpicview "$path$file"
feh "$path$file"
echo "... and his soul is marching on in $path$file! Peek at it!"


How should the files of a Flatpak application be removed? I installed an application using a command of the following form:

flatpak --user install -y --app --bundle "$DIR/Suphead.flatpak"

I uninstalled it using a command of the following form:

flatpak --user uninstall org.flatpaklinux.Suphead

However, after uninstall, I still see many files on the system associated with the application, files at all of the following sorts of directories:

/home/user/.local/share/flatpak/repo/refs/remotes/org.flatpaklinux.Suphead-origin
/home/user/.local/share/flatpak-linux/Suphead
/home/user/.local/share/flatpak-linux/Suphead/drive_c
/home/user/.var/app/org.flatpaklinux.Suphead

Should Flatpak not remove directories like these and their contents? Should I just do an rm -rf on them?

It's usual for package management tools to leave files in the home directory alone, so that user preferences, etc. are retained on reinstallation. You can choose to delete them if you wish, but I wouldn't expect flatpak (or any other software installation tool) to delete configuration files in my home directory. And that's what ~/.var/app is, looking at the example in the flatpak wiki:

.var/
└── app
    └── org.gnome.GEdit
        ├── data
        ├── config
        └── cache

~/.local/share/flatpak/repo/refs/remotes/org.flatpaklinux.Suphead-origin looks like it's part of flatpak's state, and it could be using it to track it what it had installed and where from (such data is also often kept around after package removal, and anyway they don't occupy much space). From the flatpak wiki:

  Flatpak uses OSTree to distribute and manage applications and
  runtimes. The repo/ in the above tree is the local OSTree repository.
  Flatpak creates the active/ directories of applications and runtimes
  as symlinks to OSTree checkouts (in the same directory). Using OSTree
  has the advantage that the checkouts are automatically deduped and
  share diskspace, since OSTree is using hardlinks and content-based
  addressing. OSTree also makes it easy to roll back to an earlier
  version, should the need arise.

refs/remotes/org.flatpaklinux.Suphead-origin looks very like something from a Git repo:

$ cat .git/refs/remotes/origin/master
73dad27c1c047c159f0ee22d6627af5bfdf4dbfc

If that is indeed the case, then that file just indicates which commit of the remote source was at the last time you fetched something from there.

If you think flatpak is taking up too much space even after removing an app, check the output of flatpak list -d --app --runtime to see what apps and runtimes are still installed and the space they take.

You can uninstall these by using the --unsed modifier.

  flatpak uninstall --unused

Ref:
http://docs.flatpak.org/en/latest/flatpak-command-reference.html?highlight=uninstall#flatpak-uninstall


Where does network-manager store WPA keys when "Available to All Users" is ticked? When you connect to a new SSID network via the network manager applet, the key for that network is stored in gnome-keyring under the "login" keychain.

But when you then change (edit) that network to be "Available to all users", the password moves somewhere else.  I'd like to know where, because if it's a PEAP network, that's effectively your Active Directory password.

Background
I tick most WIFI networks as "available to all users" not to actually make them available (it's a single-user laptop anyway), but rather to prevent anyone from seeing my password for that network in clear text simply by right clicking on the network, clicking on security tab and ticking "show password".  This is because when you make a network "available to all users", the act of editing that network triggers a system prompt via policykit.

This is the same reason I instantly un-install Seahorse after a fresh install.  Crazy security risk allowing this.

I don't have an wifi to check it right now, but according to http://live.gnome.org/NetworkManager/SystemSettings , system connections should be stored at /etc/NetworkManager/system-connections/ .

It is stored in /etc/network/interfaces and is not encrypted!


Is it possible to force the Unity launcher to hide? Or to toggle hide/unhide with a keyboard shortcut? I would like to manually control when the launcher is shown or hidden. Is it possible? There is no option to "never show launcher", nor have I found a way to force the launcher to hide.

If the launcher is set to auto-hide, with Super + e (mostly Windows + e) you can make the launcher show again. Havent found a way to hide the launcher through a shortcut though.

I use Cairo-Dock (not without its own set of problems) as it is far superior to the Unity launcher. What I have done for the moment is use compizconfig settings manager to enable auto-hide, in combination with the reveal mode set to 'None'. Now instead of popping up when I navigate to the edge of the screen it only pops up (annoyingly) when using 'find'.

Of course, I really would really rather just disable the launcher altogether. And compiz too, but gnome unfortunately does not support transparencies without compiz. And Unity apparently just doesn't work without the horrible launcher.


DNS_PROBE_FINISHED_BAD_CONFIG error in Ubuntu 14.04 I am running Ubuntu 14.04 LTS on my Dell M3800.

I am having problems connecting to the Internet.

I getDNS_PROBE_FINISHED_BAD_CONFIG in my browser when trying to navigate to any site, but I am able to navigate to any site by using its IP.

So, for example, I am able to navigate to google.com by using http://173.194.121.16. So I think somewhere my DNS settings got messed up.

Any pointer on resolving this issue is appreciated. Please, let me know if you need any more information.

So I figured out what the problem was. When I ran the following command sudo resolvconf -u I got this error:

/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf`

I solved this error by deleting /etc/resolv.conf and recreating the symbolic link. You can do that using the following commands:

sudo rm /etc/resolv.conf
sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
sudo resolvconf -u

This resolved the DNS error I was getting.

I had this problem when using NordVPN and using openvpn via terminal. I resolved this problem by importing VPN configuration file to Ubuntu Network UI. You can  go to Settings -> Network. There will be VPN section, press add and then import file. Choose one of the downloaded .ovpn files from NordVPN. Then when you try to connect it seems to automatically fix DNS issue for some reason. :)

Actually that's what I expected because sometimes UI solutions are more stable than running Terminal commands.


Ubuntu 18.04 LTS wifi problems Since I bought a new laptop, during already two years, I have endless problems with WiFi on my laptop (Lenovo Y50-70) on Ubuntu (16.04, 18.04).

Firstly, it always disconnects from connections, such as eduroam or any other enterprise connections. I tried maaany things to solve it, but none of them worked:

Change IPv6 to Ignore/Disable
Installing/reinstalling wifi drivers (I have broadcom wifi card)
Connecting to the specific access point (iwlist scan and choosing the best connection according to the signal strength)
Adding b43 to blacklist
Disabling Secure Boot
Using Wicd Network Manager
And many many other things found in stackoverflow or elsewhere...

My WiFI card details:

08:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4352 802.11ac Wireless Network Adapter [14e4:43b1] (rev 03)
Subsystem: Lenovo BCM4352 802.11ac Wireless Network Adapter [17aa:0623]
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 17
Region 0: Memory at d1600000 (64-bit, non-prefetchable) [size=32K]
Region 2: Memory at d1400000 (64-bit, non-prefetchable) [size=2M]
Capabilities: <access denied>
Kernel driver in use: wl
Kernel modules: bcma, wl

Now, I was trying to play with drivers etc... And endup with a biger problem. Now, when I connect to the eduroam I can use it for 5-10 minutes after it disconnects and never connects back, also all wifi connections disappears. In the syslog, on disconnect I caught this error: https://pastebin.com/FxP7PmPn
To connect again I need to unbind and bind again wl driver:

sudo rmmod wl

sudo modprobe wl

Maybe someone can explain why it happens to me? Is it possible to fix? I really tired of that for 2 years...

Some details:

Laptop: Lenovo Y50-70
OS: Ubuntu 18.04 LTS
I have dual boot with
Windows 10
I installed wifi drivers using command:

apt-get install bcmwl-kernel-source

If you need more details - let me know.

Also this (output from command rfkill list all):

2: ideapad_wlan: Wireless LAN
    Soft blocked: no
    Hard blocked: no
3: ideapad_bluetooth: Bluetooth
    Soft blocked: no
    Hard blocked: no
4: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no
11: phy3: Wireless LAN
    Soft blocked: no
    Hard blocked: no
12: brcmwl-0: Wireless LAN
    Soft blocked: no
    Hard blocked: no

Thank you for any kind of help.

UPDATE:
I bought TP-Link (TL-WN725N) wifi usb adapter and tried to use it with eduroam networks. I can confirm that the problem is still the same - it disconnects after some time and it's very difficult to connect again. I need to restart network-manager several times or unload and load r8188eu module. Of course, there are no errors in the syslog which I posted above, but still...

FINALLY. I can confirm that since two years I finally fixed my wifi problem. The solution was actually super easy and near to me: I had to change REGDOMAIN in crda (I had there different country code):

sudo -H gedit /etc/default/crda
REGDOMAIN=<YOUR COUNTRY CODE>
reboot (mandatory!!)

You can take your country code from here.

To sum up, I'm using bcmwl-kernel-source wl driver for my Broadcom BCM4352 card. (good info/tutorial about it is here). I still receive sometimes those errors and have few small timeouts for ~1 second (no disconnects!), but I think it's natural and it doesn't bother me compared to what I had before...

I am not exactly a programmer. Meaning I do not write code. But I have had this wi-fi disconnect problem for over a year using Ubuntu 18.04 I tried every fix on the Internet. Nothing seemed to work for long. I was also trying to extend the timing for the sleep mode.

So I went to settings. Under POWER I set the Blank Screen to NEVER. Not knowing what I was doing, I set the Turn Off WIFI to Save Power to OFF. I also turned off the Bluetooth. Well as you guessed, I had no WIFI. SO I went back to Settings and set the Turn Off WIFI to Save Power to ON. I got no idea what that did, but the WIFI has been on for over a half hour with no disconnect.

Maybe the Bluetooth had something to do with it. Anyway, I was also tired of my phone trying to connect to the Laptop when the Laptop was shut down. And the phone taking 5 minutes to connect to my headphones. I'll give this a few days and check back later.


Recovering package metadata info From the console, is there a way to recover the architecture of a package when it is not currently installed ? I know the name and version of the package.

If you mean getting the information for a package, you can only obtain it if is still available from the APT cache, to get it from a terminal run:

apt-cache show packagename

To only show the architecture use grep

apt-cache show package_name | grep Architecture

# Or for the lazy typist
apt-cache show package_name | grep Arch

Apart that usually the name of a package includes also its architecture, e.g. in
tar_1.23-2ubuntu1_amd64.deb you see that is for x86_64 (amd64),
anyway you use use the command "dpkg --info ".
Among various fields, there is also Architecture. E.g.

$ dpkg --info tar_1.23-2ubuntu1_amd64.deb | grep Architecture
Architecture: amd64


Apache error "Could not reliably determine the server's fully qualified domain name" When I restart my Apache server using the command

sudo /etc/init.d/apache2 restart

I get the following error:

Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2:
Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Is the server using 127.0.1.1 instead of 127.0.0.1? What causes this error?

6# 13.04 and older

This is just a friendly warning and not really a problem (as in that something does not work).

If you go to:

/etc/apache2/apache2.conf

and insert:

ServerName localhost

and then restart apache by typing into the terminal:

sudo systemctl reload apache2

the notice will disappear.

If you have a name inside /etc/hostname you can also use that name instead of localhost.

And it uses 127.0.1.1 if it is inside your /etc/hosts:

127.0.0.1 localhost
127.0.1.1 myhostname

Preferred method

  Troubleshooting Apache

If you get this error:

apache2: Could not determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName

then use a text editor such as "sudo nano" at the command line or "gksudo gedit" on the desktop to create a new file,

sudo nano /etc/apache2/conf.d/fqdn

or

gksu "gedit /etc/apache2/conf.d/fqdn"

then add

ServerName localhost

to the file and save. This can all be done in a single command with the following:

 echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

But on Ubuntu 14.04:

 echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
 sudo a2enconf fqdn

Don't forget the ".conf" (without will not work).

On Ubuntu 11.10, I saw this message, along with a hung boot occurring because my disk was full.  One of the log files had gone rogue.  Probably there was not actually a problem with Apache, but this message was the last clue given before the boot hung.

To fix the problem, I had to boot into recovery mode and remove the wayward log file.


Install PHP 5.3 on Ubuntu 13.04 How I could install an old PHP version on Ubuntu 13.04 (Raring Ringtail) -preferably version 5.3.3?

You can install php as usual, which will install 5.4, then use
this script to downgrade it to 5.3:

http://www.ubuntugeek.com/how-to-downgrade-php-version-from-5-4-to-5-3-in-ubuntu-12-10-quantal.html

Procedure to follow

First you need to download the shell script from above link.

Once you have php5_4_downgrade_5.3.sh file you need to change the permissions using the following command

sudo chmod 755 php5_4_downgrade_5.3.sh

Now you can run the script using the following command

sudo sh php5_4_downgrade_5.3.sh

Follow the on screen instructions
It worked on Rackspace cloud Ubuntu 13.04 today!

There is a page with unsupported previous PHP versions here. I suppose that there is a README in the tarball with instructions.


Generate white noise to calm a baby I have a three week old baby. Occasionally she refuses to sleep. Some people tell me this is the way life is, some people tell me I need to buy things to fix it. This is becoming an alarmingly common pattern in this parenting game.
Anyway one of these things "I need to buy" is a white noise generator. White noise defined as:

a random signal is considered "white noise" if it is observed to have a flat spectrum over the range of frequencies that is relevant to the context. For an audio signal, for example, the relevant range is the band of audible sound frequencies, between 20 to 20,000 Hz.

There are several things I can buy. Apps for Android, dedicated boxes that I'm sure just play a tiny clip of pre-generated noise, all the way to mega-expensive true-random white noise generators.
I want to generate my own white noise sample
I know I could download one with youtube-dl from one of the many videos out there but copyright aside, frequency compression is horrible online I want full-white-frequency goodness. If such a thing actually exists. Plus I'm a glutton for punishment and I believe that if something can be done via the command line, that's the way we should be doing it. That's how I aim to raise this one anyway.
So we have things like /dev/urandom and paplay. Is there a sensible way to take random data and channel it into the audible range of white noise and out of my speakers? Answers that write to file are okay too. The important thing is a steady range-confined sample. No squawks.
Note: answers that generate the brown note will not be appreciated ☹

Use the Swiss army knife for sound generation, SoX.

You install it from the official repositories, simply by typing:

sudo apt-get install sox

Updated, fancy answer (pleasing ocean waves):

After experimenting a bit with SoX, I came up with this great command which imitates the soft murmur of the sea with its soothing sound of waves that flow over a flat sandy beach on a sunny summer day...

Well, enough poetry, here's the command. Listen yourself.

play -n synth brownnoise synth pinknoise mix synth sine amod 0.3 10

Explanation:

This command first generates and mixes brown noise and pink noise, which I find to be the most comfortable and natural noise. Then it generates a sine wave of 0.3 Hz with an offset of 10% and uses this to modulate the amplitude of our mixed noises to produce the sound of ocean waves.

Modifications:

Timer:
You can add a timer and limit the playback duration by specifying the number of seconds, the number of minutes and seconds (mm:ss) or the number of hours, minutes and seconds (hh:mm:ss) right before brownnoise. Here's an example for one hour:

play -n synth 1:0:0 brownnoise synth pinknoise mix synth sine amod 0.3 10

Wave frequency:
If you want the waves to hit the beach more or less frequent, simply change the frequency of the sine wave used for amplitude modification (0.3 in the above command). The number represents the amount of waves per second, so a frequency of 0.1 Hz will cause 0.1 waves per second and therefore make one wave last for 10 seconds:

play -n synth brownnoise synth pinknoise mix synth sine amod 0.1 10

Minimum background noise volume:
The sine that is used for amplitude modulation got shifted to an offset of 10%, so the brown-pink noise will always be played with at least 10% volume. If you want a stronger or weaker background noise, increase or decrease this offset to your needs. Here's an example with 20% background noise:

play -n synth brownnoise synth pinknoise mix synth sine amod 0.3 20

Old, boring answer (plain white noise):

Now the easiest command to play white noise infinitely (until you abort it with Ctrl+C) is this:

play -n synth whitenoise

If you prefer a time limit, you may add that in the format hh:mm:ss. The following command would make noise for one and a half hour, for example:

play -n synth 01:30:00 whitenoise

It even shows you some nice stats while "playing":

$ play -n synth 00:00:05 whitenoise

  Encoding: n/a
  Channels: 1 @ 32-bit
Samplerate: 48000Hz
Replaygain: off
  Duration: unknown

In:0.00% 00:00:05.12 [00:00:00.00] Out:240k  [!=====|=====!] Hd:0.0 Clip:0
Done.

There's also Renoise, a very powerful multi-platform audio sequencer, though the full version is commercial. The demo version however doesn't have many limitations, and will let you do what you want, and add filters, effects, etc. to the generated sound.

http://www.renoise.com

True white noise with a lowpass filter, and maybe some chorus and reverb added for a nice natural effect, would sound quite pleasing.


Flash plugin error on Ubuntu 16.04 I have updated my Ubuntu to 16.04 a couple of days ago and now the Flash Player does not work with Chrome browser.

sudo apt-get install adobe-flashplugin

Result

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  adobe-flash-properties-gtk
Suggested packages:
  x-ttcidfont-conf msttcorefonts ttf-xfree86-nonfree xfs
The following NEW packages will be installed:
  adobe-flash-properties-gtk adobe-flashplugin
0 to upgrade, 2 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/10.4 MB of archives.
After this operation, 38.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 1425767 files and directories currently installed.)
Preparing to unpack .../adobe-flashplugin_1%3a20160712.1-0ubuntu0.16.04.1_amd64.deb ...
Unpacking adobe-flashplugin (1:20160712.1-0ubuntu0.16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/adobe-flashplugin_1%3a20160712.1-0ubuntu0.16.04.1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/icons/hicolor/24x24/apps/flash-player-properties.png', which is also in package flash-plugin 11.2.202.346-1
Preparing to unpack .../adobe-flash-properties-gtk_1%3a20160712.1-0ubuntu0.16.04.1_amd64.deb ...
Unpacking adobe-flash-properties-gtk (1:20160712.1-0ubuntu0.16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/adobe-flash-properties-gtk_1%3a20160712.1-0ubuntu0.16.04.1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/flash-player-properties', which is also in package flash-plugin 11.2.202.346-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/adobe-flashplugin_1%3a20160712.1-0ubuntu0.16.04.1_amd64.deb
 /var/cache/apt/archives/adobe-flash-properties-gtk_1%3a20160712.1-0ubuntu0.16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

update

I do not know what had happened but I am not able to play video content with chrome browser after upgrade to 16.04. Everything was working fine before update. I can see a "could not load plugin" error.

Are you using Chromium? Because Google Chrome does include Flash Player by default, Chromium does not. If you don't want to do that much with commands and terminals, I'd recommend to download Google Chrome from Google their official download page, and then double-clicking it to open it up with the Software Center. Or you could use the dpkg command in order to install the package.

Chrome browser does not use the flash plugin you're trying to install at all, so you may as well uninstall it completely.  Chrome browser uses Pepper flash and it's embedded in the browser.  It gets installed during browser installation.  If it doesn't work, you have to check what's wrong with Chrome installation.

You can reset your Chrome installation to default settings for example by deleting these two directories using a terminal window:

rm -R ~/.config/google-chrome
rm -R ~/.cache/google-chrome.

If this doesn't work, you may need to re-install Chrome.


How can I tell what date Ubuntu was installed? is there a command which will output the date that ubuntu (or any distribution) was installed?

You can check the installer logs and dates at:

/var/log/installer

A quick way to find the date through the command line would be by running:

ls -lt /var/log/installer

That lists in reverse chronological order so the oldest file is at the bottom of the list.

I don't think there is.

On Red Hat / CentOS there is the install.log files that is generated when you install the system, but this doesn't exist on Ubuntu.

Assuming your logs go back far enough ( mine do ) you can determine the date the base installation was done in /var/log/dpkg.log*

For example on my system the first two lines of my oldest dpkg.log file (dpkg.log.4.gz) are

2010-04-19 11:40:55 startup archives install
2010-04-19 11:40:55 install base-files <none> 5.0.0ubuntu18

So I installed this system on 19/04/2010 at 11:40:55. That is correct for this system.

There was also a brainstorm idea to add this born date.


Distribution upgrade: what is likely to break? I'd like to upgrade my distribution (10.04 to 10.10) and since I have customized Ubuntu quite a bit, I was wondering what is likely to "break".

If that can help, here is a sample list of things that I have customized (although I'd like a general answer):

Gnome panel
Keyboard shortcuts
SSHd config
Apache + config
Nautilus (added some plugins)
Compiz config
etc.

A distribution upgrade will, in all probability, not change any of your configuration.

In rare cases, it can overwrite configuration some files in /etc, but never in your home directory. Make sure to back up all configuration that isn't easily restorable. Of course, you should always back up everything.

In case any configuration does break, don't restore your backed up configuration files. Use them as a guide to re-configure what ever software.

To rule out any incompatibilities, it's recommended that you try out the new version via a live CD. Even though it would be surprising.

I agree with DKuntz2's recommendation to back up, however - I disagree with his recommendation to restore. Restoring old configuration will cause problems at some point. The upgrade process is very smart about preserving your data while upgrading programs. They, in turn, are very smart about handling old data. The will do the best they can with your customisations and changes.

Here's how to proceed:

Back up all your data, as you normally would.
Read the Release Notes. Especially check the Known Issues section for regressions.
Try out the new version with a live cd or live usb image.
Use the provided methods to upgrade, that is hit Alt+F2 and type do-release-upgrade, do not change your source.list file, this will result in partial upgrades, leaving old version of software on your system instead of upgrading them.

One important note though: If you have used anything like Automatix or EasyUbuntu, that is any repositories that are unsupported and not recommended, all they have done may very well break. Remove this software before upgrading, to be safe. (ref)

Please consult any of the sysadmins here on Apache, or just back it up completely. I'm pretty confident in sending you off to upgrade, very much assuming that your recovery plan won't be needed, but I can't be so confident about Apache. I've just never used it.

Copy your home folder (the whole thing, including the hidden files) to another drive/partition, than upgrade, than replace the newly created home folder with the copy. This will keep your files and settings intact. Now all you need to do is install your new applications (actually, you might want to install the applications first because I don't know if newly installed apps will replace the old settings folders).

This should keep most of your customizations in place, minus apache (I don't know where that's kept), and possibly sshd (same reason).

This is why lots of places suggest keeping your home folder on another partition, so you can easily update everything, but leave your home folder intact (just switch the location later).


How to make txt, csv and pem files read and writable only by root with sudo previliges? I have some files inside a folder with various formats like .txt, .pem, .csv and .json.
I want only sudo/root to be able access them. I have done
chmod 700

and
chmod 600

on each of those files. But, I can still print the private key of my .pem files by doing cat on terminal without sudo privileges and open .json files from the file system in "gedit".
What has gone wrong? How do I not let anyone access the contents of those files?

Suppose your file is named example.txt. Then:
$ sudo chown root: example.txt
$ sudo chmod o-rwx example.txt

should do the job.
If you want an entire directory exampledir to be accessible only to root:
$ sudo chown -R root: exampledir
$ sudo chmod -R o-rwx exampledir

Make sure that the owner of the file is root and set the permissions.
Eg filename 'test.txt'
Run the following command
sudo chown root:root test.txt
sudo chmod 700 test.txt


Why doesn't this custom static IP network configuration work? I installed Ubuntu server 12.04. I configured my network like this:

auto eth0
iface eth0 inet static
address 121.127.36.164
netmask 255.255.255.0
network 121.127.36.0
broadcast 121.127.36.255
gateway 121.127.36.1
dns-nameservers 208.67.222.222 208.67.220.220

with these configurations, I cannot connect to internet.

Whenever I do

ping www.google.com

it just waits. When I do

ping 77.245.149.23

or any other IP, it returns unreachable host error. Could you please help me fix this error?

Edit: I can ping the IP from my network. My modem is set to DHCP enabled dynamic IP.

Edit 2:
Sorry for my late explanations, but I must firstly explain the scenario:

There is a company with 20 staff. I developed a web application with PHP/CodeIgniter for them. Where they want to use it inside their local network.

I install an Ubuntu server 12.04, and want to make it a local server for this purpose. I need to assign a static IP address for this server, where it musnt changed.

I have a TP-Link Wireless Router, where the internet connection is provided through this router. It is DHCP enabled.

Now for this, what I need? How I must configure my server?

I solved my problem like this: I reserved an IP address to my server MAC address from my Router interface and it worked perfectly. Thanks for the guys here which they helped me solve my problem.

Also, thank you all too.

For safety, it is generally a good practice to have a non routable ip address for an internal LAN and then have a second adress for connecting to the Internet.

There are a series of three non routable addresses that are available:

10.0.0.0 - 10.255.255.255,
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255.

Getting back to your initial question, I would check the contents of /etc/resolv.conf which is where the computer will indicate addresses of a namseserver or nameservers.