I have enabled hibernate but it isn't working. What can I do?

Update for 16.04 (September, 2016)

Hibernate might not work not even it is successfully enabled if you have btrfs partitions. As revealed in a question here

How can I hibernate on Ubuntu 16.04?

It was also revealed that enabling UEFI can cause problem with hibernation too.

Enable the Hibernate option

To enable Hibernate, I followed this answer from Dima.

After enabling hibernate you will have an option to hibernate in the indicator session menu at top panel. But, though you can hibernate you may not resume from hibernate. You will just be given a new session. The fixes are below.

The fixes to be able to resume from hibernate (12.04)

Several readers confirmed this working on 14.04 too

There is two way to fix this.

1. Editing the /etc/initramfs-tools/conf.d/resume file

First get the UUID of the swap partition.

 sudo blkid | grep swap

This will output a line similar to this:

/dev/sda12: UUID="a14f3380-810e-49a7-b42e-72169e66c432" TYPE="swap"

The actually line will not match with this. Copy the value of UUID in between "..." double quote.
Open the resume file

gksudo gedit /etc/initramfs-tools/conf.d/resume

And in that file, add a line like this

RESUME=UUID=a14f3380-810e-49a7-b42e-72169e66c432

Don't forget to replace the actual UUID value you get from step 1. Save the file and exit gedit
Then in terminal, execute this command

sudo update-initramfs -u

You will now be able to resume from hibernation

2. Editing the /etc/default/grub file.

Open a terminal and execute the below command to open it

gksudo gedit /etc/default/grub

There will be a line like  GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
  . Edit the line to insert RESUME=UUID=<your-uuid-value-here> after the word splash.

For example in my case, the line looks like this after editing

 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=a14f3380-810e-49a7-b42e-72169e66c432"

Make sure, you used your UUID value you get from sudo blkid | grep swap command.
Then do this command

 sudo update-grub

This also enable you to successfully get resumed from hibernate.

Tested on two Ubuntu installation, both worked


How to make VGA output display above my main screen by default?

The issue that the screen layout doesn't stick is most likely the result of a minor bug, however:

You have two options:

1. Run a background script to run your command automatically once the second screen is connected:

#!/usr/bin/env python3
import subprocess
import time

#--- set both commands (connect / disconnect) below
connect_command = "gedit"
disconnect_command = ""
#---

# function to get the output of xrandr
def get(cmd): return subprocess.check_output(cmd).decode("utf-8")
# - to count the occurrenc of " connected "
def count_screens(xr): return xr.count(" connected ")
# - to run the connect / disconnect command(s)
def run_command(cmd): subprocess.Popen(cmd)

# first count
xr1 = count_screens(get(["xrandr"]))

while True:
    time.sleep(5)
    # second count
    xr2 = count_screens(get(["xrandr"]))
    # check if there is a change in the screen state
    if xr2 != xr1:
        if xr2 == 2:
            # command to run if connected (two screens)
            run_command(["xrandr", "--output", "VGA-1", "--auto", "--above", "LVDS-1"])
        elif xr2 == 1:
            # command to run if disconnected (one screen)
            # uncomment run_command(disconnect_command) to enable, then also comment out pass
            pass
            # run_command(disconnect_command)
    # set the second count as initial state for the next loop
    xr1 = xr2

The script is an outtake of this one.

To use it

Copy the script into an empty file, save it as setup_scr.py
Test-run it by the command:

python3 /path/to/setup_scr.py

If all works as it should, add to Startup Applications: Dash > Startup Applications > Add. Add the command:

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

2. Simply add the command to a shortcut, press it after you connect the second screen:

Add shortut key: Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:

python3 /path/to/setup_scr.py

Notes

The script covers both running commands on connect- and disconnecting a screen, I left it as it was, so you have extra options.
I couldn't test, since I don't have a second screen attached currently. It should work fine, but I am sensitive to blind spots and typos...
The script, as it is, assumes no errors will occur, which means the defined screen should be the only (external) screen you use. If that is not the case, we should build in either a conditional or a try/except. If so, please mention.

In case of errors, please let me know.


If what you'd like to do is disable PulseAudio, the following steps should do it:

sudo sh -c "echo autospawn = no|tee -a /etc/pulse/client.conf"
touch ~/.pulse_a11y_nostart
sudo chmod 600 /usr/bin/pulse-session
killall pulseaudio

Note that you don't have to remove any PulseAudio-related packages to disable it.

If you'd like to temporarily disable PulseAudio, see the answer to the relevant question.


Have you Tried Using ' sudo shutdown -P now ', which halts the system then requests a power off or perhaps switching to a tty console and seeing what happens from there ? If your really in a jam you could also try ctrl+alt+del at a tty console not gnome or gnome-terminal emulator and the system should reboot. If you continue to have issues, I'd try reinstalling before making a bug-report as it could just be a goof in your installation.


Oracle 12c Installation Error: "Exception ... Could not initialize class sun.awt.X11.XToolkit"

Check if some JDK is installed in your system:

$ java -version

Installing JDK 7 solved my problem:

$ sudo apt-get install openjdk-7-jre-headless

If the problem persists, log as root, then execute:

$ xhost +

Switch back to another user and run installation again.


Can I run a Ubuntu and Windows DHCP / DNS Server together in the same network?

I will give you some thoughts and some links for further reading. Take them with several grains of salt.

DHCP

It is possible to run multiple DHCP servers on the same LAN. However they must not serve the same address pool. Reason is that DHCP is first-come-first-serve. If both machines hand out the same pool, there is a good chance to assign IPs twice.

The easiest way is to split the scope. Say, one server hands out addresses 192.168.0.1-129 and the other 192.168.0.130-254. This way no inconsistencies can arise. This is sort of the "cheap" failover way.

The proper failover method would be, if the servers are aware of each other, so that in the event that one becomes unavailable, the other jumps in. For that to work however, they both need to share a lease-file; the failover partner needs to be aware of which IPs the other one handed out before failure. As far as I know this was introduced as late as Windows Server 2012. The common ISC DHCP server supports this readily; I have seen this in action.

Unfortunately I don't think there is a way to achieve this sort of failover in a heterogeneous environment.

DNS

In principle it is no problem running multiple DNS servers. DNS intrinsically supports replication by assigning master/slave roles.

However with ActiveDirectory things become more complex, as AD relies on DDNS updates from the DHCP. I have now read quite some opinions about this topic ranging from "Not a problem" to "huge clusterfuck". See the links below.

It seems to be no problem to substitute BIND9 for Windows DNS in an AD environment. It also seems to be fine, to run BIND as a secondary along the primary Windows DNS. What I'm really skeptical about is, if they both serve DHCP too. I imagine DDNS will not work flawlessly, though dynamic updates of Windows DNS from ISC DHCP seem possible.

Further reading:

This excellent post on Serverfault about multiple DHCP.
https://serverfault.com/questions/561449/how-can-i-use-a-linux-bind-dns-server-for-my-active-directory-forest
https://serverfault.com/questions/6273/how-can-i-get-bind-and-microsoft-dns-to-work-together-well
http://ubuntuforums.org/showthread.php?t=2110181
http://www.serverlab.ca/tutorials/linux/network-services/using-linux-bind-dns-servers-for-active-directory-domains/
https://superuser.com/questions/247560/linux-dns-for-windows-domain
https://arstechnica.co.uk/civis/viewtopic.php?f=21&t=1135491
https://www.safaribooksonline.com/library/view/active-directory-cookbook/0596004648/ch18s12.html


In order for Ubuntu and Windows 7 to share files, they have to be configured to be part of the same Workgroup. Also, file sharing needs to be enabled in Ubuntu.

Install the Sharing Service in Ubuntu Linux

The sharing service or Samba as it is called in Ubuntu is not installed by default. The installation process of Samba varies in complexity depending on the method you will be using. I will show you the most easy and straightforward method to install Samba.

First, in Ubuntu, open the Home Folder, located in the Places menu.

Next, right-click on any folder from this window to open a contextual menu. From the contextual menu, click on Sharing Options.

This opens the Folder Sharing window. Check the box next to ’Share this folder’.

A warning window will pop-up stating that the sharing service is not installed. Click on the Install service button.

Note: If you do not receive this warning, it means that the sharing service is already installed and you should be able to share files and folders. To change the Workgroup, follow the instructions found in the next section.

Then type your user account password and click on OK. The installation process will begin.

In a few seconds, you will be notified that all changes have been successfully applied. Click Close and Ubuntu will ask to restart your session.

Save any open files you might have and click Restart session. After the restart, the sharing service is installed and fully functioning.

Configure and change the Workgroup in Ubuntu

In most cases you won’t have to change the Workgroup name because, by default, Ubuntu, Windows and Mac OS X have the same Workgroup name, which is actually “workgroup”. However, if you have to change it follow the steps detailed in this section.

Open a Terminal window and type the following command: gksudo gedit /etc/samba/smb.conf.

Then, press Enter. If you haven’t previously used the Terminal this session, Ubuntu will ask you to type in your user account password.

Next, the Samba configuration file will open in a gedit window. Scroll down, if necessary, until you find the workgroup line, in the Global Settings section.

Edit the Workgroup name so that it will match the name of the Workgroup you want to add your Ubuntu computer to.

Click on Save and restart Ubuntu so that the new settings get applied.

Note: If you have a network which includes Windows computers, you need to make sure the Workgroup is set up the same as on your Ubuntu computers.

To Share Files in Ubuntu
First, open the Home Folder in Ubuntu, found in the Places menu.

Browse to the folder you want to share. Right-click on it to open the contextual menu and click on Sharing Options.

The Folder Sharing window will open. Check the box next to ’Share this folder’. Then, in the Share name field, type the share name you want to use. In the Comment field type anything you want or just leave it empty - there’s no need to complete it. If you want to allow others to create and delete files in the folder you are sharing, check the box next to ’Allow others to create and delete files in this folder’. Also, if you want to allow Guest access, check the box next to ’Guest access (for people without a user account)’. When done, click on Create Share to actually share the folder.

If you have selected the option ’Allow others to create and delete files in this folder’ a pop-up shows up, asking if you want to add some permissions to the folder you are sharing. Click on the ’Add the permissions automatically’ button. Now, the folder is shared with the rest of the network.

Note: We recommend that you only share folders found or created in the Home Folder because those are folders on which your username has ownership. If you try to share a folder outside the Home Folder, you will receive the following error message: net usershare returned error 255: net usershare add: cannot share path as we are restricted to only sharing directories we own. This error appears because you don’t have ownership on those folders. In order to share any of them you have to go through a complicated procedure that has the potential to add security risks to your Ubuntu computer.

Access Ubuntu Shared Folders from Windows 7

After you shared a folder in Ubuntu, let’s see how to access that folder from a Windows 7 computer.

