Whole computer freezes randomly when playing using Wine

My best guess is that the crash is probably graphics related, so you should try to run with another driver (the open-source driver - even though it is slower) to confirm this theory.


Install CUDA for Ubuntu
There is an Linux installation guide. However, it is basically only these steps:

Download CUDA: I used the 15.04 version and "runfile (local)". That is 1.1 GB.
Check the md5 sum: md5sum cuda_7.5.18_linux.run. Only continue if it is correct.
Remove any other installation (sudo apt-get purge nvidia-cuda* - if you want to install the drivers too, then sudo apt-get purge nvidia-*.)

If you want to install the display drivers(*), logout from your GUI. Go to a terminal session (ctrl+alt+F2)
Stop lightdm: sudo service lightdm stop

Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0

Then do: sudo update-initramfs -u
sudo sh cuda_7.5.18_linux.run --override. Make sure that you say y for the symbolic link.
Start lightdm again: sudo service lightdm start
Follow the command-line prompts

See also: NVIDIA CUDA with Ubuntu 16.04 beta on a laptop (if you just cannot wait)
Notes: Yes, there is the possibility to install it via apt-get install cuda. I strongly suggest not to use it, as it changes the paths and makes the installation of other tools more difficult.
You might also be interested in How can I install CuDNN on Ubuntu 16.04?.
*: Don't install the display drivers with this script. They are old. Download the latest ones from http://www.nvidia.com/Download/index.aspx
Verify CUDA installation
The following command shows the current CUDA version (last line):
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sun_Sep__4_22:14:01_CDT_2016
Cuda compilation tools, release 8.0, V8.0.44

The following command shows your driver version and how much GPU memory you have:
$ nvidia-smi
Fri Jan 20 12:19:04 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.57                 Driver Version: 367.57                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce 940MX       Off  | 0000:02:00.0     Off |                  N/A |
| N/A   75C    P0    N/A /  N/A |   1981MiB /  2002MiB |     98%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0      1156    G   /usr/lib/xorg/Xorg                             246MiB |
|    0      3198    G   ...m,SecurityWarningIconUpdate<SecurityWarni   222MiB |
|    0      6645    C   python                                        1510MiB |
+-----------------------------------------------------------------------------+

See also: Verify CuDNN installation
Help! The new driver does not work!
Don't panic. Even if you can't see anything on your computer, the following steps should get you back to the state before:

Press shift during startup
Go into a root shell
Make it writable by running mount -o remount,rw / (- is ? and / is - in the american layout)
sh cuda_7.5.18_linux.run --uninstall
sudo apt-get install nvidia-361 nvidia-common nvidia-prime nvidia-settings

Graphics drivers
Installing the graphics drivers is a bit tricky. This has to be done without graphics support.

Log out from your current X session.
Ctrl+Alt+F4 (you can switch back with Ctrl+Alt+F7)
You should remove all other drivers before.

Search for them via dpkg -l | grep -i nvidia
Remove them via sudo apt-get remove --purge nvidia-WHATEVER

Stop lightdm via sudo service lightdm stop
You might need to reboot your pc / blacklist the nouveau driver (German tutorial)


59.79 is really 60. Sometimes refresh rates are off of 60 by a tiny bit, but it shouldn't matter. Any visual fatigue you're experiencing could be fixed by using a different desktop environment, such as GNOME, MATE, KDE, or LXDE. You could also try using a background with slightly dimmer colors.

However, I feel that eye fatigue is somewhat subjective. If you experience it while using your computer, I recommend maybe seeing an eye doctor or taking a break from the screen for a while. There really isn't a catchall fix (and I've honestly never heard of anyone complain of this before), but here are some more things you can try:

F.lux -- Puts a yellow tint over whatever the computer is displaying - good at night.

Lower your screen brightness -- Ubuntu might actually make your screen brighter than Windows or something weird like that.

Suggestion from hbdgaf: If you have a webcam, you can try this program, which adjusts your screen brightness automatically based on the amount of light your webcam sees. For people that have a problem focusing on two different lighting conditions, this problem would happen mostly at night/in dark surroundings.  Darker colors do the same thing.  Dull the differential between your screen and the background.

I said it before, but a different desktop environment really might help. GNOME and MATE both use darker colors than Unity.

Increase your font size. Maybe your computer's font is too small. Refer here for more info.

Hopefully one of those helps. Since it's really a problem with your eyes or configuration, we can't provide a definitive answer.


download this windows installer from http://www.ubuntu.com/download/desktop/windows-installer?distro=wubi&release=&bits= install it on your windows 7 restart your system it will ask for os selection windows 7 or ubuntu click ubuntu....enjoy linux..


I accidentally deleted all my data with `dd`. Any chance of recovery?

dd is a whole lot worse than rm or any other mechanism that just marks blocks in the filesystem as available. dd does verbatim reads and writes on the disk or partition, thus by overwriting it not only deletes files on the filesystem but destroys information on the filesystem how the data was organized and the filesystem itself. While some data structures like EXT superblocks have some redundancy this does not allow to recover overwritten data.

Dependent on the behavior of dd, that is if it filled the remaining space of the partition with zeros and was let to finish the task, consider all data on the partition lost.

There is this myth that you still have to overwrite data several times to make data recovery almost impossible. The recovery techniques this is based upon are not applicable to modern disks and Peter Gutmann is cited in one of the answers with:

  Any modern drive will most likely be a hopeless task, what with ultra-high densities and use of perpendicular recording I don't see how MFM would even get a usable image, and then the use of EPRML will mean that even if you could magically transfer some sort of image into a file, the ability to decode that to recover the original data would be quite challenging.

More over the typical suggestion to make a raw copy of the disk and use the copy for recovery attempts is misleading. With failed drives that may be a possible solution, but also puts a lot of stress on the drive which may be counter productive. In your dd-scenario though this is different and looks like a quite moronic approach. Recovering data that was overwritten with dd by creating a copy with dd for further recovery approaches? That shouldn't give you anything else than what dd previously wrote, right? Now of course if you want to prove that Peter Gutmann's or more advanced methods still work with newer drives, you only want to read from the source drive and don't write to the drive to prevent further overwriting of data.

Honestly, trying to recover all data will be almost impossible, waste a lot of time and bind resources (the drive cannot be used and the computer must continue the recovery process) that you could have easily avoided by creating backups and being more careful with such dangerous commands.


No installer icon in Desktop when customized Ubuntu 10.10 using Remastersys

The install command should still be the forth item down in the Admin menu.  Remaster doesn't pick up anything from the desktop but the command should still be in the menu.


How to fake location(latitude and longitude) in Ubuntu 20.04

In Chrome, you can use the following instructions to spoof your location:

In a browser window, hit Ctrl+Shift+I
This will open the Chrome Developer Tools window.
Open menu (three vertical dots) - More tools
Select Sensors and change the Geolocation dropdown to Custom location…
Enter any latitude and longitude you want.

Alternatively, you can choose one of the preset options in the Geolocation menu, including Berlin, Mumbai, or San Francisco.
Note that for the location override to work in Chrome, you have to keep the developer tools open and stay in the same browser window. If you open a new window, it will revert back to your original location.
There's also a way to do it in Firefox : see this site : https://www.comparitech.com/blog/vpn-privacy/change-location-chrome-firefox-spoof/


12.04 Ubuntu install failure or hardware issue?

Try and format your disk in the Bios... And install Ubuntu from a CD/DVD or USB-bootable. This way you are surtain that the old OS is uninstalled.

Update: In your PCs Bios the formatting option should be under security/Disk Sanitizer.

Here's a link providing step by step instructions on how to wipe your HDD outside of windows:

How to Wipe a Hard Drive

So I've been searching the net for an answer regarding your error message above and found this:

Grub Loading stage1.5Read Error


Looks like either a reset of UEFI to defaults or an update to UEFI reset it to defaults. And then RAID is the default. With Ubuntu you need to change RAID to AHCI. And if dual booting with Windows add AHCI driver before changing.

You show this:

[ 6.703789] ahci 0000:00:17.0: Found 1 remapped NVMe devices.
[ 6.703790] ahci 0000:00:17.0: Switch your BIOS from RAID to AHCI mode to use them.

Note that Windows updates, UEFI update and now with some systems even an UEFI update from Ubuntu may reset some UEFI settings. I like to keep a list and if I notice change or update,  or have issues, I double check that settings are what I expect.

UEFI systems that now support update from Linux.

https://fwupd.org/lvfs/devicelist

https://fwupd.org/vendorlist


I get two icons instead of one when adding some apps to the favourites

From the output of gsettings get org.gnome.shell favorite-apps, it seems it's just a graphical glitch. Simply logging out and reloggin-in should fix it.

As a simple alternative of re-logging in all the time, you may restart the GNOME shell instead. To do that, press Alt+F2, then type r, and finally press Enter.


Restricting on-the-fly editing of grub2 menuentries

On Ubuntu 18.04 it started to work after I added

GRUB_DISABLE_SUBMENU=y

to /etc/default/grub. So essentially the steps are:

Generate password with:

grub-mkpasswd-pbkdf2

Copy the following lines to the end of /etc/grub.d/40_custom and replace the password with the password from the output above. This will password protect grub completely:

set superusers="grubadm"
password_pbkdf2 grubadm grub.pbkdf2.sha512.10000.D23193A0BE80A8D94606716D2DBE18C1AC77563FD87B7DA41824467E9393EBFFAF8B909DFAD83293325016EF6DA112EBAC819B3196F2D9F764F56E037E4EB86A.78AAD14971909106B4BE80AB6BF704804E67D5486966D9A85289E5449F08BD54E55B83B28CF0A4F2B4D486F2136439B7786135B8D59C611BF9DE2CDE965DB791

Allow selection of boot entries for different kernel versions. edit /etc/grub.d/10_linux and

Insert --unrestricted after ${CLASS} in the line echo "menuentry '$(title "$os" [...] in function linux_entry in /etc/grub.d/10_linux, e.g.

echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} --unrestricted \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"

Insert  --unrestricted after ${CLASS} in the line ´echo "menuentry '$(echo "$os" [...]in function linux_entry in/etc/grub.d/10_linux`, e.g.

echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} --unrestricted \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"

Add the following line to /etc/default/grub

GRUB_DISABLE_SUBMENU=y

Rebuild grub conf file by executing

update-grub


building monolithic kernels will improve performace of the system ?

A pedantic note: "monolithic kernel" means something completely different. Linux kernel is always monolithic, regardless of whether some or all of its modules are built as LKMs or compiled directly into the kernel.

http://tldp.org/HOWTO/Module-HOWTO/x73.html#AEN77