Open Windows Explorer. Click on Network to view a list with all computers available (turned on at that time) in the network.

Double click the Ubuntu computer you want to access. A list with all the shared folders and devices from that computer opens.

Double click the folder that you want to access. If you haven’t set up the shared folder to allow Guest access, you are asked to introduce a user name and password.

In the first input field, type the name of the Ubuntu computer followed by a backslash (“\") and the name of the user account with access to the shared folder. In the second input field type the password. If you want Windows to remember your user name and password, check the box next to ’Remember my credentials’. When done, click on OK.

Now the content of the shared folder is shown.

Reference: http://www.7tutorials.com/how-access-ubuntu-shared-folders-windows-7


MacBook install: no mountable file systems

Go to Utilities and Bootcamp assistant and use the Bootcamp assistant to create a partition for Windows and instead of installing Windows install Ubuntu on it. You must first create a Bootable USB for Ubuntu on a pendrive.


How to compile a helloworld GLib program?

Try this, I think the libs have to go after "hello_glib.c":

gcc -Wall -o hello_glib hello_glib.c $(pkg-config --cflags --libs glib-2.0)
./hello_glib

Don't ask me why, I don't know, but the order seems to be required, it was used in a recent (unrelated) patch: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/oneiric/getstream/oneiric/revision/7#debian/patches/as-needed.dpatch

You also had another error:

  test.c: In function ‘main’: test.c:6:6: warning: format ‘%s’ expects
  argument of type ‘char *’, but argument 2 has type ‘gpointer’
  [-Wformat]

I'm not a C expert, but I think you should convert the list data to a character string:

#include <stdio.h>
#include <glib.h>
int main(int argc, char** argv) {
     GList* list = NULL;
     list = g_list_append(list, "Hello world!");
     char* str = g_list_first(list)->data;
     printf("The first item is '%s'\n", str);
     return 0;
}

Happy holidays. :)


Can't login after Pantheon desktop installation on Ubuntu 18.04

Finally I got it working.

sudo add-apt-repository ppa:elementary-os/os-patches
sudo apt upgrade elementary-desktop lightdm pantheon-greeter
sudo apt update
sudo apt upgrade
reboot
login


How to make changes of config under /etc folder to take effect?

It depends of the service, but in most cases involves sudo service <service name> reload:

sudo service apache2 reload
sudo service squid3 reload
sudo service sshd reload

In the case that the operation returns:

$ sudo service motd reload
Error: argument 'reload' not supported

You can try restart.

sudo service motd restart

If that don't work too, then a combination of stop and start:

sudo service motd stop
sudo service motd start


How can I pick different locales for different locale categories

I think you should edit ~/.profile (which overrides ~/.pam_environment) instead of /etc/default/locale to achieve what you want. Please see System Settings -> Language Support -> Help -> Advanced format settings for an example.


Display brightness goes way up on suspend

I have a Dell XPS 13 that had this problem a couple of years back. The solution was to write a script that would save the current brightness setting when sleeping or hibernating, then re-apply that brightness when waking up.
Here's how you can do the same:

Open Terminal (if it's not already open)

Create a file in /etc/pm/sleep.d as root using your preferred text editor:
sudo vi /etc/pm/sleep.d/10_brightness_control

Paste the following:
#!/bin/bash
# Description: Save the brightness before sleeping and set after waking

case "${1}" in
    hibernate|sleep) before_suspend=$(cat /sys/class/backlight/*/brightness)
;;
    resume|thaw) sleep 0.33 && echo "$before_suspend" > /sys/class/backlight/*/brightness
;;
esac

Set the file as executable:
sudo chmod +x /etc/pm/sleep.d/10_brightness_control

That's all there is to it. Now, when the system goes to hibernate or sleep, the brightness level will be captured and stored in $before_suspend. When the system wakes from this state, that value will be written to all of the brightness files that exist under /sys/class/backlight/* (most computers will have just one) after 0.33 seconds. The delay takes into account situations where this script runs before the desktop environment sets its brightness level. As a result, you might have a split-second of blinding light followed by something readable.
This method has been tested and confirmed working on Ubuntu Desktop 18.04, Ubuntu MATE 18.04, Ubuntu MATE 18.10, Ubuntu Desktop 19.10, and Ubuntu Desktop 20.04.
Notes on the 10_brightness_control file:

the file can be named just about anything, but it should have two digits up front — ideally 10
the file must be in /etc/pm/sleep.d/
the file must be owned by root
sudo chown root:root /etc/pm/sleep.d/10_brightness_control

the file must be executable
sudo chmod +x /etc/pm/sleep.d/10_brightness_control

Hope this gives you what you need


The esiest way is described in official Ubuntu website.
http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows

You can also use Unetbootin in Windows 7.


how to setup terminator config file to open with multiple tabs

This answer is not using the config, but a script I wrote based on another script I wrote for my job that opens multiple Cluster SSH windows all at once.  One thing I have noticed and that is if you click on the close X in the upper right corner of Terminator it leaves the instance open for some reason and the --new-tab doesn't quite work properly.  So, you might want to run sudo pkill terminator before running the script.  But, if you do type in exit into each tab while closing it, it does close properly.
Every once in a while a terminator hangs on and won't close properly so it opens a single window with errors about key_bindings, but if I run it again it works fine.
The script:  You can name it whatever you want.  For now, mine is term_test.bsh.
#!/bin/bash

#Kill any previous Terminators.
killall -9 terminator >/dev/null 2>&1

if [[ $1 == "" ]]; then
    echo -n "Please enter number of Terminator tabs you want to open: "
    read num1
else
    num1=$1
fi

if [[ ! ${num1} || ${num1} = *[^0-9]* ]]; then
    echo "${num1} is invalid input.  Please only use numbers."
    exit 1
fi

$(terminator >/dev/null 2>&1 &) && for i in $(seq $((num1-1))); do terminator --new-tab; done
disown -a

Example:
term_test.bsh 4

Hope this helps!


"Folder sharing" says "Share name is too long"... for what?

There is a bug in the dialogue. Add another character and you'll notice the warning disappears!

The warning is there because some systems that can access Samba filesystems also have fairly extreme filename-length limits. For example you can connect to a SMB server with Windows 3.11 which has the same file restrictions as DOS.

Samba will still host the share but other people might not be able to see it. Similar rules apply if you stick restricted character (eg: a question mark) in the share name. Other POSIX systems will cope. Windows will fall over.


If you have tried everything and are still unhappy, then you obviously know the solution... Occam's Razor: With all else equal, the simplest solution is most likely the correct one. It's obviously your sound card's problem, so buy a new sound card to install on your motherboard. If you need help installing (either physical or software), all of us here on the forum would be more than happy to help! :)
Good luck! :D


Signing custom compiled kernel for Secure Boot


Since I needed the phone I went with the "wip data / factory reset" option from the recovery.

It worked as follows : all user data wiped and Ubuntu Touch restored to lattest update, that solved my problem.


Try service logitechmediaserver start. The name has changed, but not all documentation is up to date. There is a script called logitechmediaserver in your /etc/init.d/ folder. The name was changed starting with version 7.7.0.


Ubuntu cloned from HDD to SSD doesn't boot

Your question is not clear. IF you mean that you've got a 1TB HDD that's partitioned into 800G for Windows, and 200G for Ubuntu, and you've cloned the 200G Ubuntu partition to a 256G SSD, then...

Note: the order in which you implement will directly affect the outcome

yes, your UUID's will be the same, and both cannot be connected at the same time, if you expect Ubuntu to boot where you want it to
you can change the UUID on either HDD or SSD, by using gparted, and you may have to edit the new UUID into /etc/fstab
if you delete the Ubuntu partition on the HDD prematurely, you may not be able to boot at all, as the GRUB core is installed there
you can use sudo update-grub to see if it finds bootable systems on both HDD and SSD
you may have to sudo grub-install on to /dev/sdb1 to make it bootable
lastly, you'll need to use gparted to resize the partition on the SSD


Openvpn via network-manager using 2fA overwrites saved password

About a month back, I posted that the bug HAS been reported, but has had no activity. But that was moderated away.
The bug report can be found at:
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/97

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Merlijn Sebrechts Aug 14 at 20:12

I'm not sure what additional detail there is to provide beyond the fact the bug has been reported.
Some searching shows that it has been reported: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1787956


Can I install Ubuntu on a Samsung Wave 2 S8530 phone that is running Bada OS?

Supported phones: https://wiki.ubuntu.com/Touch/Devices

You are unable to install Ubuntu Touch on your phone.


How to install a thesaurus in LibreOffice?

Using the standard installation of LibreOffice you don't have to install it. It is already installed. You can right click any word choosing the entry »Synonyms«. Now you will get a list of synonyms to the selected word.
If this does not work

go to then main menu »Tool->Options«,
choose the sub menu (on the left column) »Language Settings->Writing Aids«
and then enable the option »OpenOffice.org new thesaurus« under the category »Writing Aids«.

That's it.

If this option is marked, but the thesaurus option in the tools>language menu is still grayed, then you have to perform this command using terminal:

sudo apt-get install openoffice.org-thesaurus-en-us


Unable to adjust brightness on a Sony Vaio

Edit the file /etc/default/grub.
You can do this by going to the terminal and typing:

sudo gedit /etc/default/grub

Change the line:

GRUB_CMDLINE_LINUX=""

to

GRUB_CMDLINE_LINUX="quiet splash acpi_osi=Linux acpi_backlight=vendor"

and then save and then run:

sudo update-grub

Then restart the computer, then it should work.


How to assign a value to a variable in Terminal?

The pseudocode (or code for some other shell or programming language) in your question translates to the following Bash commands:

var1='long-file-name1'
var2='long-file-name2'
diff "$var1" "$var2"

The syntax $var1 is parameter expansion. This replaces the variable var1 with its value--in this case, with the filename stored in it. Unquoted parameter expansion triggers word splitting (also called "field splitting") and globbing (also called "filename expansion" and "pathname expansion"). Usually you don't want those further expansions to occur. Except when you specifically know you want them, you should make sure to enclose all occurrences of parameter expansion in double quotes. (Single quotes are even more powerful--they would prevent parameter expansion from happening, too.)

That runs the diff command with the filename stored in var1 passed as its first command-line argument and the filename stored in var2 passed as its second command-line argument. This causes diff to compare the contents of the files, as you intend, just as it would if you had run:

diff 'long-file-name-1' 'long-file-name-2'

You will notice that I have not used the export command. That's because, in this case, the export command is neither necessary nor appropriate for what you are doing. When the value of a variable only needs to be expanded in your shell--and not accessed by programs started from your shell--then you do not need to (and should not) use export.

If your system had a strange diff command that read filenames from environment variables called var1 and var2 rather than taking filenames as command-line arguments, then you would need to export your variables. But that's not how diff works. The diff command is not accessing--and does not know anything about--your variables. The shell is expanding them to produce the arguments it then passes to diff.


Boot from a live CD.  When presented with the desktop, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below:

sudo apt-get install gparted

When the installation is done, just type:

sudo gparted

And Delete the Ubuntu install partition, and then restart the installation.


When you uninstall a program on Ubuntu, does the software leave any residue?

Ubuntu/Linux is set up in a differrent way.

Yes, traces are left behind -but- they do not impact the speed of your system.

On Linux libraries sometimes remain on your system. We call them orphans and there is a program called deborphan that removes them. But all you gain is a bit of space on your harddisk. Speed you will not gain. You get more speed by tweaking settings or by disabling services you do not use.

If you want a toolset that includes deborphan install Ubuntu Tweak.

Sometimes programs leave things there on purpose. Those tend to be settings files we manually edited. If you uninstall you have an option "--purge" that removes those while uninstalling; otherwise you are suppose to delete them your self. But again: these just take up space (and for that matter we are talking kilobytes not megabytes) and do not impact on your speed.

2 things related to speed: keep your / partition under 95% full and make sure your system does not need to swap alot. Those 2 are probably 2 main speed related issues.


How to configure Xchat and IRC server to transfer files?

The method by which files are sent in Xchat, and on IRC in general, is via Direct Client to Client (DCC).  A direct connection is established between the two relevant machines and the file is sent.  While IRC protocol allows any non-privileged ports to be used, Xchat uses ports 4990 to 5000 for DCC.

If you were sending files to machines on the Internet, since you have network address translation, you would need ports 4990 to 5000 forwarded to the machines doing the DCCs.  But since you are transferring files on your LAN, it is not necessary in this case.  If all internal routing on your LAN is open (which odds are it is, although I don't know), then the files should transfer without a problem, and without need for port forwarding or anything.

To send a file, I simply right-click a user name within Xchat and send the file.  To receive a file, I see in my main console Xchat window (usually) something like "Dennis has offered motd (122 bytes)".  I type "/dcc get Dennis motd" and the file is pulled.

The DCC file transfer in Xchat is a little buggy, if your Xchat window crashes during a file send/receive attempt, file a bug at Launchpad.  If that happens, your ~/.xsession-errors file would have be dated at or after the crash, and a line near the bottom would mention an xchat failure.


My ubuntu sony laptop connects to wifi but can't load any data

Hello To all those viewed this post. This issue was solved. People commenting on the post made me to detect the point where the error was caused.

This is what I made mistakes

  I unistall the resolvconf file

And then I tried some one's answer, Which suggested that to change the Proxy settings of the Network. I did as per his suggestion.

Then People on Reddit suggested to again install the resolvconf file. I installed manually.

But then the issue was with the Proxy change I did it. He then suggested me to change it to none and Boom the problem was solved.

And really I made so many wrong changes that I did in terminal as listed above.

Today What I learned is, first check the command for which purpose it is used to execute and then execute.

Hearty Thanks to all once again

Solved


Password not working in Graphical Applications (gksu)? Works with sudo

Open gksu-properties (Alt + F2 and type gksu-properties).
Then make sure the Authentication mode is set for "sudo".

Reference: 1.


I moved files to another location from folder "boot>efi" . Window or ubuntu not starting

You will have to move those files back somehow. The easiest way would probably be to use a working computer to make a LiveUSB and boot from that. If you choose Try Ubuntu, you'll be able to move files back to the EFI partition (which you will have to mount using Gparted or the terminal).

EFI is not something you want to mess with. It may be annoying that it keeps telling you you have low space in it, but you need to either ignore that or research which files you need or how to increase space. Don't just go moving random files. That will never end well.


ls command: Show time only (in iso-format)

You can use cut to do this job for you pretty easily

hostname$ ls --time-style=long-iso  -l | cut -f 6- -d " "
2019-02-06 02:57 Desktop/
2019-02-07 02:08 Documents/
2019-02-08 04:02 Downloads/
2019-01-29 04:04 Pictures/
2018-12-15 13:35 VirtualBox VMs/
2019-02-08 03:34 custom-repo/

As was stated in the comments, this only works under certain circumstances. However I think this is something you can do with awk as well (I in no way claim to be an awkspert :-) nor am I even close to one) but I came up with this awk solution

hostname$ ls --time-style=long-iso  -la | awk '{print $6, $7, $8, $9}'
Jan 29 08:34 .xinitrc
Dec 17 17:55 .xinitrc.bkp
Feb 8 04:21 .zcompdump
Feb 8 04:58 .zdirs
Oct 11 16:51 .zprofile
Dec 10 10:17 .zsh_history
Feb 7 01:48 .zshrc.local
Feb 6 02:57 Desktop/
Feb 7 02:08 Documents/
Feb 8 04:02 Downloads/
Jan 29 04:04 Pictures/
Dec 15 13:35 VirtualBox
Feb 8 03:34 custom-repo/

which seems to work with conditions presented in comments


How can I configure Apache2 for SSL and install a SSL certificate?

1) Stop freaking out :)

2) Do you have mod_ssl installed?

3) Do you have mod_ssl enabled in apache? (enable it through a2enmod or create symlink in modules-enabled pointing to mod_ssl in modules-available)

4) with mod_ssl there usually comes sample configuration file, the basically-configured virtual host could look like this

<VirtualHost hostname:443>
DocumentRoot /var/www/html
ServerName hostname
SSLEngine on
SSLCertificateFile /path/to/certificate.crt
SSLCertificateKeyFile /path/to/private_key.key
SSLCertificateChainFile /path/to/certificate_chain_file.crt //this isnt really necessarry, quite useful though
</VirtualHost>

For future posts: please give more useful information than "it doesn't work".


To revert to a previous proprietary Nvidia driver version we will have to remove the "updates" driver from the command line.

If we can't see a terminal we can open TTY1 with Ctrl + Alt + F1. In the terminal we log in with an administrator user and password (nothing shown on typing).

Then we can purge the "updates" driver and reboot with

sudo apt-get purge nvidia-current-updates nvidia-304-updates
sudo apt-get install nvidia-current ## only if not present
sudo reboot

This should bring us the graphical desktop back.


If normal system users are used, you simply use the system utilities: adduser, usermod, useradd, userdem, deluser, etc

If virtual users are enabled the users are managed in the file defined by the AuthUserFile directive and the groups in AuthGroupFile. The format is similar to the system passwd file and group file. You can learn more at http://www.proftpd.org/docs/howto/VirtualUsers.html


Error in Oracle 11g installation in Ubuntu 12.04LTS

Oracle installer wants to run as oracle user. So as a pre-requisite you must create the appropriate user and group:

groupadd -g 50000 dba
groupadd -g 50001 oinstall
useradd -u 50000 -m -d /local/oracle -g oinstall -G dba oracle

(where /local/oracle is the home directory, you could also use /home/oracle instead). Having that done, you can sudo su - oracle and run the installer. Make sure all pre-requisites (kernel parameter, ulimits, etc.) are met (check with the Oracle documentation for that).

Still, the installer may refuse to do its job when detecting no supported OS. I don't know if any Debian-like system is supported; on Redhat derivates (e.g. CentOS) it worked to fake the /etc/redhat-release to reflect a supported system.


It's changed to /run/user/$USER/gvfs, where $USER is your_username.
It may also be at: /run/user/$(id -u)/gvfs, where id -u is the effective user ID.
Example: /run/user/1000/gvfs.


Server 18.04: netplan and link-local addressing

You would use the netplan common property for the interface:

link-local: [ ipv4 ]

However, this property doesn't exist in your version of netplan.io (0.36), it's been added to netplan.io 0.39. I get this error on ubuntu 18.04 currently:

unknown key link-local

Documentation here:
https://git.launchpad.net/netplan/tree/doc/netplan.md

You would need to obtain a more recent build of netplan.io to use this.


This appears to be a long-standing CMake bug. Something else is going wrong, CMake gets confused, and reports this spurious problem instead of the real error.

Look for "thread" in your CMakeLists.txt file and temporarily remove that.


Attempted downgrade from GRUB2 to GRUB; can't boot into ubuntu anymore

In grub2, the commands you are looking for are linux, initrd, and boot.  For example:

linux /boot/vmlinuz-3.5.0-26-generic root=/dev/sda1
initrd /boot/initrd.img-3.5.0-26-generic
boot


How do I use GPL and MIT licenses correctly?

I should prefix this with: I am not a copyright lawyer. If you're really concerned about something, contact one. People at the FSF might be able to help you.

You should include the full text of the license. Even if you just stick it in a LICENSE file at the root of the project. I don't think anything immediately bad would happen if you didn't but in the long term (which copyright is), not having a solid reference to your license could be a bad thing.

Being explicit doesn't cost very much time.

Edit: actually the WARRANTY section might be worth including for your protection, whichever license you choose. I have no evidence to say that not including it implies a warranty, but again, be safe, not sorry.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

A copyright notice (© <date> <name>) isn't legally required in most places anymore but not including it doesn't help anyone. You'd have a harder time proving you owned copyright and it would be a lot harder for people who want to license it under different terms. I would definitely put it in there... But I guess this isn't really an issue with BSD/MIT -style licenses.

As for using a handle or nick, in other medias people have been using pseudonames for centuries. If it came to a legal suit, you'd need to be able to prove you are that person so obviously this might make it a little harder but it's not insurmountable.

If you're going MIT, you have so little legal recourse that these issues will probably never apply to you.

The year in the copyright notice isn't essential but if you wanted to sue somebody in several decades time, you'd have to prove when it was created. Which might be hard. A fixed notice helps you and costs nothing but a few seconds.

We should be clear here.

GPL allows commercial redistribution but the source code of the whole thing must be available (with changes) to anyone who purchases a copy of it .
LGPL is good for software libraries. These can be included in proprietary projects without needing to redistribute the whole source. The only time source distribution needs to happen is if they edit your code and even then, they only have to release their changes to it.
MIT code can be relicensed freely. Somebody could take your code, verbatim, and re-release it under GPL, proprietary licenses, etc.

"GPL vs MIT" is an eternal battle. Go with whatever you're actually happiest with, not what is most convenient. If you're not happy for potentially evil people to take your code and use it for potentially evil or lucrative purposes, use something where you have some recourse like GPL. If you really don't care and you're not using any GPL'd code yourself, a more liberal license like MIT would be fine.

Remember virally-open-source licenses aren't just good for you, they ensure that your work, however it's adapted and re-released is free for everybody under the same terms. Even if you're dumping the code with no interest in maintaining it, GPL gives it a better hope of remaining free.

There's no need to rush it these decisions either but you have to think of the worst possible cases to really know if you're making the right decision. Once it's released under one of these licenses, that's it, it's done.


Any good app to manage the blocking of websites?