When LKMs are loaded into the kernel, there's absolutely no difference in performance compared to built-in modules as LKMs code runs in the same process as the rest of the kernel, there's no inter-process communication or anything.

  LKMs are not slower, by the way, than base kernel modules. Calling
  either one is simply a branch to the memory location where it resides.

However, LKMs can be loaded upon request, so if you take the stock-standard Ubuntu kernel and recompile it with all modules built-in, you'll get a humongous kernel which probably will slow the system down because of using much more RAM for all those unused modules (which possibly will also cause all sorts of conflicts with each other).

On the other hand, if you compile a kernel which is custom-tailored to your particular machine and only has the modules for the actual machine's hardware built in, such kernel will likely to be faster than the stock-standard kernel, especially at boot time. I've been playing with a custom kernel for my EeePC on Arch Linux and can report that it's actually noticeably faster:

the kernel can be made very slim, including only features your machine actually uses. The whole kernel-eeepc thing is just 4Mb, which makes it faster to load from disk and it uses less RAM when loaded, leaving more memory for user-space programs.
no modules to load means less disk I/O during boot.
having hardware drivers built in means no need for hardware probing during boot, which saves time.
Built-in hardware drivers eliminate the need in the initial ramdisk, so the kernel can be loaded directly by GRUB.
you can disable other kernel features you don't need, which again shrinks the kernel size and make it faster.

The downsides, however, are:

Automatic kernel upgrades become useless, you have to build new kernels from source
If the machine dies and you plug the disk into another computer the machine probably won't boot.

All in all, this is a fun and educational exercise but not something I would consider doing on a machine which is not too hardware-restricted.


As of "Evince" version 3.10.3 (that is Ubuntu 14.04) it is possible to do this with "Evince" and that is installed in a default install. It is called "document viewer" if you want to search for it. "evince" to start from command line.
From gnome.org on filling forms:

Forms
When filling out an interactive form, you can navigate from field to field by clicking on a field with your mouse. When you are finished filling out a text field, press Enter.
You can make a selection in a scrollable list box by clicking on the list box and scrolling to your choice with your mouse.

Regarding the question:

Why does Ubuntu not ship with a way to fill in PDF forms?

It does as shown above but in general software might not be included due to legal reasons. Software that can open and manipulate a PDF that has some sort of restriction in it would cause a legal problem for the maintainer of that operating system: it would require paying a fee for allowing to circumvent it (same as with audio and video codecs: those are not shipped with Ubuntu but can be added afterwards).


Where can I find a package for "project looking Glass"? ("The Java desktop")

Found this link for some source and additional info: http://java.net/projects/lg3d/

You can get the software by using subversion

sudo apt-get install subversion

Enter the command:

svn co https://svn.java.net/svn/lg3d~svn


Katoolin tools borked spotify: how to uninstall?

Warning about updates after installing Kali linux tools
The LionSec Katoolin GitHub webpage clearly warns Katoolin users to be careful when updating software.

Before updating your system, please remove all Kali-linux repositories to avoid any kind of problem.

All kinds of problems can occur if you don't do this.

The Katoolin script is the cause of some of your problems. You don't need the repositories that the Katoolin script added anymore, so restore your sources.list file in /etc/apt/sources.list back to the default for a fresh installation of Ubuntu 18.04.

Make a backup copy of sources.list.
 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

Open /etc/apt/sources.list for editing in nano text editor:
sudo nano /etc/apt/sources.list

Replace the entire contents of your existing sources.list with the following default 18.04 sources.list:
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu bionic partner

Press the keyboard combination Ctrl+O and after that press Enter to save the file being edited. Press the keyboard combination Ctrl+X to exit nano.

Run this command after changing sources.list to refresh the list of available software. This is the most important step, so please don't skip it.
sudo apt update

After running the above commands the package management in your Ubuntu 18.04 should go back to normal.

Spotify
You got the following error message:
Gtk-Message: Failed to load module "gail" Gtk-Message:
  Failed to load module "atk-bridge" (spotify:15787):
Gtk-WARNING: cannot open display: :0

It looks like the Spotify snap package might work again after switching the channels. Run the following command to switch the spotify snap package's channel:
sudo snap switch spotify --edge


How to fix graphical issues with Skype, Gdk-WARNING?

Got this problem with 2 simultaneous PyCharms running. So closing them is not a reasonable solution for me.
Using raus81's advice edited skype dash link:

sudo gedit /usr/share/applications/skype.desktop

change

Exec=skype %U

to

Exec=env "QT_X11_NO_MITSHM=1" skype %U


Install common Sound card drivers and needed packages in Ubuntu.

sudo apt-get install build-essential linux-headers-`uname -r` alsa-base alsa-firmware-loaders alsa-oss alsa-source alsa-tools alsa-tools-gui alsa-utils alsamixergui


Before going in to this, according to the README in juju-core:

  Note that the use of --upload-tools forces the instances to run with the same
  series and architecture of your development system.  Currently the only
  supported architecture that can be deployed is amd64, so you must develop on
  64-bit machines.

If you do not have an amd64 machine, or are trying to compile for i386, ARM, etc these steps will likely not work.

Setup Dependencies

The following packages are required to build juju-core:

sudo apt-get install build-essential bzr zip git-core mercurial golang-go

The golang-go package will prompt you about anonymous usage statistics and if you wish to opt-in. Select Yes or No depending on your interest.

After installation you'll need to create a GOPATH, which is what go will use for downloading and compiling dependencies. You can set this to any directory you choose, for example ~/go. You can read more about gopath with go help gopath

export GOPATH=${HOME}/go
mkdir -p $GOPATH

Then prefix or append GOPATH to your PATH. It's recommended you prefix your PATH as it'll give you your compiled version by default. You'll still be able to access other installed versions of Juju, though you'll have to use an absolute path to access them. If you do not wish to have GOPATH in your path, you can bypass this step.

PATH="$GOPATH/bin:$PATH"

Building & Installing

Once your environment is setup, build juju-core is a relatively straight forward process. You'll first need to get the latest code for juju-core in a manner that go will know what to do with. Simply run the following command to fetch the latest source:

go get -v launchpad.net/juju-core/...

This will have go fetch juju-core and the source of all dependencies. Finally, to build juju-core run:

go install -v launchpad.net/juju-core/...

This should take a few seconds to complete. Once finished you can verify juju compiled properly by running which juju if you prefixed your PATH with GOPATH. If not you can verify it's installed with $GOPATH/bin/juju version which should report the current compiled version of juju-core.

Using

Once juju-core is built and you're able to use it as you like, there are a few caveats to be made aware of. First, whenever you run a bootstrap you'll need to include the --upload-tools flag, otherwise you'll end up having the 'released' version of the juju-core tools installed instead of the newly compiled ones.

juju bootstrap -e <your_environment> --upload-tools

Also, juju-core isn't compatible with previously deployed juju versions less than 0.7 (the python version of juju). You'll need to create new environments.yaml definitions and use different control-bucket keys. If you want to maintain two separate environment files you can do so by specifying a JUJU_HOME environment variable:

export JUJU_HOME=~/.juju-core
mkdir -p $JUJU_HOME
juju init -w

This will create a new boilerplate environments.yaml file in ~/.juju-core/ where you can maintain your juju-core environments separate from previous versions of juju.

Removal

If you wish to remove the compiled version of juju-core you can do so at anytime by running rm -rf $GOPATH. This should return your system back to a state prior to when you had your compiled source version of juju-core.


How do I do a full installation of Linux onto a USB flash drive

Following is step by step for installing 16.04 LTS on a 32GB flash drive on an Intel machine.

Turn off and unplug the computer. (See note at bottom)
Remove the side from the case.
Unplug the power cable from the hard drive.
Plug the computer back in.
Insert the flash drive.
Insert the Live CD or Live USB.
Start the computer, the CD/USB should boot.
Select language
Select install Ubuntu.
Select Download updates while installing and Select Install third-party software.
Continue.

At "Installation type" select "Something else".
Continue

Confirm Device is correct.
Select "New Partition Table".
Click Continue on the drop down.

(Optional partition for use on Windows machine)
Click "Free space" and "+".
Make "Size:" about 10000 MB.
Select "Primary".
Location for the new partition = "Beginning of this space".
"Use as:" = "FAT32 file system".
And Mount point = "/windows".
Select "OK"

Click "free space" and then "+".
Select "Size:" = 5000 to 7000 megabytes, "Primary", "Beginning of this space", Ext4, and Mount point = "/" then OK.

(Optional home partition)
Click "free space" and then "+".
Select "Size:" = 1000 to 10000 MB, "Primary", Beginning, Ext2, and Mount point = "/home" then OK.

(Optional swap space, allows hibernation)
Click "free space" and then "+".
Select "Size:" = remaining space, (1000 to 2000 megabytes, or same size as RAM), "Primary", "Beginning of this space" and "Use as" = "swap area" then OK.

(Important)
Confirm "Device for boot loader installation" points to the USB drive. Default should be ok if HDD was unplugged.
Click "Install Now".

Select your location.
Continue.
Select Keyboard layout.
Continue.
Insert your name, computer name, username, password and select if you want to log in automatically or require a password.
Requiring a password to log in and selecting "Encrypt my home folder" are good options if you are worried about loosing your USB drive.
Select Continue.

Wait until install is complete.
Turn off computer and plug in the HDD.
Stick the side panel back on.

Note:
You may omit disabling the hard drive if, when partitioning you choose to install grub to the root of the usb drive you are installing Ubuntu to, (ie sdb not sdb1). Be cautious, many people have overwritten the HDD MBR.
The internal drive will be added to grub boot menu, you can revise grub later, if you wish.


how do i make a command that executes a program when a custom hotkey is pressed?

On the Keyboard settings windows (super+A, then "keyboard"), click the "Shortcuts" tab, and on the list on the left will be an option for "Custom Shortcuts".

Press the + button, then give your shortcut a name and the program you want run.

It will default to "Disabled", but click on that and then press your keyboard combination you want, and it will become associated with your program.


How to run bash command with arguments at scheduled time

If you want your variables to be substituted at the time of setting the job up, you can accomplish running a simple bash command with at by simply piping the command to at with echo. For your first example, the syntax would be

echo "gsutil rm gs://$google_cloud_storage_location/$processed_file" | at now +24 hours

For the second example, the syntax could be

echo "/path/to/example_script.bash $google_cloud_storage_location/$processed_file" | at now +24 hours

If the variable substitution needs to be performed at the time of the job, it is a bit trickier. You will need to create a script that runs when the job is to be done, substituting at the proper time. This can be done using a command exclusively (e.g. from a script) by doing

echo -e '#!/bin/bash' > /path/to/script

Then

echo '<your command here>' >> /path/to/script

Then the syntax for the at command is

at now +24 hours -f /path/to/script

Of course, the +24 hours part should be adjusted to the proper duration.


Move if you only need it in the target path, copy if you need it in both locations. There's no inherent "insecurity" to mv or cp, and you'll be needlessly adding complexity (and extremely likely bugs) to your scripts if you start trying to implement your own mv.

For special cases there may be more suitable tools than either. For example, if you want to change owner or mode when copying there's the install tool which does that in one line rather than three.


Why is it so hard to change the account password?

The easiest method to change your password is passwd user (where user is your account name), but from the sounds of things it hasn't updated your keyring password - so it wants your old password. If that's the case, check out How to recover/reset forgotten Gnome Keyring Password? on how to remove the keyring or recover.

If you know your password (and it doesn't sycn like it should), try the following answer from Ask Unix:

  If you change your password through the GUI, it should automaticly
  synchronize the keyring that stores your WiFi passwords etc. too.

  You can also always change it from seahorse's control panel
  ("Encryption & Keyrings" or something like that in the Preferences).

Lastly (and this has all been a hunch to your issue) you can disable the keyring entirely, with the following answer:

  Fire up "User Accounts", set "automatic login" to "off". At startup
  you will be asked your user/password only once; popups like "unlock
  keyring" will never pester you again.


The best way is to use bosh and the openstack connector : http://docs.cloudfoundry.com/docs/running/deploying-cf/openstack/

You can also use the chef recipes (not supported by Pivotal) with knife tool:  https://github.com/andreacampi


First of all, verify that your tablet is supported by Ubuntu touch, check this.
Then, check this tutorial to unlock and install Ubuntu on your device


Windows Subsystem for Linux Autoload Apache2 and MySql

Found It!!!!! Although not elegant.

Instead of looping or sleeping just add "bash" to the end of the shell script. Here are my scripts for apache and mysql to run on startup.

VBS file (runs on startup) Win + r shell:startup create autostart.vbs

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:\Windows\System32\bash.exe -c ~/autostart.sh",0
Set WshShell = Nothing

autostart.sh file (Just make this in your Home Folder, chmod +x runnable)

#!/bin/bash
sudo service mysql start
sudo service apache2 start
bash

and in /etc/sudoers (Append to the end of the file)

# Allow apache2 and mysql to start without a sudo password
%sudo   ALL=(ALL) NOPASSWD: /usr/sbin/service apache2 *
%sudo   ALL=(ALL) NOPASSWD: /usr/sbin/service mysql *

If I need to kill it all I can find the bash process in Task Manager and kill that.

Credit: https://github.com/mstrelan


Create a virtual machine and connect to it command line

Take a look at this answer from StackOverflow, it was specific to windows but the commands are the same. You just need to enable port forwarding, and it should work just fine.

https://stackoverflow.com/questions/5906441/how-to-ssh-to-a-virtualbox-ubuntu-guest-externally-through-a-windows-host


SQLite binary file does not work on my Ubuntu,

With Ubuntu (as well as many other Linux distributions) the preferred method of installing software is to use the package management infrastructure. One tool for package management on Ubuntu is apt-get.

For example, to install sqlite3:

sudo apt-get update
sudo apt-get install sqlite3

this will download the official Ubuntu build of sqlite, and install it on your system. This way, you don't have to deal with the downloading yourself, or debugging problems with incompatible binary versions.

[The first command, sudo apt-get update just downloads the most recent list of packages available. You don't need to do this every time you want to install a package]

Then, you can just run sqlite3:

sqlite3

In case you really want to run the non-packaged sqlite binary, you need to ensure you have all the necessary bits for your machine. The sqlite binary in the archive is a 32-bit dynamically linked executable (as you saw by running file), so we'll at least need a 32-bit dynamic linker, plus any necessary libraries.

For the dynamic linker, we need the i386 build of the libc6 package. You can install this with:

sudo apt-get install libc6:i386

Then, you should be able to run ldd on the binary to show what other libraries it may need. For example, on my system:

[jk@pablo sqlite]$ ldd ./sqlite3
linux-gate.so.1 =>  (0xf76f1000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf76c1000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf750d000)
/lib/ld-linux.so.2 (0xf76f2000)

Since all of those libraries are present (ldd will report not found if something is missing), we should be fine to run the sqlite3 command.


Installing Gnome 3 (Unity and Gnome Shell) and KDE will result in software from both environments in the Menu, such as the Unity dash and the Gnome Shell applications grid and just as that Gnome Software appearing in KDE's menus.

GTK software will most likely than not appear bad looking in KDE and viceversa, to remedy that you should use the oxygen-gtk theme for GTK software in KDE and use qt4-qtconfig to theme K software under Gnome 3.

Nothing will brake, not that I know of. When you install one of the two you will be asked what Display Manager you want to use (GDM or KDM or LightDM).

Also, the vanilla Ubuntu package which contains unity is called ubuntu-desktop, the one with vanilla gnome is gnome and the one with vanilla KDE is kde-full, that is different from the kubuntu-desktop package.


where is the firefox menu in ubuntu mate?

Your question is a bit unclear. I understand that you are missing the menu-row with options such as "File", "Edit", "View", and so on, in Firefox.

This menu-bar is hidden by default in Firefox. To show it permanently, press alt. Click on "View", and then go down to "Toolbars". Make sure there is a tick (✔) next to "Menu Bar".


Host Unreachable through browser but can be ping

Please include more details about the web server you set up, software, version and how you set it up.
Have you check logs on the web server you set up in /var/log/yourwebserver

Can you verify the server is running
ps aux | grep webserver

Also, verify you can reach the server by running:
netcat -z -v 192.168.5.141 80

Running
netstat -tulpn | grep 80

Will usually give you a better view as well for future

You have not posted what firewall you are using, so it's impossible to troubleshoot this part. It sounds like the service failed if you could access it before.


Display part of fortune in different color

Source: coloring command output

The code:

#!/bin/bash
OIFS=$IFS #save old IFS

frtn=$(fortune tweets) #load up a fortune
IFS='@' #new IFS
arr=($frtn) #split fortune into array along IFS

tweet=$(tput setaf 3)"${arr[0]}"$(tput setaf default) #tweet - dark yellow color
uname=$(tput setaf 7)"@${arr[1]}\n"$(tput setaf default) #create @username - white
echo -e "$tweet$uname"; #to retain newlines in original fortune, echo between quotes

IFS=$OIFS #restore old IFS

Just copy paste that into your .bashrc file.

EDIT

The result:


How to Choose default startup kernel ubuntu 12.04 with a GUI program

It sounds like Grub Customizer will do what you want.  It's available through a PPA:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer


Why can I still import an online JS library while I disconnected from WiFi?

It's because browsers cache these kind of files (js, css) to speed up loading pages and the cache is still available while you are offline.

You can clear your browser cache or add something like ?v1 at the end of your script line to force loading it again like:

<script src="https://d3js.org/d3.v3.min.js?v1"></script>


How to open the existing file explorer and not a new one

You may have the "Open each folder in its own window" check box selected in the Behavior tab of File Management Preferences.

Select a folder
From the top menu bar, select Edit/Preferences
Behavior tab
Uncheck "Open each folder in its own window"

It would help to know which version of Ubuntu you are using; this answer is a guess. Edit your question with the output of this command from the terminal:

lsb_release -a


Diagnosing and fixing random Ubuntu crashes without SysReq?

Not enough technical details are provided here and only suggestions can be made.
First you have to determine if its a Operating System issue due to installation/configuration errors or a Hardware failure due to faulty hardware.
In the first case you could check the System logs try:
Check /var/log/ in terminal:

sudo nano /var/log/syslog

If you are running gnome, then you can check with a GUI all logs using "gnome-system-log" tool, type:

gnome-system-log

if it's not installed, type:

sudo apt-get install gnome-system-log

Also try replicate the issue by booting in recovery mode,or try another OS environment or another installation, or ssh into the system to see if it happens.
If it occurs its likely a hardware problem if not, look for clues in OS logs.
If it's a hardware fault and after you have checked that the RAM, HDD, CPU temp are OK.I suggest you call a tech support, even better if you're still in warranty.

Reminds me a similar problem that I had once with lots of random crashing although the Ubuntu system seems to be randomly "ok" just to discover it was due to faulty RAM.
It seems like a Memory hardware issue here and memory problems can be hard to detect..If you haven't checked on them yet

One way to diagnose this and check your RAM is with an application Memory Test.You usualy find it on the
 boot menu from your Ubuntu LiveCD or any other live cd with a memtest application on it.

Once the Boot menu appears you will see the option for Checking you Memory RAM,
Choose:
[Test Memory] or [MemTest86+]
If you do have a bad memory, you will get at least one RED row on the bottom half of the window application.
Also i suggest to test each memory individually and to different slots if you don't find a memory error with both installed. This way you will definitely know if one memory is defective.


ubuntu 12.04 and windows 7 dual partition. Extending ubuntu memory

to resize a partition wit gparted you need to unmount the partition, and since Ubuntu is running you cannot unmount it. the solution is to use a live cd or usb, open gparted there. than you first shrink your windows partition and afterward add the than unallocated space to your Ubuntu partition. be very careful though, you are messing with all the storage on your computer so first make a backup of both your windows and Ubuntu files!


How can I shrink a zfs volume on ubuntu 18.04?

Once you add your disk to zfs pool, by default zfs allocates whole disk for usage and it formats the disk using an EFI label to contain a single, large slice. This is recommended way.

It is not possible to shrink size of volume if you have allocated whole disk. You can technically force it to shrink by gparted or some other tool but that will cause problems and you may loose your data or zfs pool might be impacted, so that is not recommended at all.

You can reduce size of particular zfs pool and create new pool from free space. Only way possible to make free some space is you can make disk offline (I hope that you have multiple disks in zfs pool), re-format it and use some space for your desired partition and remaining space allocated to zfs partition for example c150d0. When you add disk back to zfs pool, you need add zfs partition for usage. This is not recommended way but should be counted as workaround.
Do it at your own risk.


How can I set a shortcut key to open the currently selected file in nautilus?

NOTE: in this answer there are two solutions, each with its own benefits. Users are encouraged to find out which one works best for their specific case.

Introduction

Nautilus by itself doesn't offer a way to define custom keyboard shortcuts and their actions. This is the main reason why the scripts you tried have failed. $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS can only be used via right click submenu. But we can exploit something else to achieve the desired result - shortcuts defined in the settings and system clipboard.

Nautilus is built in something known as Gtk  toolkit. It is an extensive library for creating graphic applications, and among other things it has utilities for interfacing with system clipboard. Nautilus, being a file manager, is special in the fact that it outputs a list of URIs ( in the form file:///home/user/Pictures/encoded%image%name.png ) to clipboard (which isn't a well known fact to most users, and I've learned quite recently as well). Apparently this is the way GUI file-managers copy files.

We can exploit that fact by copying the  URI of the file (or to be exact, the list of URI's; even if there's just one, it defaults to a list). Then we can pass that list to gimp. The two solutions presented below operate exactly on that idea.

Reasoning for 2 solutions:

I personally consider solution #1 as preferred one. It relies on manually pressing copy shortcut first, and then script shortcut - that's two keyboard shortcuts - but it has advantage in having less dependencies. It's a more manual approach , but fairly decent. It uses os.execlp call, which will replace script's process with Gimp, thus acting as merely a springboard for Gimp. It's a frequent practice in scripting and system programming to use exec family of functions

The second solution was written because Jacob Vlijm mentioned in the comments that for him the execlp function didn't work, for whatever reason. I find this very strange because the execlp belong to standard os module for python , which is one of the modules installed default. In addition, subprocess.Popen() defaults to exec() family of functions; from subprocess documentation:

  On POSIX, with shell=False (default): In this case, the Popen class
  uses os.execvp() to execute the child program.  args should normally
  be a sequence.  A string will be treated as a sequence with the string
  as the only item (the program to execute).

( Note "On POSIX" means "POSIX compliant OS"; Ubuntu is POSIX-compliant)

Thus, it doesn't seem like an issue with a function itself, but with user's system. Nevertheless, I wrote second script. That one uses subprocess module and relies on xdotool, which will basically automate pressing Ctrl+C shortcut for you, and then launch Gimp. I personally don't like this one as much, since it requires additional item to be installed, but it has advantage of needing just one keyboard shortcut.

The idea, however, is the same. We still use Gtk tools to query clipboard contents and in each case, scripts must be bound to a shortcut.

Solution #1, two shortcuts, minimum dependencies

Usage: select file and press Ctrl+C to copy file first, then press the shortcut you've assigned to this script. execlp function will replace the script's process with gimp.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from gi.repository import Gtk, Gdk
from os import execlp
from time import sleep
from urllib.parse import unquote
import signal
import threading
import subprocess

uris = None

def autoquit():
    global uris
    #sleep(0.5)
    while not uris:
       # allow sufficient time to obtain uris
       sleep(2)
       pass
    Gtk.main_quit()

def get_clipboard_contents():
    global uris
    clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
    tr = threading.Thread(target=autoquit)
    tr.daemon = True
    tr.start()
    uris = clip.wait_for_uris()
    Gtk.main()
    return [unquote(i).replace('file://','')
           for i in uris]
def main():
    signal.signal(signal.SIGINT,signal.SIG_DFL)
    files = get_clipboard_contents()
    print(files)
    args = ['gimp'] + files
    execlp('gimp',*args)

if __name__ == '__main__': main()

Solution #2: single shortcut, xdotool dependency

Usage for this script is simpler: select file(s) in Nautilus and press keyboard shortcut. NOTE: you must have xdotool installed for this to work, use sudo apt-get install xdotool.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from gi.repository import Gtk, Gdk
from subprocess import Popen,STDOUT
from time import sleep
from urllib.parse import unquote
import sys

def unquote_uri(*args):
    uris = args[-2]
    unquoted_args = [ str(unquote(i).replace('file://',''))
                      for i in uris]
    with open('/dev/null','w') as dev_null:
        proc = Popen(['gimp',*unquoted_args],stdout=dev_null,stderr=STDOUT)
    Gtk.main_quit()

def main():
    # NOTE: xdotool is REQUIRED for this to work
    Popen(['xdotool','key','Ctrl+c'])
    sleep(0.5)
    clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
    clip.request_uris(unquote_uri, None)
    Gtk.main()

if __name__ == '__main__': main()

Setting up the shortcut

In both cases, you need to have script linked to a shortcut. Open System Settings -> Keyboard -> Shortcuts -> Custom. Click the + button. Give full (!) path to file as command. For example, /home/User_Name/bin/clipboard_launch.py

Assign the shortcut to be something sensible. For example, since we're calling Gimp, I've assigned my script to Ctrl+Super+G.


Can Wine share the install directory with Windows?

From what I've been able to determine, it can.  There doesn't appear to be any modification happening to the installation files.

At least, this has worked for me in Starcraft 2.


You have installed some custom kernel image 5.5.1-CS369.

Why would you expect that corresponding linux headers would appear in Ubuntu repositories?

If you installed a custom kernel image, you should install headers from the same place.

You ask why you don't see the 5.5.1 headers in Ubuntu repos. It is for the same reason you don't see the 5.5.1 kernel image there.


How do I make Thunderbird open HTTPS links in firefox for Thunderbird Add-ons?

The protocol is not dependent on the browser, but the hosting provider of the website you are opening. If the website has an SSL Certificate installed, it will go through the HTTPS protcol/:443 port and the force SSL connections are server rules that are added to the serve's vhosts files. You can't alter those settings via the browser.

Are you trying ti disable the option to open websites at all that doesn't have HTTPS connections?


Can't Install nvidia driver on ubuntu 13.04

Same question nvidia install

You can also get helps from here: Install nvidia


Difficulty in using iwconfig, can i get full command to start a virtuall wireless network?

You will need following tools to start the wireless network,

ifconfig: Enable your wireless device.
iwlist: List the available wireless access points.
iwconfig: Configure your wireless connection.
dhclient: Get your IP Address via dhcp.
wpa_supplicant: For use with WPA authentication.

Detailed steps are given here

  Let's take a look at how this is done when you are connecting to a
  non-WPA authentication-based wireless network.

  Now that you have confirmed they are installed start off with the
  command:

  ifconfig wlan0 up

  Where wlan0 is the name of your wireless device (this is most often
  the default). The above command will bring your wireless device up so
  it is ready to use. The next phase is to scan for any wireless access
  points with the command:

  iwlist wlan0 scan

  From the output of the scan you should see a line (or lines) like:

  ESSID: "NETWORK_NAME"

  Where NETWORK_NAME is the name of an available wireless network.

  Now that you have your network name (and you know it's available) you
  can connect to that network with the command:

  iwconfig wlan0 essid NETWORK_NAME key WIRELESS_KEY

  Where NETWORK_NAME is the name of the network you want to connect to
  and WIRELESS_KEY is the security key for that network. NOTE: The
  iwconfig command defaults to HEX values for wireless keys. If you need
  to use ascii you have to prepend the "s" prefix to your key like so:

  iwconfig wlan0 essid NETWORK_NAME key s:WIRELESS_KEY

  With your connection made, you now have to get an IP address for your
  machine using the dhclient command like:

  dhclient wlan0

You can also look at hostapd.
Hope this'll help.


How to install Logitech Media Server (Squeezebox Server)?

I upgraded to Ubuntu 20.04 and that broke my installation but I figured out how to make it work again:

After some tempering around, I considered to do a fresh install. So I deleted the old stuff in /var/lib/squeezeboxserver/

Then I got me a fresh deb-packet for version 8.0 (beta) from: http://downloads.slimdevices.com/nightly/?ver=8.0

Personally I used the most plattform version but depending on plattform just select a fitting deb:

wget http://downloads.slimdevices.com/nightly/8.0/lms/cf7bcdb87b4f8bf6f71f5b5444c923afae4c300d/logitechmediaserver_8.0.0~1589180193_all.deb

Installed it with:
dpkg -i logitechmediaserver_8.0.0_1588799628_all.deb

As I tried older versions too and even tried a git checkout I hope I lack no detail another script has already done for me without noticing it.

If the dpkg installation not already added a user and group please do so:

adduser squeezeboxserver
usermod -a -G squeezeboxserver squeezeboxserver

Create a directory for the pid file:

mkdir /var/run/logitechmediaserver

And give it to that user and group:

chown squeezeboxserver:squeezeboxserver /var/run/logitechmediaserver

Same goes for the stuff in /var/lib/squeezeboxserver/

chown squeezeboxserver:squeezeboxserver /var/lib/squeezeboxserver
chown -R squeezeboxserver:squeezeboxserver /var/lib/squeezeboxserver/*

The problem comes with the startup script in /etc/init.d. It simply does not work, as Ubuntu 20.04 does not have the start-stop-daemon any more. It is simply linked to /bin/true which might work for some scripts but does not work for the logitechmediaserver. I tried a C implementation for this program, but it had it hinges so I dropped the start-stop-daemon and modified the startup program arcordingly.

Just store the old startup script away (just to be save) and copy this content into an editor of your choice:

#!/bin/sh
#
# $Id$
#
# logitechmediaserver   initscript for slimserver.pl
#           This file should be placed in /etc/init.d.
#
# Original Author: Mattias Holmlund
#
# Updated By: Dan Sully, Michael Herger, Alexander Hartmann

#
### BEGIN INIT INFO
# Provides:             logitechmediaserver
# Required-Start:       $all
# Required-Stop:        $all
# Should-Start:         $all
# Should-Stop:          $all
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Startup script for the Logitech Media Server
# Description:      Logitech Media Server powers the Squeezebox, Transporter and SLIMP3 network music \
#           players and is the best software to stream your music to any software MP3 \
#           player. It supports MP3, AAC, WMA, FLAC, Ogg Vorbis, WAV and more! \
#           As of version 7.7 it also supports UPnP clients, serving pictures and movies too!"
### END INIT INFO
#
# -e  Exit immediately if a command exits with a non-zero status.
set -e

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

### About logitechmediaserver
# The logitechmediaserver is kind of special. It uses the
# squeezeboxserver_safe script, to restart any died squeezeboxserver. This
# can easily happen, for example if you use a MySQL server. Depending on unix
# flavour you are running they sometimes do a regular restart. That would
# cause the squeezeboxserver to terminate. Because of that the
# squeezeboxserver_safe starts a logitechmediaserver every few seconds, which
# gets shut down again if any other logitechmediaserver is still running.
#
# Sadly this procedure messes up, the process id file. You would get a new id
# file, every time a new server process gets started. That process will
# terminate but the process id of the first server process is lost. So the
# killing the squeezeboxserver have to be done with analysing the process
# table.
#
# As I upgraded to Ubuntu 20.04 my logitechmediaserver stopped working.
# Installing the lastest 8.0 version was no problem downloading the deb-packet
# and installing with dpkg. But the server did not start. I could start it
# manually but the startup script was not able to start it. After some looking
# around I found this:
#
#           /sbin/start-stop-daemon -> /bin/true
#
# This explains why the start up script is not working. There is no package
# in the ubuntu package repository for the start-stop-daemon.
#
# First I tried the C implementation of start-stop-daemon from Dale O'Brien on
# github (https://github.com/daleobrien/start-stop-daemon). It does not
# implement the --remove-pidfile option the original script. But more
# problematic it threw the error not able to terminate the server while
# doing it without a problem.
#
# I had to compile the C implementation from Dale O'Brien myself, which
# worked without a hitch. Considering the limiations of the implementation
# I came to the conclusion to ditch the start-stop-daemon completly and
# doing it the old school way.

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Logitech Media Server"
NAME=squeezeboxserver
NEWNAME=logitechmediaserver
DAEMON=/usr/sbin/$NAME
DAEMON_RESTARTER=/usr/sbin/${NAME}_safe
PIDFILE=/var/run/$NEWNAME/${NEWNAME}.pid
SCRIPTNAME=/etc/init.d/$NEWNAME
SLIMUSER=$NAME
SLIGROUP=$NAME
PREFSDIR=/var/lib/$NAME/prefs
LOGDIR=/var/log/$NAME/
CACHEDIR=/var/lib/$NAME/cache
CHARSET=utf8
SLEEPTIMER=1

## if you want to add additional options
## use /usr/sbin/squeezeboxserver --help
## for the supported options and place them
## into the configfile  /etc/default/logitechmediaserver

# Read config file if it is present.
if [ -r /etc/default/$NEWNAME ]; then
    . /etc/default/$NEWNAME
elif [ -r /etc/default/$NAME ]; then
    . /etc/default/$NAME
fi

#
#   Function that starts the daemon/service.
#
d_start() {
        # Where is your su installed?
        SU_BIN=$(command -v su)

        # Use squeezeboxserver_safe to restart the daemon when
        # it dies. This must be done to handle mysql restarts.

        $SU_BIN - $SLIMUSER \
          -s /bin/sh \
          -c "$DAEMON_RESTARTER \
                $DAEMON \
                  --user $SLIMUSER \
                  --group $SLIGROUP \
                  --prefsdir $PREFSDIR \
                  --logdir $LOGDIR \
                  --cachedir $CACHEDIR \
                  --charset=$CHARSET \
                  --daemon \
                  $SLIMOPTIONS \
              > /dev/null 2>&1 &"

        # Writing the pid for the restarter
        PID=$(ps ax | \
          grep "$DAEMON_RESTARTER $DAEMON" | \
          grep -v grep | \
          head -1 | \
          awk '{print $1}' )

        if [ $PID ]
        then
          if [ $PID -gt 0 ]
          then
            echo -n "  Started the restarter with the process id: "
            echo $PID

            if [ -e $PIDFILE ]
            then
              rm $PIDFILE
            fi

            echo -n $PID > $PIDFILE
          fi
        else
            echo "  ERROR: No process id for the restarter could be found!"
        fi

        # Check if the server is successfully started
        PERL_BIN=$(command -v perl)

        PID_SERVER=$(ps ax | \
          grep "$PERL_BIN $DAEMON" | \
          grep -v grep | \
          head -1 | \
          awk '{print $1}' )

        if [ $PID_SERVER ]
        then
          if [ $PID_SERVER -gt 0 ]
          then
            echo "  Started the server successfully."
          else
            echo "  ERROR: No process id for the server could be found!"
          fi
        fi
}

#   Function that stops the daemon/service.
#
d_stop() {
    echo -n "  Checking if the restarter is still running: "

    ## This will kill the squeezeboxserver_safe script. So we don't have
    ## to bother about it, starting new processes.

    PID1=$(ps ax | \
      grep "$DAEMON_RESTARTER $DAEMON" | \
      grep -v grep | \
      head -1 | \
      awk '{print $1}' )

    if [ $PID1 ]
    then
      echo positive
      if [ $PID1 -gt 0 ]
      then
        echo -n "  Stopping now restarter: "

        kill $PID1

            if [ -e $PIDFILE ]
            then
              rm $PIDFILE
        fi

        echo done.
      fi
    else
            echo negative
        fi

    ## We have to kill at least one server process. Possible two processes
    ## and in weird cases  under real high load even three processess.
    ## So a loop it is.
    ## We have to wait for at least one second for closing the process
    ## and analyzing the process list again.

        echo -n "  Checking if any server instances are running: "

    PERL_BIN=$(command -v perl)

        PID2=$(ps ax | \
          grep "$PERL_BIN $DAEMON" | \
          grep -v grep | \
          head -1 | \
          awk '{print $1}' )

        if [ $PID2 ]
        then
          echo positive
          echo -n "  Stopping now all server instances: "
          if [ $PID2 -gt 0 ]
          then
            while [ $(ps ax | \
              grep "$PERL_BIN $DAEMON" | \
              grep -v grep | \
              head -1 | \
              awk '{print $1}') ]
            do
          kill $(ps ax | \
                grep "$PERL_BIN $DAEMON" | \
                grep -v grep | \
                head -1 | \
                awk '{print $1}')
              sleep $SLEEPTIMER
            done
            echo done
          fi
        else
          echo negative
        fi
}

#
#   Function that sends a SIGHUP to the daemon/service.
#
d_reload() {
    start-stop-daemon --stop --quiet --pidfile $PIDFILE --signal 1
}

case "$1" in
  start)
    echo "Making sure that $DESC is not running: "
    d_stop
    echo "Starting $DESC:"
    d_start
    ;;
  stop)
    echo "Stopping $DESC:"
    d_stop
    ;;
  restart|force-reload)
    #
    #   If the "reload" option is implemented, move the "force-reload"
    #   option to the "reload" entry above. If not, "force-reload" is
    #   just the same as "restart".
    #
    echo "Restarting $NAME."
    d_stop
    d_start
    ;;
  status)
    status_of_proc /usr/bin/$NEWNAME $NEWNAME
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
    exit 1
    ;;
esac

exit 0

Yeah, it's not pretty, but it does the job for me and will hopefully help you too. You have to place it in /etc/init.d under the name logitechmediaserver

After that you have to run the following command to make systemctl happy:

systemctl daemon-reload

Just give it a test run with starting it:

/etc/init.d/logitechmediaserver start

You should be able to log in with your webbrowser to http://YourServerIP:9000/ and configure it.

And test if it does shut down again:

/etc/init.d/logitechmediaserver stop

When everything has worked out, enable the service:

systemctl enable logitechmediaserver.service


The easiest way would be to go to /usr/share/themes/, copy the folder of your favorite theme, and start editing/replacing the images and the colors in the configuration files :p

If you'd rather start from scratch, this seems like a good guide: http://orford.org/gtk/
But notice that this guide is for Gtk2, and Ubuntu 11.10 will use Gtk3 ;)


Turns out the virtual box warnings were nothing of importance, probably just something that if m'board had would allow virtualisation to run better or something.

I next tried starting X manually and that turned out to be the problem. Could not find NVIDIA drivers. For some reason an ubdate had wiped my NVIDIA drivers and Ralink pciwifi card drivers. Reinstalling both sorted the problem. I installed both of these manually. Why they disappeared I do not know. Maybe this has to do with the upgrades that I think came though the last time I booted up?


Either consider OSSSEC HIDS or some other IDS/IPS system on your network, or a fresh reinstallation of the server.

Unless you have a known good rkhunter scan or similar to base a comparison from, trying to determine if you have a root kit is nigh impossible without monitoring traffic on your network and such to determine intrusions (and that would be Snort or OSSSEC HIDS like the comments say).  Then watching the output events which trigger will give you an idea if malware or root kits are there and trying to ping out to elsewhere.

If you suspect a root kit though, you may want to just start anew, but if that server is critical to all work processes then you need to consider what other issues could exist and whether the cost of a potential security hole or breach there is acceptable to you or the organization,  versus the cost of downtime while you reinstall the server, reinstall services, put data back on, etc.


I encounter problems with mobile broadband too, I use wvdial to connect to the internet with MTS. I wrote a blog post on how you can get that working.

Hope it helps, feel free to ask for clarifications.


Why can't I read encrypted DVDs after installing libdvdread4?

libdvdread4 alone is not sufficient to play DVD movie discs. For your convenience, Ubuntu includes a nice metapackage to install most libraries and codecs to watch media: Ubuntu Restricted Extras .

This does not include libdvdcss2 from the Medibuntu repository yet. It's not included in Ubuntu for legal reasons as mentioned on the Ubuntu Wiki: RestrictedFormats/PlayingDVDs. See this answer on how to enable the Medibuntu repository and how to install this package.

In case you're still having problems playing DVDs and you have both libdvdread4 and libdvdcss2 installed, see this relevant question: Why does DVD playback still not work after installing libdvdcss2?, specifically this answer in it about setting the region code on your DVD player.

In case you're running an official derivative of Ubuntu, this might be relevant as well:

What is the difference between Ubuntu, Kubuntu, Xubuntu and Lubuntu restricted extras/addons?


Batch processing with java command in Ubuntu terminal

for i in *; do
  echo java -Xmx5g -cp stanford-corenlp-3.7.0.jar:stanford-corenlp-models-3.7.0.jar:* edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,mention,coref -coref.algorithm neural -file $i
done

This loops over every (non hidden) file in the current directory and echoes your java command with the file name as an argument to the -file option. To actually perform the action, remove echo.


How to disable usb 2.0 under Ubuntu?

Try with one feature in the kernel, the ability to bind and unbind drivers from devices manually from user space.

In the sysfs tree, every driver now has bind and unbind files associated with it.

In order to unbind a device from a driver, simply write the bus id of the device to the unbind file.

See more at: Bind-Unbind


apt-get update says I have not permission

To run such command you need special permission.

Use sudo, but be carefull. It may ask for a password, that is the root password.


Is there a cpu frequency monitor on ubuntu 12.10

there is already  one installed it is called System Monitor and can be found in the dash by hitting the "Windows"(called Super) key and then you can start typing the name and clicking the icon to open it.  If you are going to be using it frequently you can then right click the icon in the launcher and selecting "Lock to Launcher" it will then stay in the launcher and you can click the icon to open it.  Here is a screenshot....

 as you can see it is a lot like the Windows task manager and can show you what Processes are running as well and you can kill a process with a right click as well as get file system info(how much free space ect) and general system info(kernel number, computer name ect)

There is a indicator app that allows you to see/control the speed in Ghz of the processor but I don't know anything about it is called indicator-cpufreq and can be found in the Software Center or here.


What do + and - mean in the output of jobs command?

They'll always be the latest and latest-minus-one running jobs.
Their only purpose, as far as I can tell, is to provide a shorthand for those two latest jobs so you can reference them as fg - instead of fg %3. This makes it fairly trivial to spin between two or three processes.
TLDP seems to corroborate this (see Table 15-1. Job identifiers)


How to retrieve and list local charms in juju-gui charm browser?

In order to get your charms to show up in the charm browser you will need to push them to your own namespace in Launchpad. Less than 15 minutes later, assuming charm proof passes, you'll be able to see your own charm in there.

You can read about this process here: https://jujucharms.com/docs/stable/authors-charm-store#submitting-a-new-charm

Just FYI, there is no technical difference between dragging from the Charm Browser and dragging a zip archive of your charm from your machine.


% is a special character in printf. That's what's causing the error. You need to escape it as %%.

$ may also be substituted when within double quotes by the outer shell, so you should to escape that (\$). It is usually just easier to use single quotes.


Try the following:

cp -r /opt/lampp/htdocs/codeigniter_2.0.2/* /opt/lampp/htdocs/test/


You just need an X server.  Get XMing from

https://sourceforge.net/projects/xming/

Install it, and run it before you launch any programs that require an X server.

Modify your .profile and add

export DISPLAY=:0.0


bash comparing multiple column in two files with different length

Through single awk command I think it would be faster than using a while-loop. You can test it how fast is by time command in front of the command and see if it's fast ;)

awk -F, 'NR==FNR{ arr[$2]=$2 $1; next }
    { print $0, (arr[$2]==$2 $3?"ok":"nok") }' OFS=, def.txt data.txt
d1,40,gold,ok
d2,30,silver,ok
d3,20,bronze,ok
d4,10,iron,ok
d5,5,wood,ok
d6,20,gold,nok
d7,10,wood,nok
d8,5,gold,nok
d9,10,silver,nok

Explanation:

NR is set to 1 when the first record read by awk and incrementing for each next records reading either in single or multiple input files until all read finished.
FNR is set to 1 when the first record read by awk and incrementing for each next records reading in current file and reset back to 1 for the next input file if multiple input files.
so NR == FNR is true for the first file only def.txt
arr[$2]=$2 $1; creates an associative array named arr with the key as $2 and copy second and first fields as its value.
The next token skips to executing rest of the commands and those will only execute actually for next file(s) except first.
This print $0 prints the whole line of data.txt and (arr[$2]==$2 $3?"ok":"nok") (known as Ternary operator (condition?"if-true":"if-false")checks if key value in arr[$2] was equal with values of $2 $3 (second and third fields) in data.txt then print "ok" else "nok".
This will also work if your data.txt file and def.txt files are not sort-ed.


How to remap Macbook 5,1 damaged 'Ctrl' key to a Command key?

You can remap keys with Xmodmap.

The code for the Left Ctrl button is

keycode 37 (keysym 0xffe3, Control_L)


How to associate a file with a program installed in wine

All you need to associate file of some type to be handled by some app, also by wine app, you can find in folder

~/.local/share/applications

you will need to open

~/.local/share/applications/mimeapps.list

and find needed type, like this:

image/jpeg=eog.desktop;wine-extension-jpeg.desktop;

as you see there are two files which are relative to this type, if the file stand first it will be the default handler for this type, the other will be shown in "Open with" menu

this is example of .desktop file

[Desktop Entry]
Name=PHP Expert Editor
Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f
MimeType=image/jpeg
Type=Application
StartupNotify=true
Path=/home/m/.wine/dosdevices/c:/Program Files/PHP Expert Editor 4.3
Icon=/home/m/.local/share/icons/10de_phpxedit.0.png

the whole point in the "Exec=" line at the and "z:%f"

Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f

if you don't have this line you should have an error

Can not open file "/home/...."

while trying to open some file with your app, because of wine paths are like windows disks and to open your file, for example "/home/picture.jpg" in wine you should use path "z:/home/picture.jpg"


If you're using Thunar, you can change the side-pane's color by editing a file called thunar.rc. Its location depends on where your theme is. I like to have my themes in ~/.themes and so my thunar.rc has this filepath: /home/dkb/.themes/MyGreybird/gtk-2.0/apps/thunar.rc.

In my thunar.rc, right at the top, I have:

style "sidepane"
{
    GtkTreeView::vertical-separator = 4

    base[NORMAL]        = @link_color
    base[INSENSITIVE]   = mix (0.4, shade (1.35,@selected_bg_color), shade (0.9,@base_color))

    text[NORMAL]        = mix (0.7, @text_color, @base_color)
    text[ACTIVE]        = mix (0.7, @text_color, @base_color)
    text[SELECTED]      = mix (0.7, @text_color, @base_color)

When I have

base[NORMAL]        = @link_color

Thunar's side-pane looks like this:

When I have

base[NORMAL]        = mix (0.1, shade (1.35,@selected_bg_color), shade (0.9,@base_color))

Thunar's side-pane looks like this:

@link_color, @selected_bg_color, and @base_color are defined in your theme's gtkrc. In my case, the filepath is this: /home/dkb/.themes/MyGreybird/gtk-2.0/gtkrc.

You can define your own color in gtkrc by just adding to the list of defined colors:

For example, you may have:

gtk-color-scheme    = "bg_color:#777777\nselected_bg_color:#398ee7\nbase_color:#666666" # Background, base.
gtk-color-scheme    = "fg_color:#3C3C3C\nselected_fg_color:#ffffff\ntext_color:#212121" # Foreground, text.
gtk-color-scheme    = "tooltip_bg_color:#000000\ntooltip_fg_color:#E1E1E1" # Tooltips.
gtk-color-scheme    = "link_color:#2d71b8" # Hyperlinks
gtk-color-scheme    = "panel_bg:#686868" # Panel bg color
gtk-color-scheme    = "fm_color:#F7F7F7" # Color used in Nautilus and Thunar.
gtk-color-scheme    = "bg_color_dark:#686868\ntext_color_dark:#FFF"

Then just add something like:

gtk-color-scheme    = "my_thunar_sidepane_color:#2c2c2c"

if you want to match the color of the main pane, for example. Save gtkrc and modify thunar.rc to use your defined color and reload your theme. When you next open Thunar, it should reflect the change you made.


Windows 10 disappeared (but I can see my files are still there) boot after I installed Ubuntu

You may try using a bootmenu with Easy BCD which is a Windows application and for me it worked perfectly.

First of all , insert Windows Installer DVD and boot it.
 Then select "Repair this computer " option.

After select the command line option located at the bottom of recovery menu. Launch it.

Then type bootrec /fixmbr and execute it. You should now see a message that MBR has been restored or fixed.

Now restart the PC . It will boot directly into Windows. The GRUB must be gone .

Now download and install Easy BCD . After installation, launch it , and select add new entry .

Now select Linux and use GRUB legacy and make sure "automatically locate and launch is enabled " or you can also manually select Linux bootloader drive.

Now save the settings and restart the system.

In the bootmenu , you should now see Neosmart Linux and if you choose it , it will load the GRUB.

Its the easiest method and if you feel uncomfortable with editing GRUB menu you can try it.


How to set image open-with via terminal?

Run the command nano ~/.local/share/applications/mimeapps.list (to set for your user only) or sudo nano /usr/share/applications/mimeapps.list (to set for all users).
Find the mime type of the file you want to change (.jpg is image/jpeg). You can find the mime type with the command file --mime-type -b filename
Replace (or add) the line so it reads image/jpeg=eog.desktop (replacing image/jpeg with the type and eog.desktop with the .desktop which you want to use to launch the program.

Note:
If you are using /usr/share/applications/mimeapps.list, you may need to create it see here: Default Applications - ArchWiki


You are trying to kill the command you are running.
The 10690 is a grep process. At the moment you are trying to kill it, it has been finished already.


Wine won't install, Does not have valid release file

18.04 has been out for less than a week.  As such, many developers haven't caught up to the new release yet.  To that end, WineHQ has a bug for this already requesting 18.04 packaging in their repository.

There is Wine 3.0 in the Ubuntu repositories, you can use that in the interim by executing sudo apt install wine.  Once the upstream WineHQ repositories catch up you can use them.

Once that time is available, you can follow the instructions for installing from their repos.  From their instructions page are the instructions to follow at that  time:

  If you have previously installed a Wine package from another repository, please remove it and any packages that depend on it (e.g.,
  wine-mono, wine-gecko, winetricks) before attempting to install the
  WineHQ packages, as they may cause dependency conflicts.

  If your system is 64 bit, enable 32 bit architecture (if you haven't
  already):

sudo dpkg --add-architecture i386

  Add the repository:

wget -nc https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/

  Update packages:

sudo apt-get update

  Then install one of the following packages:

  Stable Branch:

sudo apt-get install --install-recommends winehq-stable

  Development Branch:

sudo apt-get install --install-recommends winehq-devel

  Staging Branch:

sudo apt-get install --install-recommends winehq-staging

  If apt-get complains about missing dependencies, install them, then repeat the last two steps (update and install).

Staging isn't really used anymore, so use either Stable or Devel.

There will be differences though:

  Files are installed to /opt/wine-devel.
  Menu items are not created for Wine's builtin programs (winecfg, etc.), and if you are upgrading from a distro package that had added
  them, they will be removed. You can recreate them yourself using your
  menu editor.
  Binfmt_misc registration is not added. Consult your distro's documentation for
  update-binfmts
  if you wish to do this manually.
  WineHQ does not at present package wine-gecko or wine-mono. When creating a new wine prefix, you will be asked if you want to download
  those components. For best compatibility, it is recommended to click
  Yes here. If the download doesn't work for you, please follow the
  instructions on the Gecko and
  Mono wiki pages to install them
  manually.


Ubuntu on a home built computer cant find live file medium

I also had problem booting up a live cd so I installed my Ubuntu 12.04 alongside Win 8 using WUBI. I consider this an improvement over Mint and Ubuntu installed in it's own partition.

http://www.ubuntu.com/download/desktop/windows-installer


Maximum monitor resolution is only 1024*768

I have one monitor LG 24MP88HV-S with VGA connection and don't know why, but my maximum resolution in KDE monitor settings is only 1024*768.
But output of xrandr shows much more modes - maximum 1920x1080     60.00
This command helped me:

xrandr --output VGA-1 --mode 1920x1080


Enable passwordless sudo as a specific user

Follow these steps:

Edit sudoers file (this can be present in /etc/sudoers.d/file_name)

sudo visudo -f /etc/sudoers

Add line at the end of the file

usernameusedforlogin ALL=(ALL) NOPASSWD:ALL

Save file

esc :wq!


As Yaron posted in a comment, creating a systemd service worked.

Following this guide I created a systemd service and activated it.

Please note for the guide above to work correctly you must ensure you add the following line to your unison .prf profile:

sshargs= -oIdentityFile=/path/tos/ssh/key/id_rsa

if you are sshing into the remote server


To change the permissions, try

sudo chown -R (username) /home

which will give you full read/write access /home. However, your home folder is probably /home/(username), not just /home


It depends on why you want the custom folder.

If it is for personal use, create it in your home directory (and thing of that as the windows equivalent of %userprofile%).

If you want shared folder (e.g. a music collection for all memeber of the family, all with their own accounts) then user /usr/local/.

If you want to share the folders between your VM and the host OS, then you have two choices:

Create them in the VM (in /usr/local/my_secial_folder_name_here/) and share that with the rest of the network. (E.g. NFS, samba, ...)
Or create them on the host OS and use the hypervisors option to share that folder with the VM.

All options will work. But the 'right' option really depends on your goal.


Installation error Google Drive did not Sync. Run Grive Setup again

Ubuntu 12.04 is NOT officially supported because of dependency issues and besides
 THIS PROJECT IS NO LONGER SUPPORTED DUE TO GOOGLE DRIVE API CHANGES .
Here is the installation instruction of "overGrive", the new Google Drive client.

Step 1:  Download the latest version of overGrive (.deb) here

Step 2: Launch overGrive from launcher

Step 3: A window will appear - click on Connect account.
Then a  browser window will open for you to sign in to your Google account.

Step 4: At the end you will get a code.
Copy that code and paste it into the overGrive window at Account entry box and click validate.

Step 5: After setting your preferences (like location, etc.) click Start Sync.

Reference here


Shortcut to hide the desktop icons in GNOME 3

I wrote a small script, which changes this option:

#!/bin/sh
if $(gsettings get org.gnome.desktop.background show-desktop-icons);
then new="false";
else new="true";
fi
gsettings set org.gnome.desktop.background show-desktop-icons $new

You can save the script /somewhere/as/somewaht.sh (with permission to execute) and then add in your keyboardsettings an entry:


Fortunately, Dropbox recently expanded their CLI capabilities to include sharelinks etc. To integrate Dropbox into Thunar do the following:

Initial Setup

Create a ~/bin directory in your home folder if not already created. Download the Dropbox python script. Rename it as just dropbox. (The extension is not needed.) Make it executable chmod +x ~/bin/dropbox.

If the ~/bin directory is not already added to your $PATH (i.e. tab completion doesn't work for the script, etc.), you would add the following to ~/.profile. Then log out and in again.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Install xsel by pasting sudo apt-get install xsel in terminal. This program gives clipboard functionality to the below script.

Save the following script to a plain text file, save it in ~/bin, and make it executable. Mine is named dropbox-online. Change icon_path="/full/path/to/dropbox-icon.png" to the path to your Dropbox icon.

#!/bin/bash

# Name:     Dropbox Thunar Integration
# Author:   jbrock
# Dependencies: xsel (in Ubuntu repository), Dropbox python script https://linux.dropbox.com/packages/dropbox.py
# Installation: http://askubuntu.com/questions/777878/how-to-integrate-dropbox-in-thunar

notify_time=5000
icon_path="/full/path/to/dropbox-icon.png"
internet_status=$(ping -c 1 dropbox.com > /dev/null 2>&1; echo $?)
dropbox_status=$(dropbox status)

web_directory () {
    prepend_path="https://www.dropbox.com/home/"
    append_path=$(pwd | cut -d "/" -f5-)
    xdg-open "$prepend_path$append_path"
}

gui_notify () {
    notify-send -t "$notify_time" -i "$icon_path" "$1"
}

# Check: 1. internet connection; 2. if Dropbox is running; 3. if in Dropbox or Public folder.

if [ "$internet_status" != 0 ]; then
    gui_notify "There is an internet connectivity issue."
    exit 1
fi

if [ "$dropbox_status" = "Dropbox isn't running!" ]; then
    gui_notify "Dropbox isn't running."
    exit 1
fi

if [[ "$2" != *Dropbox* ]]; then
    gui_notify "You are not in Dropbox."
    exit 1
fi

if [[ "$1" = -p && "$2" != *Dropbox\/Public* ]]; then
    gui_notify "You are not in the Dropbox/Public folder."
    exit 1
fi

case "$1" in
    -p )
        dropbox puburl "$2" | tr -d '\n' | xsel -ib && gui_notify "Public Link Copied" ;;
    -s )
        dropbox sharelink "$2" | tr -d '\n' | xsel -ib && gui_notify "Share Link Copied" ;;
    -d )
        web_directory ;;
esac

Thunar Integration

To integrate into Thunar. Go to Edit > Configure custom actions. Click the plus to add a custom action. Set up the following three custom actions:

Remember too that you can add your own icon to appear on the Thunar context menu items.

For each of these you'll want to do the following on the second tab given that you want to be able to share any type of file or directory.

The only downside is that the three Dropbox menu items appear globally in Thunar, not only in Dropbox. However, the script tells you if you are accidentally outside of Dropbox.

Update: The command dropbox puburl no longer works. Dropbox no longer has the Public folder for free accounts and discontinues it for paid ones on September 1, 2017.


At its simplest, you could just do

cat /proc/*/oom_score

If you want more information - such as the PIDs and command string as well - then maybe a simple loop like

while read -r pid comm; do
  printf '%d\t%d\t%s\n' "$pid" "$(cat /proc/$pid/oom_score)" "$comm"
done < <(ps -e -o pid= -o comm=)


I don't have "additional drivers" on my ubuntu?

I'm not sure what you think you need it for. If it detects you have devices that it can install additional drivers for, it will prompt you.

Anyway, if you want to manually launch it, you can run jockey-gtk.

In the context of VirtualBox, you shouldn't use the Additional Drivers dialogue anyway. You should be using the Guest Additions framework.


Do I have to add the public key for the repository for installing R?

I found this looking on gogle(in spanish):

As i see in the log of the console, you have to add some keys(not only the R related, maybe the other ones are about dependencies of the program)

The page say about a key manager, something to easy a bit the problem of add keys:

You should do this:

$ sudo apt-get install add-apt-key

Then:

$ sudo su -
# add-apt-key --keyserver keyserver.ubuntu.com 51716619E084DAB9

I also found another way here(English, askubuntu forum; see the acepted answer)

I hope that this work for your problem.


Open file if not already open with .sh script

The following solution only works for commands that keep running until you close the program/tab. Unfortunately that’s not the case for most GUI programs and xdg-open. In the case of Firefox one could get a list of URLs currently opened and grep it, but that’s a neither generic nor ideal solution. As for testing whether a program is running, see this question.

You can use lockfile from the procmail package . As its man page holds an example exactly matching your use case, I’ll just quote it:

  Suppose you want to make sure that access to the file "important" is
  serialised, i.e., no more than one program or  shell  script  should
  be allowed to access it.  For simplicity's sake, let's suppose that it is a shell script.  In this case you could solve it like this:

...
lockfile important.lock
...
access_"important"_to_your_hearts_content
...
rm -f important.lock
...

  Now  if  all the scripts that access "important" follow this guideline, you will be assured that at most one script will be executing between the lockfile and the rm commands.

By default, every other script will wait for the file to be unlocked again, testing every eight seconds by default (change with e.g. lockfile -5 important.lock for five seconds). If you just want to check whether it’s locked, you can use the classic test command:

if [ -e important.lock ]; then
  # stuff to do if locked
else
  # stuff to do if not locked
fi


12.04 LTS boot hangs at "SP5100 TCO timer: mmio address 0xfec000f0 already in use", didn't yesterday

It's a bug. Take a look at https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1055096 and add your information there.


Firewall problem using autofs with NFS-exported mounts

In the end itwas not that complicated, following the hints in Securing NFS. I modified the files /etc/default/nfs-common and /etc/default/nfs-kernel-server according:

nfs-common:

.
.
# Options for rpc.statd.
#   Should rpc.statd listen on a specific port? This is especially useful
#   when you have a port-based firewall. To use a fixed port, set this
#   this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
#   For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS
STATDOPTS="--port 32765 --outgoing-port 32766"
.
.

nfs-kernel-server:

.
.
# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information,
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
RPCMOUNTDOPTS="--manage-gids --port 32767"
.
.

Why those ports? As 32767 is the highest 15bit-number, it is very unlikely that these ports are already in use by something else.

I am not using quotas, so I did not modify /etc/default/quota as suggested. And I had to reboot after I made these changes. Then I saw the result with

$ sudo netstat -nalp | grep rpc

tcp        0      0 0.0.0.0:32767           0.0.0.0:*               LISTEN      1018/rpc.mountd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      735/rpcbind
tcp        0      0 0.0.0.0:32765           0.0.0.0:*               LISTEN      806/rpc.statd
tcp6       0      0 :::32767                :::*                    LISTEN      1018/rpc.mountd
tcp6       0      0 :::111                  :::*                    LISTEN      735/rpcbind
tcp6       0      0 :::32765                :::*                    LISTEN      806/rpc.statd
udp        0      0 0.0.0.0:875             0.0.0.0:*                           735/rpcbind
udp        0      0 127.0.0.1:982           0.0.0.0:*                           806/rpc.statd
udp        0      0 0.0.0.0:32765           0.0.0.0:*                           806/rpc.statd
udp        0      0 0.0.0.0:32767           0.0.0.0:*                           1018/rpc.mountd
udp        0      0 0.0.0.0:111             0.0.0.0:*                           735/rpcbind
udp6       0      0 :::875                  :::*                                735/rpcbind
udp6       0      0 :::32765                :::*                                806/rpc.statd
udp6       0      0 :::32767                :::*                                1018/rpc.mountd
udp6       0      0 :::111                  :::*                                735/rpcbind
unix  2      [ ACC ]     STREAM     LISTENING     11412    735/rpcbind         /run/rpcbind.sock
unix  2      [ ]         DGRAM                    9521     806/rpc.statd
unix  2      [ ]         DGRAM                    9614     1018/rpc.mountd
unix  3      [ ]         STREAM     CONNECTED     11721    862/rpc.idmapd
unix  3      [ ]         STREAM     CONNECTED     11722    862/rpc.idmapd

As you can see, the ports rpc.mountd and rpc.statd are listening to are now static.

When entering showmounton the client(here 192.168.192.20), Wireshark shows the communication (server is 192.168.192.111). Important here: The GETPORT Call and the GETPORT reply, which returns Port:32767. The communication then uses this port.

Now you should be able to modify the firewall rules according, and then use showmountand autofs through firewall.

Just for the record

Following the hints in the comments and my own experience, I found different behaviour in different distributions:

In current raspbian jessie (based on debian), there is a service nfs-common (file /etc/init.d/nfs-common), which when enabled starts e.g. rpc.statd at boot, respecting the port settings in /etc/default/nfs-common.
In current Ubuntu 16.04 there is no such service. rpc.statdis not started at boot, as it is not needed with NFS V4. But as soon as mount .... -o nfsvers=3 is done, rpc.statd is started, respecting the port settings in /etc/default/nfs-common.

I did not find a consistent documentation on that; in How to configure NFS the file /etc/init.d/nfs-common is explicitly mentioned, although it is not in the package. If anyone has hints/links on that it would be richly deserved.

One more remark: man rpc.mountd and man rpc.statd say (for option --port):

"If this option is not specified, rpc.statd will try to consult /etc/services, if gets port succeed, set the same  port  for all listener socket, otherwise chooses a random ephemeral port for each listener socket."

Even when setting the ports in /etc/services (as suggested in the above mentioned wiki), this did not work. So modifying the files in /etc/default seems mandatory - the man pages are not correct at that point.


How to make APT/Aptitude prefer a more recent virtual package over a real one

Virtual packages can't help you here. From the Debian Policy Manual:

  If a relationship field has a version number attached, only real
  packages will be considered to see whether the relationship is
  satisfied (or the prohibition violated, for a conflict or breakage).
  In other words, if a version number is specified, this is a request to
  ignore all Provides for that package name and consider only real
  packages. The package manager will assume that a package providing
  that virtual package is not of the "right" version. A Provides field
  may not contain version numbers, and the version number of the
  concrete package which provides a particular virtual package will not
  be considered when considering a dependency on or conflict with the
  virtual package name.

One way out is to create minimal packages for each of the provided packages, which just depend on your actual snmp package (transitional packages). They'll be of a higher version and preferred automatically.


How about Cheese? It working fine for me as multi-shot or put some effect.


How to access media files(images/videos) received in telegram on ubuntu 14.04

Using Telegram Web

If you select to download an image Telegram Web opens a dialog where you can freely choose the storage location.

Using Telegram Desktop

If you select to download an image in Telegram Desktop there is no dialog - instead the file gets automatically stored in

~/Downloads/Telegram Desktop

Change Default settings in Telegram Desktop

You can change that by visiting the Settings in Telegram Desktop and uncheck the option Don't ask download path for each file

The settings dialog let you as well choose a default folder.

In addition there is a point Automatic media download setting which might be worth a look as well.


How to copy iphone contacts into a csv file

Use iPhone-app for contacts exporting to csv/vcf-file, then share with/copy to your cloud-app

Search in the Apple App Store for "backup contacts csv" and you will find many apps providing csv- & vcf-file export of your ipohne contacts. Free apps are good enough, no need to spend money.

The apps create csv- &/or vcf-files and provide standard iphone share methods to copy them to your favorite cloud-app (e.g. tresorit, file explorer, dropbox, icloud, etc.). From there the files are available for any operation system. Personally, I just used the app "Backup Contacts To VCF And CSV" without investigating the best app - worked!

So if it's only about exporting your iphone contacts, there's no need to install Windows+iTunes on a VirtualBox or other time consuming workarounds...


Windows 10 upgrade from Windows 7 broke GRUB

Windows 10 corrupted GRUB. Your best solution is to use Ubuntu installation media to reinstall GRUB (best bet is to run boot-repair).


Restore big folder from trash with no space on HDD

The trash is usually stored in /home/$USER/.local/share/Trash so I guess you could just poke around in there and mv what you need back out?


Ubuntu wont load after showing ubuntu logo

Use a live cd if you have it.
Boot from it and then try to reinstall Ubuntu.
The Problem could be due to messed up files on the /system folder


Don't update to Ubuntu 16.04. I was able to isolate the system failure version 16.04. I was unable to load a clean distro at all, from a 16.04 version. I am also unable to operate the PC after an upgrade of any Ubuntu distro to 16.04.

I can work the PC perfectly on multiple distros at 14.04. Fortunately I had quite a few older distros laying around on my laptop and in CDs. It is unclear what is causing the failure, the CPU, Mobo, the combo.

My specs -
ASUS: Mobo: A88xm-E
CPU:  AMD A6-7400K Radeon R5


When using windows 8 OS, there are lot of ways to speed up the system performance

Really? How? All I know is that you can

Refresh: something you don't need to do in Linux
Defragmentation: You very rarely need defragmentation, I've been using linux for about 7 years and never defraged a disk.
Viruses: very few run in Linux, you don't need an antivurus, you could install one if you want but you don't need it, not only viruses slow windows, but some antivirus slow windows even more, trust me, I tried every antivirus, every optimization method before giving up on windows!
Junk cleaners, such as Ccleaner: On Ubuntu you just do sudo apt-get autoremove and  sudo apt-get autoclean, those commands will clean stuff you don't need but won't speed up your system, because nothing can slow your system down in the first place.
If unity, the desktop, itself is slow,  you could switch to Xubuntu,
if you want something faster, you can get Openbox, there are many
options.
If your browser is slow, you could clear cache or switch to another
browser, it's something not related to Linux, in fact I find web
browsing much faster on Linux then on Windows 7. Chrome will eat all
the ram in windows 7 and become really slow, if you install plugins
and open few tabs

Now, did I miss something? Is there a way to optimize Windows that I forgot to mention?


How to display two different profiles of Firefox running under two different icons on my dashboard?

I solved this by adding classes to the desktop files:

[Desktop Entry]
Name=Firefox School
Comment=Browse the World Wide Web
Exec=firefox -P school -no-remote --class schoolProfile
Terminal=false
Type=Application
StartupNotify=true
Icon=/home/callum/Pictures/firefox-school.png
StartupWMClass=schoolProfile

[Desktop Entry]
Name=Firefox Personal
Comment=Browse the World Wide Web
Exec=firefox -P personal -no-remote --class personalProfile
Terminal=false
StartupNotify=true
Type=Application
Icon=firefox
StartupWMClass=personalProfile

and then moving the new desktop files to ~/.local/share/applications rather than just the ones in usr/share/applications


Laptop shuts-down when power ac is unplugged on Ubuntu 15.10

Hey everyone just an update on this problem, I was able to fixed it. I started to listen closely to the sounds the computer was making every time it would boot up. I noticed the fan would start and then stop completely and the computer started to get hot. What I did was, I opened up my laptop and moved the fan cables interrupting with the fan and it solved the problem. I'm not quite sure why the fan and the heat of the computer can interrupt with the computer not being able to function without being plugged in, but the problem was solved.


It turns out it was a symptom of my video card dying. Replacing the video card solved the problem


Open Disk Utility and see if you see it there.

If you do, then reformat it from there (FAT) and then mount it.


can i execute shell commands on Ubuntu from PHP, and automate what I am doing manually now?

You can run shell commands from within PHP using the shell_exec() function or using the ` ` (backtick) operator: if you're running PHP < 5.4.0, first make sure to disable safe mode, then in your PHP script you can use either of those syntaxes:

$return = shell_exec('<shell_command>');
$return = `<shell_command>`;

Unless you want to capture return values from single commands, the most straightforward way to do what you're asking for would be to condensate everything you're doing manually in the shell into a stand-alone bash (or whatever) script to be called once by using either of those methods. For example the syntax for a bash script would be:

$return = shell_exec('bash script.sh');
$return = `bash script.sh`;

To pass parameters to the script (e.g. the value of a $username variable):

$return = shell_exec("bash script.sh '$username'");
$return = `bash script.sh '$username'`;

To retrieve the passed parameters within the bash script (e.g. the value of a $username variable passed with the method above):

#!/bin/bash

# ...
username=$1
# ...

Or just simply reference $1 where needed, e.g.:

#!/bin/bash

# ...
echo "$1"
# ...


Can you mount a location in Linux as a symbol (ie. !)

I recommend you to use an alias for that task. Aliases are stored in the .bashrc file in your home directory. With the command

echo "alias cdump='cd /home/USER/SERVER/#/Dump'" >> ~/.bashrc

you can add an alias to your .bashrc. You can then change the working directory to the desired with just typing cdumpin the terminal. But you need to restart the terminal in order to make the changes usable.

And be careful to use >> since a single > would override your whole .bashrc!!


You can also copy and paste this command into the terminal (ctrl+alt+t) to open the terminal, then paste:

gksu software-properties-gtk

a window will open type in your user password then uncheck the CD-ROM boxes under the 'Other Software' tab. Close the program when you're done, and it should prompt you to reload the sources lists do that and it should work.


gnome-tweak-tool fails with error gtweak not found

Try to purge and reinstall again.

sudo apt-get remove --purge gnome-tweak-tool && sudo apt-get install gnome-tweak-tool


Try:

/var/log/upstart/JOBNAME.log

You may want to consider converting it to a task while you debug it.

start on spatial-start

task

exec /spatial/server_init.sh

then from the console:

initctl emit spatial-start
initctl status spatial-start


Are SSHDs with SATA transparent to operating system/mother board?

I have a Seagate 1TB 5400RPM 64MB SATA 9,5MM Laptop Thin SSHD 8GB Flash, ST1000LM014 in my Samsung laptop, works perfectly and the speed up is noticeable.

In theory this kind of disks should be perfectly equivalent to a normal disk at least at the basic "it works" level (it can create problems in seek optimization, but this is not in my experience).

There are some report around of problems with some Samsung disks, but my experience with the Seagate has been completely positive.


How to activate talking clock in KDE in Ubuntu 14.04

You can use crontab to get a talking clock. Edit your crontab with

crontab -e

These lines

# Minute   Hour   Day of Month       Month          Day of Week        Command
# (0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)
   *       *          *               *                 *             /bin/date '+It is \%-H and \%M'|/usr/bin/espeak >/dev/null 2>/dev/null

will tell the time every minute. (Use it for testing.)

If you want the time to be told every 15 minutes, you can replace the last line above with the following line,

   */15    *          *               *                 *             /bin/date '+It is \%-H and \%M'|/usr/bin/espeak >/dev/null 2>/dev/null

If you want another language than English, you can use the espeak option -v (and specify your language).

Please notice that

date '+It is %-H and %M'|espeak >/dev/null 2>/dev/null

(without backslashes and without full paths) works as a direct command (when not in crontab)


Operation not possible due to RF-kill, phy0 hard blocked

If that is an Asus Seashell eee-pc, check that you have wireless enabled on your BIOS.

Press F2 at boot
Select Advanced
Select Onboard Device Configuration
Set Onboard WLAN Disabled to Enabled

For some reason, it was disabled for me, and that didn't prevent me from connecting to wireless until now.


Visual corruption affecting several panel applets

Unfortunately, no one really knows of a proper solution to this yet. You can read and subscribe to bug 439448 if you're interested in updates, but be prepared for a lot of email.

At the moment, just have to kill the panel when you see it happen and hope it doesn't happen again. It's extremely difficult to debug due to the fact that it only happens every once in a while.