These days I'd skip local solutions. They're trivial to  circumvent (eg, use a smartphone).

I'd be looking at local network level solutions like changing the DNS to a blocking service like OpenDNS's family filter (and change their router password to something they don't know). Not perfect, but better than nothing.

... Or talk to the ISP directly. Many offer network level parental controls.


Stop Software center from asking me to log in Ubuntu One

If you have ever logged into Software Center in a previoius version of Ubuntu, purchased any apps or music, or logged into Launchpad, or some other services, then you already have an Ubuntu One account. Ubuntu One is the single-sign-on service for Ubuntu, as well as providing other services such as file sync and music streaming, if you choose to use those services. You are not required to use the additional services if you don't want to use them.

However, in order to purchase any apps, or access the previously purchased app features of Software Center, you will need to log in to the Ubuntu One service. The e-mail address and password will be the same one you use to log in to Launchpad or which you have used in the past for Software Center, though.


Unable to change brightness with ubuntu 13.10 on ASUS 453t series (It worked with Ubuntu 13.04)

Got the workaround for this

Edit the file /etc/default/grub. Change the line:

GRUB_CMDLINE_LINUX=""

to

GRUB_CMDLINE_LINUX="quiet splash acpi_osi=Linux acpi_backlight=vendor"

and then save and then run:

sudo update-grub

Then restart the computer, then it should work.

This might allow you to reduce the brightness from 'Brightness & Lock' in system settings. But your function combination keys might not work. Though this is not a perfect solution, you can get the job done with this :-)


Uninstalling WinXP while keeping Ubuntu14.04 LTS

If you want, you can continue to use NTFS partitions from Ubuntu -- I've got a 1 TB drive that contains seven NTFS partitions that I've never gotten around to converting, even though the WinXP installed there hasn't been bootable in years.  If the amount of storage is small enough for practicality, however, I'd recommend converting the old Windows partitions to a more reliable storage format (my own preference is ext4, because its journaling greatly improves the odds of an event-free recovery if you have an unexpected shutdown, for instance due to a power drop).

Obviously, you need to start by copying any data you want to keep from the NTFS partitions to storage you won't be erasing; you should also make a complete backup of your Ubuntu installation, just in case of mistakes.

The simplest way to uninstall XP in your situation is to use Ubuntu disk management tools (gparted, for instance) to delete and replace the partition(s) occupied by Windows, or reformat those partitions to a more Linux-friendly filesystem (such as ext4, or at least FAT32 if you need to maintain compatibility with Windows for some reason).  The NTFS partitions will need to be unmounted to make partition changes (gparted offers this function), and removing the old partitions gives the option to combined them or use the freed space to expand an adjacent Ubuntu partition (such as /home or /).

If you prefer to continue to use the NTFS partitions for storage, you can shortcut this by simply erasing the entire /windows directory tree (this will get you back a couple GB of storage) and anything that contains stored Windows Update files.  Windows XP (through at least Vista and 7) however, has a bad habit of stashing stuff in other folders that may not be obviously part of Windows, which is part of why I recommend reformatting those partitions (at a minimum).

Once you're done with any partitions changes, you'll need to update your /etc/fstab to reflect the new UUID of the reformatted or recreated partition(s), else you'll get errors during boot.  Following this, you'll need to update your GRUB to reflect that there is no longer a Windows option.  Once that's done, Windows will be eradicated from your computer and you'll be ready to live a pure life (at least at home).


Croatian layout missing letters x y q w (CUI only solution required)

sudo apt-get install console-common
sudo dpkg-reconfigure console-data

Select layout from full list as suggested here.


Need help removing Ubuntu from a single boot hard disk

Do a simple google search for "how to create a windows installation media". Set the computer bios to boot with the USB drive or DVD media (whichever you choose). The installation media will take it from there.

This is not a Ubuntu issue.


Is there a way to restore all terminals at startup

I do this using screen.

I just have one terminal autostart using screen on my server. When I walk over to it i can see all the status messages already scrolling through. You can name each window too. Put the following block of text in the .screenrc file in your home directory. When you start screen it executes.

This page has .screenrc examples, including this one:

hardstatus string '%{= kg}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?% Lw%?%?%= %{g}]%{=b C}[ %d %M %c ]%{W}

screen -t rOOt 0 su -
screen -t ncmpc 1 bash
screen -t terminal 2 bash
screen -t MComander 3 mc
screen -t vimTerm 4 bash
screen -t terminal 5 bash
screen -t dropbox 6 bash

The hardstatus line gives your command windows at the bottom of the terminal, and each line below that defines the startup program.

Hope this helps!


Running Ubuntu on external drive with no internal

You starting byte of sda1 is 65535, which is the last byte of the 128th sector.  Your offset error of 3584  is 512 bytes less than 4096.  I'd guess your start should be 65536, one more, to start at a sector, and fix the offset.  Fix this and redo the install.

You can run with root privs. using the sudo command before the command, and entering your password.  If you have been using the live media to run, the ubuntu account initially has the sudo capabilities -- if you added accounts, you would need to enter them into the /etc/sudoers file (from the ubuntu account initially).

If there's nothing on the disk yet, just run the install again, and select something else, then delete the sda1 partition, and re-add it starting one sector higher,65536.  Don't use the logical volume unless you really need it, for encryption for example.  See recommendation on partitioning.  You should make a swap partition, 2G at lease, avoid /boot unless you need it (LVM for instance), make two 50G root partitions (use one, other one is for testing new releases, etc.), and a big data partition you can mount under your home directory.  Since you have room, you can also put a 500M partition up front for future use as an EFI partition (move the disk to a new machine sometime).  DOS disk partitioning limits you to 4 primary partitions, so make 3 primaries, and an extended for the rest of the logical partitions.  Ubuntu does not care what kind of partition it boot from, but I'd use ESP, root, root, extended then in extended, data and swap.


How to zero downtime restart nginx server

You need three things:

The PID of your nginx server. Stored in: /var/run/nginx.pid
A command to send a SIGHUP (1) to the process with that PID:

kill -1 $(cat /var/run/nginx.pid)

A way for node.js to send the kill. I'd go with a child process.

I'm not a Node developer. I have no way to put these together into something that makes sense, but that's what you'd do if you knew what you were doing.

Oh and your nginx server and Node.JS app need to be running as the same user to allow Node to send the signal. This is fairly easily done but may have security ramifications. You may instead want to make a SUID script for Node to call but if done carelessly, these can also have security ramifications.

Alternatively, you could use the process module to run process.kill(...). You'll still need to read in the PID for nginx and the permissions still need to be sorted.

Something like this (again, I'm still not a Node dev, so this might be syntactically incorrect):

var fs = require('fs'),
    process = require('process');

process.kill(fs.readFileSync('/var/run/nginx.pid', "utf8"), 'SIGHUP');


Allow my Kubuntu laptop to connect to wireless w/o asking for my KWallet password?

There's a way not to be prompted to type kwallet's password every time you want to use a Wireless connection.

Right click on network manager icon and select "Network management arrangement" (text may differ a little bit since I am not used an English version of Kubuntu)
Select "Other" icon from the recently opened dialog box.
Select to save the passwords on a separate unencrypted file
Apply changes

That's all. Please be warned that this option may suppose a possible security breach since all passwords are stored without encryption.


How to use Redshift without the geoclue2 provider?

You can provide your location (in terms of decimal degrees) to redshift using the -l switch, and it no longer needs geoclue.

In my case, I searched for "MY_CITY latitude longitude", entered dateandtime.info page, found the latitude and longitude of my city in decimal degrees, and provided them to redshift as indicated in the help and man page, namely redshift -l LAT:LON.

As an example, for New York, your can run redshift -l 40.71427:-74.00597.


bash: script/bash_completion_dog: No such file or directory

I have found the answer. As it turns out, there was an application called sheepdog causing the problem. I first removed the application and then entered into the directory /etc/bash_completion.d and removed the directory as follows:

sudo rm -rf sheepdog

and restarted the terminal. It worked perfectly.


Login problem - I enter password and it just asks for the password again

there's a problem with your X server. try booting in failsafe mode, and install the appropriate binary drivers for your graphics card.


Exempt programs or domain from VPN connection

Create a file, irc_route.sh, that contains:

#!/bin/bash
# script to make connections to irc.irchighway.net go via DEV.
DEV=eth0
GW=$(ip route list | sed "s/.* via \([0-9.]*\) dev $DEV.*/\1/;t;d"|head -1)
route add -host irc.irchighway.net gw $GW $DEV

Change DEV to be the interface that you get your internet connection from (might be any of wlan0, eth1, eth0, ppp0). Then run the script with sudo bash irc_route.sh, you can check the results by running ip route list before and after.

The IP of the default gateway for internet traffic on the DEV device is stored in the variable GW, which is then use to route all traffic going to the irc.irchighway.net  server through your default GW instead of the OpenVPN connection you have.

To make this work for all IRCHighWay servers you would have to get a list of all the servers.

server_list.txt:

 irc.irchighway.net
 caliburn.pa.us.irchighway.net

Script:

#!/bin/bash
# script to make connections to irchighway go via DEV.
DEV=eth0
GW=$(ip route list | sed "s/.* via \([0-9.]*\) dev $DEV.*/\1/;t;d"|head -1)
cat server_list.txt| xargs -iSERVER route add -host SERVER gw $GW $DEV

There is an "easier" solution, you can mark ports and route based on that, see iproute2 tutorial  but I haven't used that. And there are some problems with that kind of routing if you don't know what you are doing.


Why I can't access internet using an static IP address?

The default /etc/network/interfaces file only contains the loopback interface definition because desktop versions of Ubuntu use the NetworkManager service instead.

Your current configuration is missing a dns-nameservers specification, so it cannot resolve names to IP addresses.

You could add one or more dns-nameservers, however unless you have a particular reason to use the networking service, it would probably be better to revert your changes and then set up a static interface via NetworkManager's nm-applet (from the menu bar) or by invoking nm-connection-editor from a terminal - navigate to the IPV4 Settings tab and change the drop-down Method: from DHCP to Manual and then enter your desired network parameters there.


Can I install Ubuntu 32-bit and Oracle 11g R2 on a 64-bit laptop?

Yes, you can install Ubuntu 32-bit first on your 64-bit-capable laptop, and then install Oracle 11g R2 on Ubuntu.

Installing Ubuntu is the easy part; installing Oracle may be more difficult. For that, I recommend you refer to Flabricorn's excellent answer just above or below this one...


How to Install Edup 802.11n nano adapter?

With kernel 3.19 in Ubuntu 14.04
did as instructed here
and it worked


How can I prevent anything from happening when I shut the lid of my laptop?

Put HandleLidSwitch=ignore under /etc/systemd/logind.conf

You have to restart systemd daemon with restart systemd-logind or restart your laptop.


Ubuntu 18.04 repeatedly crashes on HP laptop with AMD Ryzen 3550H

Try to turn off all powersave and hibernate settings so that you do NOT do those things.
If your laptop then keeps running you have a place to start looking.


I can't stop or kill a daemon process whatever I do. It's been days now

You must find process pid and kill it by kill -9 pid.

Also you can find parent process id by this:

ps -o ppid= pid

and then kill it's parent by kill -9 parent_id


VNC grey screen after upgrade to ubuntu 13.04

Since no-one gave me the apparently simple answer, I had to find out myself.
Gnome support in Ubuntu 13 has changed such that gnome-classic has to be called as gnome-session-fallback. Hurray. Why are they making it so difficult to use the super easy and handy VNC access?

So, in ./vnc/xstartup,
replace

gnome-session --session=gnome-classic &

by

gnome-session-fallback &

And that's it to continue using your iPad on Ubuntu.

for the complete xstartup search for vnc grey screen boot 12.04


keyboard and touch pad not working hp pavilion g6 ubuntu 16.04

Im having the same problem on my girlfriends Pavilion G6, only the F keys work since the update. Keys dont work in the bios for me either. A usb keyboard plugged in is fine.

Have faffed about in keyboard config file and tried a few set ups but no joy


Software Updater not working anymore on Ubuntu 16.04

There is no way to keep python3 as default on Ubuntu 16.04, because many programs including apt are written in python2.

And there is absolutely no need to set python3 as default as you can run python3 apps using python3 appname or setting python3 in shebang.

You can set back default to python2 by running:

sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python


Ralink MT7601U (148f:7601) Wi-Fi adapter installation

I suggest you get a temporary internet connection, ethernet, tethered or whatever is available. Then do:

sudo apt-get install linux-headers-generic build-essential git
git clone https://github.com/art567/mt7601usta.git
cd mt7601usta/src
make
sudo make install
sudo mkdir -p /etc/Wireless/RT2870STA/
sudo cp RT2870STA.dat /etc/Wireless/RT2870STA/
sudo modprobe mt7601Usta

Your wireless should now be working.

You have compiled the driver for your current kernel version only. When Update Manager installs a later linux-image, after the required reboot, you must re-compile:

cd mt7601/src
make clean
make
sudo make install
sudo modprobe mt7601Usta

Please retain the files and these instructions for that time. Glad it's working!


What is the command to install `python-pil` and `x11-apps`

The Yaru repository is intended for Ubuntu, so the specification “python-pil and x11-apps” most likely refers directly to Ubuntu packages names. To install these packages, simply run:

sudo apt install python-pil x11-apps

  Which command should I use? Python 2 or 3.

Since the package names are directly specified, you don’t have to choose yourself. python-pil is a Python 2 package and you can simply check that the render-cursors.py script is written in Python 2 as it starts with:

#!/usr/bin/env python2


Ubuntu 13.10 installer not Detecting Windows 8 Partitions

Indeed, I've had the same experience with ubuntu 13.10. But, after installing the grub menu was populated with a Windows 8 entry too, and I could dual boot without any problem.


Why does lightdm-gtk-greeter not depend on lightdm?

lightdm-gtk-greeter depends on liblightdm-gobject-1-0 that contains the interface to LightDM that the greeter is using.

liblightdm-gobject-1-0 depends on lightdm  so lightdm-gtk-greeter indirectly depends on lightdm, too


I need help solving upgrade problem, "fetching upgrade failed," 12.04 to 12.10

I got the same problem 3 days ago and you have two options (considering your network connection is fine).

First option is go HERE choose your country etc. and mark your version of Ubuntu as 14.04. Then paste generated list into /etc/apt/sources.list (better backup first). Then run sudo apt-get update; sudo apt-get upgrade -y then run do-release-upgrade. It's highly possible that you also have to repair grub after that. And to do that you will need bootable CD or USB, so you simply can run your update from Live CD. And that is the second option.


There is a good tutorial on creating SAMBA shares at this location

The basic steps are

sudo apt-get update
sudo apt-get install samba
sudo smbpasswd -a <user_name>

after which the tutorial goes into sharing the file from the command line.  I instead shared my files from nautilus, and had good results.

There is a line that I have had to add to my /etc/samba/smb.conf file to get this to work with Windows 10 guests:

[global]

encrypt passwords = true

After which I did need to restart SAMBA with

sudo service smbd restart


Hard Drive Formatting and Unmounting Errors

Are you sure /dev/sda1 is not the boot partition?
You cannot unmount the partition where the system you are running is.

It would be like the coyote cutting a circle around himself with a handsaw.

Instead, boot from a [live-cd] or [usb created with the startup disk utility], and try from there.

but seriously, /dev/sda1 is usually the system partition. If you want to get rid of that you may just try to install something else on top of it.


You need to be careful when playing with sudo setup as you may end up without sudo access if something goes wrong. Using sudo visudo (it opens file in a editor and validates before overwriting the original file) add following to your sudoers file (replacing 'youruser' with your actual username):

youruser ALL=(ALL) NOPASSWD: /usr/bin/apt-get

A lot more about sudoers file is available in system manual (man sudoers) or Ubuntu's wiki: https://help.ubuntu.com/community/Sudoers


You can find installed etcher package and completely remove it by below commands.

sudo dpkg --get-selections | grep -i etcher

sudo apt purge <full package name or exact output of above command>


Issues with Broadcom wireless 4313 - brcmsmac driver is very slow

I suggest you remove the wl driver altogether:

sudo apt-get remove --purge bcmwl-kernel-source

Reboot and now tell us if brcmsmac is loaded:

lsmod | grep brcm

And tell us if it is working as expected.


Why can't I click the button to add a new user?

You must click on Unlock button in the upper-right corner first, enter your password, and then you can add/modify users.

Notice that after that, the + is now black and can be clicked, instead of gray:


Unable to login as another user after upgrading 10.04 LTS to 12.04 LTS

Based on your comment, i think the problem is with the ownership of "sashank" home folder. In the ouput of ls -la /home "sashank" folder belongs to user "sherry".

The problem is that, when you create the first user of the system, usually it stays with the user id (uid) 1000 and creates a folder in "/home", corresponding to the home folder of the newly created user. So before you upgraded your system, sashank had uid 1000. After you upgraded, probably "sherry" became uid 1000. So when you created user "sashank" it got another uid (1001, for example), and when you try to login with him it has no permission to write on his home folder (it was already there, and now belongs to "sherry").

To fix this use this command: sudo chown -R sashank:sashank /home/sashank. It will change recursively the ownership of the home folder of "sashank" account. Then logout and try to login as sashank.

This is just a guess, hope it helps.


How do I resolve slow and choppy performance in virtualbox?

Graphic/performance fix for Ubuntu was tested with Ubuntu 13.04, 12.10, and 12.04. Part of this solution applies where aero / transperancy is used including d3d games.

RAM requirements

Recommended graphic memory or virtual ram for aero based operating systems is 256 MB min.ram -768 MB for 13.04

Virtual machine settings

enable 3d support in virtualbox 3d settings
terminal commands:

/usr/lib/nux/unity_support_test -p

(Not software rendered:no, unity 3d support:No)

uname -r
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get autoremove
sudo apt-get install build-essential

now insert vitualbox guest iso from devices and to install manually follow

cd /media
ls
cd username
ls
cd VBOX*
ls
sudo ./VBoxLinuxAdditions.run

sudo gedit /etc/modules

add "vboxvideo" in the next line after lp means loop>lp>vboxvideo like this click save and file quit
restart the machine
now open the terminal to checkunity 3d is enabled or not

/usr/lib/nux/unity_support_test -p

after this shut down the machine lets increase the virtual ram
close virtual machine and virtual box
follow this path C:\Users\Username\VirtualBox VMs\ubuntu 13.04
now look for ".vbox" extension file and open it with temporarily with wordpad
look for the following lines and replace these in following manner

Display VRAMSize="128" monitorCount="1" accelerate3D="true" accelerate2DVideo="false"/>

to

Display VRAMSize="256" monitorCount="1" accelerate3D="true" accelerate2DVideo="false"/>

now you can set 256 mb virtual memory for this operating system.
any OS can be provided with desired vram this way

Reference and sources::

babarehner @ e-wrench.com and youtube

sanct on http://ubuntuforums.org/forum.php

rpxmac on forums.virtualbox.org

Related questions on Ask Ubuntu

How do I install Guest Additions in a VirtualBox VM?
How do I enable hardware virtualization technology (VT-x) for use in Virtualbox?
Ubuntu installation in VirtualBox - not using base memory in RAM


Efficient way to clear selections and select new item in KDE Dolphin in one step?

With the 'paint' ?

'Paint' one or more files - it will release the already selected files.

Left click the Dolphin/Konqueror background and move the mouse to draw the section box.


Nouveau vs Nvidia driver on Xenial 16.04

I am using nouveau driver for years now because NVidia driver does not allow me to use NVidia together with the onboard Intel graphics.

For me the nouveau has matured enough. I have not had a crash for a long time and it works fine. I remember to have crashes in the past. However, I am not a heavy graphics user. I use the computer mostly for development/programming (editors, compiling, VirtualBox, etc.), system administration (ssh) and regular office work (email, web browsing, libre office, printing, etc).

Thanks to Mark Kirby I would like to point out that I am writing about using NVidia with another GPU where both GPU are used simultaneously. For the case where notebooks have NVidia (concept called Hybrid Graphics - wiki.ubuntu.com/X/Config/HybridGraphics), the comment from Mark Kirby is valid. In that case use nvidia prime.


Why is this sed command not producing unique domains?

Many thanks to @zwets for identifying the encoding issue and fix. The weird symbols should be destroyed by doing either
iconv -f ISO-8859-2 -t UTF-8 file | sed -r 's/\r//; s/.*@([^@]+)$/\L\1/' | sort -u > output

(Based on your comments in chat)
Explanation for sed command:

.*([^@]+)$ save the characters that are not @ at the end of the line
\L lowercase everything
\1 the saved part from earlier


how to associate a filetype with a program?

You need a new mimetype for bluej files. Start a simple test to see why:

$ mimetype pacjage.bluej
pacjage.bluej: text/plain

Therefore create a new mime type

Create a new configuration via

nano ~/.local/share/mime/packages/bluej.xml
Add the configuration below

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/bluej">
    <comment>bluej file</comment>
    <glob pattern="*.bluej"/>
    <glob pattern="*.BLUEJ"/>
  </mime-type>
</mime-info>

Update the mime database

update-mime-database ~/.local/share/mime

Check the mimetype of your bluej file once again

$ mimetype pacjage.bluej
pacjage.bluej: text/bluej

For a system-wide configuration use the configuration file

/usr/share/mime/packages/bluej.xml

and update with

sudo update-mime-database /usr/share/mime


Is it safe to move boot partition and increase the / (root) space?

Let's start with the correct terms.

You want to increase /, not /root.

For some reason you have two EFI partitions: sda3 and sda6.

Probably you made a mistake, while installing Ubuntu and created an extra fat32 partition.

It looks like sda6 is not used at all. EFI partition is common for Windows and Ubuntu. You can look into it and see what is there.

Anyway you do not need two EFI partitions. You can delete sda6, if there is no Windows EFI in it. I very much doubt that there is something. It looks empty.

Even if there is Windows EFI, you can boot with Windows installation disk and fix Windows boot from there. sda3 is enough for both Ubuntu and Windows.


Any drivers(commercial) will be in 'software and updates' under additional drivers.  Can enable or disable drivers from there.


You will have to do a new clean install, sorry.


How do I delete an icon from the desktop but keep it on the launcher?

The launcher files are located in /usr/share/applications. It seems that steam created a hard-link between your desktop and launcher file. You will need to split them up.

sudo su
cd /usr/share/applications
cp <file> <file.temp>

The <file> is the steam .desktop file - since I don't know how it's called you have to look for yourself.
Now you can delete the desktop file and the file in /usr/share/applications should also be gone. Rename the temp file to its original name and you should have what you wanted.

mv <file.temp> <file>


When I copy something from another window and do "+gP gVim says 'Nothing in register g'?

The register you want to use is not g but +. So it looks like the +-sign is ignored/not typed at all.

:reg shows you the register-content.


How do you use persistence in UEFI mode?

The easiest way to create USB Live CD with persistence is to manually form the partitions using GParted.

This is what I've done:

Format your USB  with GPT partition table (though, I believe MBR should work fine as well).
Create two partitions. First is for ISO files and it should be FAT32 (~1100MB for Ubuntu 14.04). Second is for persistence and it should be ext4 with label casper-rw.
Copy files from your ISO (including hidden) to USB FAT32 partition.
Edit boot/grub/grub.cfg and just add the word persistent (This is the reason why persistence doesn't work for you in UEFI mode.):

  menuentry "Start Kubuntu" {
          set gfxpayload=keep
          linux   /casper/vmlinuz.efipersistentfile=/cdrom/preseed/kubuntu.seed boot=casper maybe-ubiquity quiet splash --
          initrd  /casper/initrd.lz
      }

It might be a little slow when you first start it especially if you use USB2.0.


You've got 2 possibilities:

Restore your System Back-up (you're definitely user type 4)
Reinstall and start making System Back-ups

There! Yhat's it.  Those are the 2 quick fixes for your system.
Anything else will lead to a lot of headaches, problems cropping up in a few days, weeks, months or even years!


Ubuntu One is syncing back files when it shouldn't

You need to turn off the auto reload file when external changes are detected in texmaker.

What I am guessing that is happening is that UbuntuOne re-writes the file for some reason and texmaker detects that reloading the just synchronized file back to its original state before saves.

At the moment texmaker does not have the option to ask you what to do when it detects an external change and just reloads the file. Turn it off for now until that option is implemented.

That should allow you to edit your files without reverting changes on detect using UbuntuOne.


How to sync a Samsung Galaxy Pro  with Banshee?

I don't have a Samsung Galaxy Pro, but I do have a Captivate which is a Samsung Galaxy S model. The Galaxy Pro is a Galaxy S II model, but there's a good chance that they interact with Ubuntu in a similar way.

In order to get syncing with Banshee to work, I needed to turn on "USB Debugging" for my phone. To do so, go to Settings > Applications > Development

Now you can connect your phone to your computer. This will add a notification on your phone. Press the "USB Connected" notification.

This will bring up a new screen. Press "Connect to USB storage."

Ubuntu should now prompt you to open the phone in Banshee.

You should now be able to sync music from Banshee to your phone.


I am writing an iPhone Notes Client, can I integrate it with Ubuntu One?

I'm only going to answer about Ubuntu One; your question is actually several questions rolled into one, and I can only answer for what I know.

You can't use the Ubuntu One logo as your application icon. You can, however, use the Ubuntu One logo and name within your application if your intention is to use it to indicate a “works with Ubuntu One”, as long as you don't do anything obviously nasty.

We will have a specific “works with Ubuntu One” soon, but meanwhile please use some text such as “works with” and the icon.

If you need any special sizes or colours please contact us in private.

Hoping to see your app live soon!


Hah, you have a root shell already. Type passwd *insert-your-username-here*, and enter a new password.


The utterly simplest way is to install the Desktop version, then delete the un-needed apps in one pass with Synaptic. Select all excess applications, and have Synaptic do the work for you of removing the apps and their dependencies.

Otherwise, Ubuntu-Builder https://launchpad.net/ubuntu-builder allows you to strip out apps and dependencies, pre-installation. There's an established explanation here at How to customize the Ubuntu Live CD?


In gnome-terminal only 2 out of 3 zoom keys work

The default shortcut for restoring the zoom in gnome-terminal, as in many other apps, is Ctrl + 0 (zero)

You can alter it in gnome-terminal's preferences, that is, neither in inputrc nor among the global desktop-wide shortcuts.


A new SSD with copied partitions and UEFI dual bootable

I would set up the new disk with an EFI partition.  It wont take up much space, and gives you the ability to easily move the disk without having to change existing parition sizes to add an ESP later.  I would use the --removable on the grub-install to put a copy of the grubx64.efi bootloader into /EFI/Boot/bootx64.efi. (If you are using secure boot, you theoritically should use --uefi-secure-boot, but last time I tried it, that did nothing, instead of putting shimx64.efi in /EFI/Boot/bootx64.efi and a copy of grubx64.efi. So you'll still have to manually copy in the correct files).

Your other potential problem is the disk caddy.  Grub may have problems when the caddy is present -- like freezing for a minute, or maybe indefinitely.  This may occur even if the caddy is not used for boot.  A workaround is to have a device like USB you can put earlier in the boot order than the hard disks, but you might still not be able to reference the caddy until you boot, so good luck.  The caddy will still be usable as a storage device.

See the comment about moving the files.  Nothing special for an
SDD in a caddy.


According to info -f grub -n 'Simple configuration' you can also set

GRUB_TIMEOUT_STYLE=hidden

instead of the following, which are (or will be) deprecated:

GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true

Don't forget to apply changes when you're done:

sudo update-grub


What's the typical algorithm that is follwed when installing a debian package with dpkg?

dpkg  is  a  tool to install, build, remove and manage Debian packages.
         The primary and more user-friendly front-end for dpkg  is  aptitude.
         dpkg  itself  is controlled entirely via command line parameters, which
         consist of exactly one action and zero or  more  options.  The  action-
         parameter tells dpkg what to do and options control the behavior of the
         action in some way.

  -i, --install package-file...

  Install the package. If --recursive or -R option  is  specified,
     package-file must refer to a directory instead.

  Installation consists of the following steps:

  Extract the control files of the new package.
  If  another version of the same package was installed before
            the new installation, execute prerm script of the old package.
  Run preinst script, if provided by the package.
  Unpack the new files, and at the same time back  up  the  old
            files, so that if something goes wrong, they can be restored.
  If  another version of the same package was installed before
            the new installation, execute  the  postrm  script  of  the  old
            package.  Note  that  this  script is executed after the preinst
            script of the new package, because new files are written at  the
            same time old files are removed.
  Configure   the   package.  See  --configure  for  detailed
            information about how this is done.

  -configure package...|-a|--pending

  Configure  a  package  which  has  been  unpacked  but  not  yet
                configured.  If -a or --pending is given instead of package, all
                unpacked but unconfigured packages are configured.

  To reconfigure a package which has already been configured,  try
                the dpkg-reconfigure(8) command instead.

  Configuring consists of the following steps:

  Unpack  the  conffiles, and at the same time back up the old
            conffiles, so that they can be restored if something goes wrong.
  Run postinst script, if provided by the package.

Also Visit:  1,2,3,4,5 & 6.

Refer PACKAGE STATUS, PACKAGE SELECTION STATUS & PACKAGE FLAGES From manual.


As you have seen, 0 is fully transparent. 255 would be fully opaque.


baloo_file_extr process extremely slows down computer for several minutes at startup with Ubuntu 20.04

To disable baloo: Open $HOME/.kde4/share/config/baloofilerc and change the option 'Indexing-Enabled=true' to 'Indexing-Enabled=false'


I assume there's a shortcut for external monitor connection. Usually it toggles between different modes (builtin only, clone, 2 desktops, external only).

Do this until you got clone mode and open the System Settings.

If you can, change the resolution of the external monitor to its correct values. If not, check whether the external monitor is set up correctly.


Drop cache job with certain condition gives error in crontab

The issue is likely that flock is using the value of $SHELL inherited from cron in order to execute the flock -c 'command':
$ echo $SHELL
/usr/bin/zsh

$ flock -n /tmp/mylock -c 'echo $0'
/usr/bin/zsh

$ SHELL=/bin/sh flock -n /tmp/mylock -c 'echo $0'
/bin/sh

In Ubuntu, cron uses /bin/sh by default, which (unlike /bin/bash) doesn't support your numerical expression ex.:
$ bash -c 'if ((2 > 1)); then echo Yes; fi'
Yes

whereas
$ sh -c 'if ((2 > 1)); then echo Yes; fi'
sh: 1: 2: not found

You can assign SHELL=/bin/bash in your crontab file, however since your command is somewhat complex I'd suggest creating a standalone bash script for it (with the appropriate #!/bin/bash shebang) and calling that as the flock -c command instead.


You shouldn't worry much about viruses in Linux. However, you should still be careful at scam websites that steal info and such.

If you really need want to be extra safe just install an antivirus software.
Clam AV Virus Scaner is found in Ubuntu Software Center.

For more lecture: http://en.wikipedia.org/wiki/Linux_malware

Viruses are also kept off because of Ubuntu using a central software repository, so that software is checked for being virus-free. This is a good safety feature unless you use software repositories by other people. You should always check if they are trustworthy.

Security bugs also get fixed very fast, because of a lot of people able to fix and actually fixing these, due to Open Source Software.


How do I get an Ralink 3290 wireless card to work?

To fix this, all I did was clone the kernel firmware git repo, copy rt3290.bin from the firmware repo to /lib/firmware, and upgrade the kernel to 3.6.11.

This fix only works on Ubuntu 12.04.


ubuntu 18.04 how do I install drivers for my NVIDIA GeForce GTX 1050?

First option is to go into software and updates. When you are in software and updates, go to the additional drivers page. Wait for a second until it has loaded and see if there are any options there.

The second option is to download it through the terminal. First of all, check the exact graphics card with:

ubuntu-drivers devices

Find the recommended driver and type the command:

sudo apt install nvidia-(driver-number)

Or type the command:

sudo ubuntu-drivers autoinstall


Editing Premission denied on Windows 10 File

If you hibernate your Windows session the Windows disk will be locked and Linux will not be able to write to it. Similarly if fast boot is enabled the Windows disk is locked when you shut Windows down. Avoid both of these situations and Linux can happily share files with Windows


Let me try to explain it, to answer the cd situation. Now we have . -- current directory, then / -- root directory, now remember that the / is used in Linux to indicate absolute path and not relative path, when it starts the path address. Now in your case;

When you use cd folder_name you are using the relative path address to that (current) directory so no need to specify the path, your already in there.
When you use cd ./folder_name it says move me into the folder with name folder_name in the current (.) directory.
You run a program in current directory ., with ./program.sh says -- don't bother searching in the standard paths look in the current . folder. This is standard Linux setup.
In addition (thanks to Sergiy), other thing that I would add is that when using globstar to deal with files one should use ./ because it is safer. Say you run something like ls *, and you have filename like -231.txt. The ls command will think that -2 is a command switch, but there's on switch like that on ls , so you'll get an error. With ls ./* it will work without problems. So, ./ is used not only for cd somewhere or running script


Can I edit the sudoers file with visudo using my bootable USB

Yes it should work. Just be sure you have mounted the root partition of your system and chroot to it before running visudo.


When I open Terminal it says command alias not found and closes

My guess is that you might have copied and pasted these lines from the guide as-is:

echo “alias android-connect=\”mtpfs -o allow_other /media/GalaxyNexus\”" >> ~/.bashrc

echo “alias android-disconnect=\”fusermount -u /media/GalaxyNexus\”" >> ~/.bashrc

With those special speech marks (also known as smart quotes) having a different meaning to the terminal than regular speech marks, the commands are radically altered from the original intent.

I suggest you check the end of ~/.bashrc for those suspect alias lines, remove them if they are there, and reopen the terminal.


Slow Internet Connection using Wifi On ubuntu Mate 15.10

If the wifi network is slow in ubuntu but in Windows everything works fine it's because of the power management of the wifi card; you can switch the power management off by adding this line

iwconfig wlan0 rate 54M

at the bottom in your /etc/rc.local; of course rc.local must be executable.

If you do this remember to disable the wifi power management in tools like laptop mode tools or tlp if you have them installed.


MATE 18.10 Live CD on W10 Asus Zenbook (501VW) - hangs on boot

Installation successful using the following :

 First boot device UEFI Generic Flash with 18.10
 Fast boot disabled
 CSM enabled
 Secure boot disabled

The issue is apparently that the installer does not have the driver for the video card on board. To get around that:

At the Grub menu,

select the option to install
press 'e' at the option to install.
move cursor down to the boot parameter line and at the end of that line enter nomodeset` and proceed with the boot.

With nomodeset the installation screens were mildly distorted but readable and responsive. The installer loaded the correct drivers and all is now well.


In the end, I found a PHP 5.4 PPA (at ppa:ondrej/php5), and decided to test that with the few webapps I run on that VPS. All seemed well (aside from vBulletin's upgrade system, but I have a workaround for that), so I've skipped the 5.3 series altogether and switched to 5.4. Probably won't be upgrading to 12.04LTS yet, although at least I now know that it's possible, and how to do it :-)


how to have internet access in ubuntu in virtualbox via bridged network?

Choose bridged network adapter and choose your wifi card. Refresh mac address on that view (it's under advanced options) and it should work. If your host has Internet, virtual box machine should have it also


Installing old Loki games on 12.04 64-bit results in no audio

Copy all the contents form the cd somewhere in your home folder.

Right click on setup.sh and change it to be executable.

Open terminal in that directory and type:

sudo linux32 bash setup.sh

Say "y" to every question (to install all game data) except after install when the game ask to start as root.

Close the terminal and reopen it. Type heroes3 to start the game. The game will start but there is the problem with the sound. In 1999, Pulse audio doesn't exist. I don't know how to fix the audio problem.


How do I get wireless usb adapter TL-WN727N working in 12.04?

Please see posts #2 and #4 here:  http://ubuntuforums.org/showthread.php?t=1800178&highlight=rt5370sta The location of the file has changed to here; see RT8070 /RT3070 /RT3370 /RT5370 /RT5372 USB:  http://www.ralinktech.com/en/04_support/support.php?sn=501

Or you could upgrade to 12.10 where is is supported by default with rt2800usb.


Synaptic has been known to be susceptible to accessibility settings. You can fix the problem by opening Universal access and then disabling the screen reader. If the screen reader is already disabled, then enabling it and then disabling it once again will fix the problem.

Alternatively, you can run the following command in a terminal to fix the problem:

gsettings set org.gnome.desktop.interface toolkit-accessibility false


Screen goes blank when installing Ubuntu on Asus Zenbook UX31A

I found the same issue. I had to enable CSM in the bios. However, it'll be grayed out if you started the PC without the live usb already connected. So, full tutorial that worked for me:

Dissable FastStartup.
Dissable FastBoot. To do this, you need to restart windows 8. You cannot turn it off/on manually, since the new "turn off" is actually hibernate. Make sure that you connect the live usb before restarting it.
Enable CSM in the boot menu.
Select your usb as main boot device.
Proceed as normally.

I added some extra info back in the Ubuntu Asus Zenbook Prime wiki.


How to have `ll` command not display hidden files

Open the file .bashrc in your home directory. The should be an entry which looks like:

alias ll='ls -la'

Remove the last a, save the file and open a new shell. Now ll should work as want you. If you do not find the line, you can add it to your .bashrc:

alias ll='ls -l'


Allow X Packets per second with same data length - IPTables

Using the iptables recent module, in a two step process, 10 per second can be detected, and then a longer ban time can be set. A script was made for this:

#!/bin/sh
FWVER=0.01
#
# gamer-cs iptables rule example. Smythies 2017.09.13 Ver:0.01
#     Protocl: UDP
#     Destination port: 27015
#     Length: 100 payload. The UDP header is always 8 bytes in length.
#                 The IP header is typically 20 bytes but can be longer.
#
#     Ban by IP or ban all?:
#            Ban by IP via a two step process, can ban for any desired time.
#            Ban all can use the built in rate limit stuff, but then the ban
#            time can not exceed the rate limit window and it has a tendency
#            to block legitamite users.
#
#     Probably needs to be combined with the bigger context of other rules.
#
#     See also:
#     https://askubuntu.com/questions/955425/allow-x-packets-per-second-with-same-data-length-iptables
#            And other questions from gamer-cs.
#
#     https://askubuntu.com/questions/818524/correctly-limit-ip-connections
#     https://chat.stackexchange.com/transcript/51426/2017/1/9
#
#     run as sudo
#

echo "Loading gamer-cs rule example version $FWVER..\n"

# The location of the iptables program
#
IPTABLES=/sbin/iptables

# Some definitions.
# Some of these are for the Smythies test computer. Change as required.
EXTIF="enp9s0"
EXTIP="192.168.111.104"
PORT_TO_CHECK="27015"
UNIVERSE="0.0.0.0/0"

#Clearing any previous configuration
#
echo "  Clearing any existing rules and setting default policies.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -F FORWARD
# Otherwise, I can not seem to delete it later on
$IPTABLES -F ADD_TO_LIST
# Delete user defined chains
$IPTABLES -X
# Reset all IPTABLES counters
$IPTABLES -Z

#######################################################################
# USER DEFINED CHAIN SUBROUTINES:
#
# ADD_TO_LIST
# Called from the rate checker.
# Add the IP address to the bad guy list, and DROP the packet.
# If desired, comment out the log rule.
# Rate limit the logging.
$IPTABLES -N ADD_TO_LIST
$IPTABLES -A ADD_TO_LIST -m recent --set --name BADGUY_LIST
$IPTABLES -A ADD_TO_LIST -m limit --limit 3/m --limit-burst 2 -j LOG --log-prefix "BAD_ADD:" --log-level info
$IPTABLES -A ADD_TO_LIST -j DROP

# I (Smythies) need the following rule to prevent my ssh sessions from being locked out
# while testing/debugging
#
$IPTABLES -A INPUT -i $EXTIF -s $UNIVERSE -d $EXTIP -m state --state ESTABLISHED,RELATED -j ACCEPT

# Other INPUT chain rules might be needed before this, not sure.
#
# If on the bad guy list, then drop regardless. Limit logging (If desired, comment out the log rule).
$IPTABLES -A INPUT -i $EXTIF -m limit --limit 3/m --limit-burst 2 -m recent --rcheck --hitcount 1 --seconds 3600 --name BADGUY_LIST -j LOG --log-prefix "BAD GUY:" --log-level info
$IPTABLES -A INPUT -i $EXTIF -m recent --update --hitcount 1 --seconds 3600 --name BADGUY_LIST -j DROP
# Do the actual rate limiting check
$IPTABLES -A INPUT -i $EXTIF --protocol udp --destination-port $PORT_TO_CHECK -m length --length 128 -m recent --update --hitcount 10 --seconds 1 --name BAD_OR_NOT -j ADD_TO_LIST
$IPTABLES -A INPUT -i $EXTIF --protocol udp --destination-port $PORT_TO_CHECK -m length --length 128 -m recent --set --name BAD_OR_NOT -j ACCEPT
# O.K. at this point, carry on with other INPUT chain rules.

echo "gamer-cs rule example version $FWVER done.\n"

Testing was done using hping3 from another computer. First:

sudo hping3 --quiet -c 50 --udp --data 100 --destport 27015 --interval u101000 --spoof 192.168.111.249 192.168.111.104

Sent packets at just under the 10 per second rate limit, The source IP was spoofed to prevent my real IP from getting locked out. Result (hint: exactly as expected):

$ sudo iptables -v -x -n -L
Chain INPUT (policy ACCEPT 10 packets, 984 bytes)
    pkts      bytes target     prot opt in     out     source               destination
      37     2152 ACCEPT     all  --  enp9s0 *       0.0.0.0/0            192.168.111.104      state RELATED,ESTABLISHED
       0        0 LOG        all  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            limit: avg 1/min burst 2 recent: CHECK seconds: 3600 hit_count: 1 name: BADGUY_LIST side: source mask: 255.255.255.255 LOG flags 0 level 6 prefix "BAD GUY:"
       0        0 DROP       all  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            recent: UPDATE seconds: 3600 hit_count: 1 name: BADGUY_LIST side: source mask: 255.255.255.255
       0        0 ADD_TO_LIST  udp  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            udp dpt:27015 length 128 recent: UPDATE seconds: 1 hit_count: 10 name: BAD_OR_NOT side: source mask: 255.255.255.255
      50     6400 ACCEPT     udp  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            udp dpt:27015 length 128 recent: SET name: BAD_OR_NOT side: source mask: 255.255.255.255

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 57 packets, 8528 bytes)
    pkts      bytes target     prot opt in     out     source               destination

Chain ADD_TO_LIST (1 references)
    pkts      bytes target     prot opt in     out     source               destination
       0        0            all  --  *      *       0.0.0.0/0            0.0.0.0/0            recent: SET name: BADGUY_LIST side: source mask: 255.255.255.255
       0        0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 1/min burst 2 LOG flags 0 level 6 prefix "BAD_GUY:"
       0        0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

Second:

sudo hping3 --quiet -c 50 --udp --data 100 --destport 27015 --interval u98000 --spoof 192.168.111.249 192.168.111.104

Sent packets at just over the 10 per second limit. Result (hint: exactly as expected):

$ sudo iptables -v -x -n -L
Chain INPUT (policy ACCEPT 16 packets, 1798 bytes)
    pkts      bytes target     prot opt in     out     source               destination
      55     7648 ACCEPT     all  --  enp9s0 *       0.0.0.0/0            192.168.111.104      state RELATED,ESTABLISHED
       0        0 LOG        all  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            limit: avg 1/min burst 2 recent: CHECK seconds: 3600 hit_count: 1 name: BADGUY_LIST side: source mask: 255.255.255.255 LOG flags 0 level 6 prefix "BAD GUY:"
      39     4992 DROP       all  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            recent: UPDATE seconds: 3600 hit_count: 1 name: BADGUY_LIST side: source mask: 255.255.255.255
       1      128 ADD_TO_LIST  udp  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            udp dpt:27015 length 128 recent: UPDATE seconds: 1 hit_count: 10 name: BAD_OR_NOT side: source mask: 255.255.255.255
      60     7680 ACCEPT     udp  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            udp dpt:27015 length 128 recent: SET name: BAD_OR_NOT side: source mask: 255.255.255.255

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 86 packets, 13585 bytes)
    pkts      bytes target     prot opt in     out     source               destination

Chain ADD_TO_LIST (1 references)
    pkts      bytes target     prot opt in     out     source               destination
       1      128            all  --  *      *       0.0.0.0/0            0.0.0.0/0            recent: SET name: BADGUY_LIST side: source mask: 255.255.255.255
       1      128 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 1/min burst 2 LOG flags 0 level 6 prefix "BAD_GUY:"
       1      128 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

Third:

$ sudo hping3 --quiet -c 50 --udp --data 100 --destport 27015 --interval 5 --spoof 192.168.111.249 192.168.111.104

Check the limited logging using a slow packet rate, having earlier triggered the blocking rule. Result:

$ sudo iptables -v -x -n -L
Chain INPUT (policy ACCEPT 36 packets, 2671 bytes)
    pkts      bytes target     prot opt in     out     source               destination
     129     7848 ACCEPT     all  --  enp9s0 *       0.0.0.0/0            192.168.111.104      state RELATED,ESTABLISHED
      10     1280 LOG        all  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 2 recent: CHECK seconds: 3600 hit_count: 1 name: BADGUY_LIST side: source mask: 255.255.255.255 LOG flags 0 level 6 prefix "BAD GUY:"
      89    11392 DROP       all  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            recent: UPDATE seconds: 3600 hit_count: 1 name: BADGUY_LIST side: source mask: 255.255.255.255
       1      128 ADD_TO_LIST  udp  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            udp dpt:27015 length 128 recent: UPDATE seconds: 1 hit_count: 10 name: BAD_OR_NOT side: source mask: 255.255.255.255
      60     7680 ACCEPT     udp  --  enp9s0 *       0.0.0.0/0            0.0.0.0/0            udp dpt:27015 length 128 recent: SET name: BAD_OR_NOT side: source mask: 255.255.255.255

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 208 packets, 31104 bytes)
    pkts      bytes target     prot opt in     out     source               destination

Chain ADD_TO_LIST (1 references)
    pkts      bytes target     prot opt in     out     source               destination
       1      128            all  --  *      *       0.0.0.0/0            0.0.0.0/0            recent: SET name: BADGUY_LIST side: source mask: 255.255.255.255
       1      128 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 2 LOG flags 0 level 6 prefix "BAD_ADD:"
       1      128 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

The last few related /var/log/syslog entries:

Sep 14 08:52:29 cyd-hp2 kernel: [778611.743160] BAD GUY:IN=enp9s0 OUT= MAC=00:26:9e:90:10:8d:f4:6d:04:65:2d:8e:08:00 SRC=192.168.111.249 DST=192.168.111.104 LEN=128 TOS=0x00 PREC=0x00 TTL=64 ID=16043 PROTO=UDP SPT=1682 DPT=27015 LEN=108
Sep 14 08:52:49 cyd-hp2 kernel: [778631.742076] BAD GUY:IN=enp9s0 OUT= MAC=00:26:9e:90:10:8d:f4:6d:04:65:2d:8e:08:00 SRC=192.168.111.249 DST=192.168.111.104 LEN=128 TOS=0x00 PREC=0x00 TTL=64 ID=41223 PROTO=UDP SPT=1686 DPT=27015 LEN=108
Sep 14 08:53:09 cyd-hp2 kernel: [778651.741012] BAD GUY:IN=enp9s0 OUT= MAC=00:26:9e:90:10:8d:f4:6d:04:65:2d:8e:08:00 SRC=192.168.111.249 DST=192.168.111.104 LEN=128 TOS=0x00 PREC=0x00 TTL=64 ID=37530 PROTO=UDP SPT=1690 DPT=27015 LEN=108

EDIT

If the objective is to NOT be source IP address specific, then version 2 below is suggested. It makes use of the --mask option with a mask of 0.0.0.0 to make the DROP criteria non source IP specific. However then the DROP criteria must include the original conditions, because IP address is no longer a useful bad guy identifier:

#!/bin/sh
FWVER=0.02
#
# gamer-cs iptables rule example. Smythies 2017.09.14 Ver:0.02
#     use the --mask option to eliminate any specific IP address.
#     However, then only DROP packets that meet the criteria,
#     otherwise a mess will occur.
#
# gamer-cs iptables rule example. Smythies 2017.09.13 Ver:0.01
#     Protocl: UDP
#     Destination port: 27015
#     Length: 100 payload. The UDP header is always 8 bytes in length.
#                 The IP header is typically 20 bytes but can be longer.
#
#     Banning is a two step process, using the recent module,
#     and can then ban for any desired time.
#
#     Probably needs to be combined with the bigger context of other rules.
#
#     See also:
#     https://askubuntu.com/questions/955425/allow-x-packets-per-second-with-same-data-length-iptables
#            And other questions from gamer-cs.
#
#     https://askubuntu.com/questions/818524/correctly-limit-ip-connections
#     https://chat.stackexchange.com/transcript/51426/2017/1/9
#
#     run as sudo
#

echo "Loading gamer-cs rule example version $FWVER..\n"

# The location of the iptables program
#
IPTABLES=/sbin/iptables

# Some definitions.
# Some of these are for the Smythies test computer. Change as required.
# The external interface name:
EXTIF="enp9s0"
# The external IP address
EXTIP="192.168.111.104"
# Obvious
PORT_TO_CHECK="27015"
UNIVERSE="0.0.0.0/0"

#Clearing any previous configuration
#
echo "  Clearing any existing rules and setting default policies.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -F FORWARD
# Otherwise, I can not seem to delete it later on
$IPTABLES -F ADD_TO_LIST
# Delete user defined chains
$IPTABLES -X
# Reset all IPTABLES counters
$IPTABLES -Z

#######################################################################
# USER DEFINED CHAIN SUBROUTINES:
#
# ADD_TO_LIST
# Called from the rate checker.
# Add the IP/0 address to the bad guy list, and DROP the packet.
# If desired, comment out the log rule.
# Rate limit the logging.
$IPTABLES -N ADD_TO_LIST
$IPTABLES -A ADD_TO_LIST -m recent --mask 0.0.0.0 --set --name BADGUY_LIST
$IPTABLES -A ADD_TO_LIST -m limit --limit 3/m --limit-burst 2 -j LOG --log-prefix "BAD_ADD:" --log-level info
$IPTABLES -A ADD_TO_LIST -j DROP

# I (Smythies) need the following rule to prevent my ssh sessions from being locked out
# while testing/debugging
#
$IPTABLES -A INPUT -i $EXTIF -s $UNIVERSE -d $EXTIP -m state --state ESTABLISHED,RELATED -j ACCEPT

# Other INPUT chain rules might be needed before this, not sure.
#
# If there has been any actitivity on the bad guy list in the timeout time, then DROP any packet that meets the crieria. Limit logging (If desired, comment out the log rule).
$IPTABLES -A INPUT -i $EXTIF --protocol udp --destination-port $PORT_TO_CHECK -m length --length 128 -m limit --limit 3/m --limit-burst 2 -m recent --mask 0.0.0.0 --rcheck --hitcount 1 --seconds 3600 --name BADGUY_LIST -j LOG --log-prefix "BAD GUY:" --log-level info
$IPTABLES -A INPUT -i $EXTIF --protocol udp --destination-port $PORT_TO_CHECK -m length --length 128 -m recent --mask 0.0.0.0 --update --hitcount 1 --seconds 3600 --name BADGUY_LIST -j DROP
# Do the actual rate limiting check
$IPTABLES -A INPUT -i $EXTIF --protocol udp --destination-port $PORT_TO_CHECK -m length --length 128 -m recent --mask 0.0.0.0 --update --hitcount 10 --seconds 1 --name BAD_OR_NOT -j ADD_TO_LIST
$IPTABLES -A INPUT -i $EXTIF --protocol udp --destination-port $PORT_TO_CHECK -m length --length 128 -m recent --mask 0.0.0.0 --set --name BAD_OR_NOT -j ACCEPT
# O.K. at this point, carry on with other INPUT chain rules.

echo "gamer-cs rule example version $FWVER done.\n"


On grub screen (if it does not show up automatically, you should press F2 or SHIFT+F2 on boot, if I am not wrong) choose Ubuntu recovery mode, then try to recover damaged packages (there is an on screen option). If this does not work, from the recovery mode open a root shell and install X11 (sudo apt-get install xorg)


I can't boot of Ubuntu OS when my Windows 7 hibernates

First, it's important to understand the technical reasons why what you are are hoping to achieve is likely infeasible. When you hibernate Windows the computer writes everything in memory to the harddrive and powers off the computer. When hibernating, any changes to the disk could corrupt the install and render your computer unusable. Therefore, hibernation is specifically designed NOT to allow you switch between OSes while one is hibernating.

That being said, see  https://superuser.com/questions/46299/is-it-possible-to-enable-hibernation-when-dual-booting-windows

Depending on your setup you should be able to use your BIOS boot menu to switch between OSes when hibernating.

This relies on you having installed each OS on different physical drives.