I change the last line in /etc/passwd and I can't use sudo Here is what I have done:

Change a username in the last line: tiny to abc

tiny@tty7:~$ sudo vim /etc/passwd
Change this:
tiny:x:1000:1000:tiny,,,:/home/tiny:/bin/bash
to this:
abc:x:1000:1000:tiny,,,:/home/tiny:/bin/bash

tiny@tty7:~$ sudo vim /etc/shadow

it shows: [sudo] passwork for abc:
I didn't change my password but it can't login root!
I type Ctrl+Alt+F1 to tty1 but neither tiny or abc can't login with my password

and I try to look at ls ～ -la, here it shows like this:

drwxr-xr-x 28 abc tiny  4096 Apr  6 03:04 .

How can I login root? and why the user name in prompt tiny@tty7 still be tiny while in sudo it show the abc's password?

You must NEVER edit your passwd file manually because you will mess things up.

The proper way to change your username is:

usermod -l newUsername oldUsername

Then change home folder:

usermod -d /home/newHomeDir -m newUsername

To change password you should use:

sudo passwd yourusername

I suggest you to revert your passwd file back, or if you can't edit it because you can not login with root - then boot with live cd and revert the file back. Then use the proper way.

procedure for changing your username (but not uid) by hand:

have your head examined, when that fails proceed to step two.
edit shadow file duplicating the user line with new username.
edit groups, sudoers, allowing new username permissions, keep old
symbolically link home directory to new name
edit passwd file changing username and home directory
edit shadow, sudoers, groups to remove old entries we kept in step three
edit aliases and other references to old username.
logout, switch to a text console (the next step will not work if any programs are running in users home directory, including window managers)
cd  to a directory above your home directory.
remove symbolic link, and rename home directory.
logout and login as normal.

Things are much simpler to change others username, although still not simple.


ThinkPad X61 wireless failure With a ThinkPad X61 and Lubuntu 14.04.1, wireless fails to connect but Ethernet is AOK.
Multiple SSIDs are seen, in tests at multiple locations, but entering their keys do not enable connection.
Open access points also fail.
Same key works well on other Thinkpad.
MAC address filtering is not on in the gateway (SMC D3GNV).
Problem replicated with a different distro booted from flashdrive.

sudo modprobe -r iwlwifi fails with

  modprobe: FATAL: Module mac80211 is in use,
  modprobe: FATAL: Error running remove command for iwlwifi

sudo modprobe -r iwl4965

and

sudo modprobe iwl4965

both execute with no errors or messages,

sudo service network-manager restart

wants me to pick SSID and give WPA key. But, that does not fix problem, issue persists.

rfkill returns:

  0:hci0: Bluetooth
     Soft blocked: no
     Hard blocked: no
  1:tcacpi_bluetooth_sw:Bluetooth
      Soft blocked: no
      Hard blocked: no
  2:phy0:Wireless LAN
   Soft blocked: no
   Hard blocked: no

Tried this, rebooted, still fails:

  sudo apt-get purge bcmwl-kernel-source broadcom-sta-common broadcom-sta-dkms
  sudo apt-get install firmware-b43-installer

What's my next step? Other logs linked below.

dmesg
lsmod
syslog
wireless-info.txt (from wireless_script as per https://askubuntu.com/questions/425155/my-wireless-wifi-connection-does-not-work-what-information-is-needed-to-diagnos)

While I might not provide the exact solution to the problem right now, because your question is missing relevant information, here's some things you can do to troubleshoot the problem and perhaps include them into the question, so that other users can help you.

What can you include into your question?

Script output from My wireless/WiFi connection does not work. What
information is needed to diagnose the issue?
Ouput of /var/log/syslog. Try reproducing the problem and note the
time when you do it. After you go through the whole process, read the
syslog. The recent events are all at the end of file, so you might
want to do something like cat /var/log/syslog | tail -n50 to list
last 50 lines in that file, but you can change that number as needed.
Output of lsmod ( perhaps a driver isn't loading properly );
Output of dmesg
Output of rfkill list all

Possible issues:

Your ethernet works, but wireless doesn't. So it may well be issue with wireless card ( failiing hardware ), with wireless drivers, or wireless configuration.  But until we know what's in your syslog, we probably won't be able to pin-down the issue. There are wireless dongles, which you could use to test whether or not this is wireless card issue, but the better way IMHO would be to boot on a live USB, and see if that works.

I would check router settings.  First make sure it is set for 11 b/g/n and not 11n only, then check security/encryption settings and have it set to WPA2 only with no WEP or TKIP enabled and allow it to broadcast the SSID as hiding it doesn't make the network more secure.  I would also change the channel the router is on to one not being used, here is the list of used channels from the wifi script
Channel occupancy:

  9   APs on   Frequency:2.412 GHz (Channel 1)
  2   APs on   Frequency:2.437 GHz (Channel 6)
  3   APs on   Frequency:2.452 GHz (Channel 9)
  4   APs on   Frequency:2.462 GHz (Channel 11)
  1   APs on   Frequency:5.765 GHz (Channel 153)

Then I would go into Network Manager and set the IPv6 settings for your connections to ignore


How can I go back to GIMP 2.6? On an old PC, I have Lubuntu 12.10. during GIMP installation, the newest version was installed (ver. 2.8), but I think its a little heavy for an old machine like mine with a poor Intel Celeron CPU (Ram 1GB, VGA 128)

How can I go back to GIMP 2.6?

Try doing the forward port approach (works for more packages than just Gimp):

Add the precise main repositories to your system.

Create a file like /etc/apt/sources.list.d/precise-for-gimp.list containing

deb http://nl.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://nl.archive.ubuntu.com/ubuntu/ precise main restricted
deb http://nl.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://nl.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted

Replace the mirror (here nl.archive.ubuntu.com) with the one you would like to use.
Add a file with the appropriate pinning to allow downgrading of a certain set of packages, in e.g. /etc/apt/preferences.d/10-pin-gimp-to-precise:

Package: *gimp*
Pin: release a=precise-security
Pin-Priority: 1001

Package: *gimp*
Pin: release a=precise-updates
Pin-Priority: 1001

Run sudo apt-get update
Run sudo apt-get -s install gimp (-s to simulate only)
Check whether the output makes sense. If not, and it can't manage to satisfy the dependencies, then consider reverting the actions above. If it does work, then actually run the actions to be performed by re-running the previous command without the -s option.

This approach will provide you best flexibility and security-update support, as it's just using the repositories rather than a specific version. It may be a PITA to set up, though.

Try this (it worked for me):

sudo apt-get install ppa-purge
sudo ppa-purge ppa:otto-kesselgulasch/gimp
sudo apt-get install gimp


unistall Ubuntu when Wubi fails I installed Ubuntu using Wubi on my Windows 7 laptop about a year ago. I hadn't used it for a while until a couple of days ago. I checked for software updates and got a bunch. I began to install them. During this process I opened the Software Center and tried to look at the software that I had currently installed. This seemed to mess up the installation process (the details window began showing a terminal-like display). When it finally finished (after about an hour) I tried to shut it down. But it just hung for about half an hour without any disk activity, so I forced a shut-down by holding the power button. Now when I go into Ubuntu it runs very slowly or not at all. When I try to uninstall it with Wubi it says

“Error executing command

    command=C:\Windows\sysnative\bcdedit.exe/delete{…}\f
    retval=1
    stderr=An error occurred while attempting to delete the specified entry.
    The system cannot find the file specified”

Is there any way to delete Ubuntu while leaving my Windows system in place in this situation? Any suggestions very gratefully received.

there are two checks you can perform to check after it has been removed.

The first one checks that wubi has been uninstalled and this could leave gigbytes of information leftover (use the second check for left over data)

the second check is to open a partition manager and check that the partitoin for ubuntu is gone. you can press start and search partition to do this.

firstly i suggest pressing start, type in uninstall, and then click [Uninstall a program]

when it loads find Wubi within the list, click it and then click uninstall at the top, follow the instructions and restart to perform the check.

the next thing to do is just delete the partition.
like mentioned before, click start, type partiton and click the option labelled [create and format hard disk partitons] at this point remove any cd`s or usb drives and continue.

you will see at the bottom of the window that opens a row, on the left of that row will be the name of the hard disk eg (C:windows) and its normally the C drive unless you changed it. then right click the ubuntu partition (normally the third one along) and click delete partitoin, you can check your deleting the correct one by going into my computer and renaming your first windows partitoin, then re open the window, press f5 to refreash and the one thats renamed is the one you DONT delete. if you have any problems just comment or email me 2340k@live.co.uk


Make a text file my automatically updated background? I want to make a "to-do" list my wallpaper. I was hoping to be able to write a text file, save it, and have the background be updated each time I edit file. Is this possible?

The script below watches a textfile that you can edit. If the file is changed, it will create a new layer over your wallpaper with the text of the file.

Options

you can define:

text size
text color
number of columns
(max) number of lines per column
border width (around the text blocks)

How to use

The script uses Imagemagick, you might have to install it first:

sudo apt-get install imagemagick

Then:

Copy the script below into an empty file and save it as walltext.py.
Edit, if you want specific settings, the options in the head section of the script.
Into the same folder, copy the wallpaper of your choice , name it (exactly) original.jpgN.B.- It is important that the proportions of your wallpaper match the proportions of your screen's resolution, else the text will not be positioned properly.
In the same folder, create an empty textfile named (exactly) notes.txt. This is the file to make your todolist or whatever you'd like to have on your screen.

Run the script by the command:

python3 /path/to/walltext.py

Now start editing your text file. Every five seconds, the wallpaper is updated if needed (after you saved the changes):

Examples

1 column, max 30 lines per column

2 columns, max 20 lines per column

3 columns, max 10 lines per column

The script

#!/usr/bin/env python3

import subprocess
import os
import time

curr_dir = os.path.dirname(os.path.realpath(__file__))
curr_wall = curr_dir+"/"+"original.jpg"
notes = curr_dir+"/"+"notes.txt"

#--
text_color = "white"   # text color
size = "20"            # text size (real size depends on the scale factor of your wallpaper)
border = 120           # space around your text blocks
columns = 2            # (max) number of columns
n_lines = 10           # (max) number of lines per column
#--

def run_command(cmd):
    subprocess.call(["/bin/bash", "-c", cmd])

def get_value(cmd):
    return subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8").strip()

def read_text(file):
    with open(file) as src:
        return [l.strip() for l in src.readlines()]

def slice_lines(lines, n_lines, columns):
    markers = [i for i in range(len(lines)) if i % n_lines == 0]
    last = len(lines); markers = markers+[last] if markers[-1] != last else markers
    textblocks = [lines[markers[i]:markers[i+1]] for i in range(len(markers)-1)]
    filled_blocks = len(textblocks)
    if filled_blocks < columns:
        for n in range(columns - filled_blocks):
            textblocks.insert(len(textblocks), [])
    for i in range(columns):
        textblocks[i] = ("\n").join(textblocks[i])
    return textblocks[:columns]

def create_section(psize, text, layer):
    run_command("convert -background none -fill "+text_color+" -border "+str(border)+\
                  " -bordercolor none -pointsize "+size+" -size "+psize+\
                  " caption:"+'"'+text+'" '+layer)

def combine_sections(layers):
    run_command("convert "+image_1+" "+image_2+" "+"+append "+span_image)
    pass

def set_overlay():
    boxes = slice_lines(read_text(notes), n_lines, columns)
    resolution = get_value('identify -format "%wx%h" '+curr_wall).split("x")
    w = str(int(int(resolution[0])/columns)-2*border)
    h = str(int(resolution[1])-2*border)
    layers = []
    for i in range(len(boxes)):
        layer = curr_dir+"/"+"layer_"+str(i+1)+".png"
        create_section(w+"x"+h, boxes[i], layer)
        layers.append(layer)
    run_command("convert "+(" ").join(layers)+" "+"+append "+curr_dir+"/"+"layer_span.png")
    wall_img = curr_dir+"/"+"walltext.jpg"
    run_command("convert "+curr_wall+" "+curr_dir+"/"+"layer_span.png"+" -background None -layers merge "+wall_img)
    run_command("gsettings set org.gnome.desktop.background picture-uri file:///"+wall_img)
    for img in [img for img in os.listdir(curr_dir) if img.startswith("layer_")]:
        os.remove(curr_dir+"/"+img)

while True:
    text_1 = read_text(notes)
    time.sleep(5)
    text_2 = read_text(notes)
    if text_2 != text_1:
        set_overlay()

Notes

More options can be added to the script, more info on Imagemagick's options can be found here.

I've modified the code above to put random quotes on the wallpaper every hour. Enjoy :)
http://forraskod.blogspot.hu/2016/01/linux-hatterkep-veletlenszeru.html

#!/usr/bin/env python3

import subprocess
import os
import time
import random

curr_dir = os.path.dirname(os.path.realpath(__file__))
curr_wall = curr_dir+"/"+"original.jpg"
notes = curr_dir+"/"+"notes.txt"

#--
text_color = "white"   # text color
size = "80"            # text size (real size depends on the scale factor of your wallpaper)
border = 480           # space around your text blocks
columns = 1            # (max) number of columns
n_lines = 3          # (max) number of lines per column
#--

def run_command(cmd):
    subprocess.call(["/bin/bash", "-c", cmd])

def get_value(cmd):
    return subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8").strip()

def read_text(file):
    with open(file) as src:
        return [l.strip() for l in src.readlines()]

def slice_lines(lines, n_lines, columns):
    markers = [i for i in range(len(lines)) if i % n_lines == 0]
    last = len(lines); markers = markers+[last] if markers[-1] != last else markers
    textblocks = [lines[markers[i]:markers[i+1]] for i in range(len(markers)-1)]
    filled_blocks = len(textblocks)
    if filled_blocks < columns:
        for n in range(columns - filled_blocks):
            textblocks.insert(len(textblocks), [])
    for i in range(columns):
        textblocks[i] = ("\n").join(textblocks[i])
    return textblocks[:columns]

def create_section(psize, text, layer):
    run_command("convert -background none -fill "+text_color+" -border "+str(border)+\
                  " -bordercolor none -pointsize "+size+" -size "+psize+\
                  " caption:"+'"'+text+'" '+layer)

def combine_sections(layers):
    run_command("convert "+image_1+" "+image_2+" "+"+append "+span_image)
    pass

def set_overlay(): # Read the file "notes" as specified above, display text in columns
    boxes = slice_lines(read_text(notes), n_lines, columns)
    resolution = get_value('identify -format "%wx%h" '+curr_wall).split("x")
    w = str(int(int(resolution[0])/columns)-2*border)
    h = str(int(resolution[1])-2*border)
    layers = []
    for i in range(len(boxes)):
        layer = curr_dir+"/"+"layer_"+str(i+1)+".png"
        create_section(w+"x"+h, boxes[i], layer)
        layers.append(layer)
    run_command("convert "+(" ").join(layers)+" "+"+append "+curr_dir+"/"+"layer_span.png")
    wall_img = curr_dir+"/"+"walltext.jpg"
    run_command("convert "+curr_wall+" "+curr_dir+"/"+"layer_span.png"+" -background None -layers merge "+wall_img)
    run_command("gsettings set org.gnome.desktop.background picture-uri file:///"+wall_img)
    for img in [img for img in os.listdir(curr_dir) if img.startswith("layer_")]:
        os.remove(curr_dir+"/"+img)

def set_single_overlay(): # DEFAULT, read 1 line from "notes" file as specified above
    resolution = get_value('identify -format "%wx%h" '+curr_wall).split("x")
    w = str(int(int(resolution[0])/columns)-2*border)
    h = str(int(resolution[1])-2*border)
    layers = []

    layer = curr_dir+"/"+"layer_1.png"
    #print(w)
    #print(h)
    create_section(w+"x"+h, text_1, layer)
    layers.append(layer)

    run_command("convert "+(" ").join(layers)+" "+"+append "+curr_dir+"/"+"layer_span.png")
    wall_img = curr_dir+"/"+"walltext.jpg"
    run_command("convert "+curr_wall+" "+curr_dir+"/"+"layer_span.png"+" -background None -layers merge "+wall_img)
    run_command("gsettings set org.gnome.desktop.background picture-uri file:///"+wall_img)
    for img in [img for img in os.listdir(curr_dir) if img.startswith("layer_")]:
        os.remove(curr_dir+"/"+img)

print("Walltext started.")
print (curr_wall)
print (notes)

while True:
    text_1 = random.choice(open(notes).readlines())
    print(text_1)
    set_single_overlay()
    time.sleep(3600)

#    text_2 = read_text(notes)
#    if text_2 != text_1:
#        set_overlay()


How do I save files edited with vim? I can't save changes after editing

sudo vi /etc/network/interfaces

Text before editing:

auto lo
iface lo inet ...

Edited to:

auto eth0
iface eth0 inet dhcp

What key combination or sequence must I press to save this?

You're probably in editing/insert mode. You need to type the following sequence :

Esc, to quit edit mode and fallback to command mode ;
:+w+q, start with a : (colon) then press w and finally q to write and quit (or just :w to write without quitting)
then press Enter to valid.

this question was answered a long time ago, but in case it comes up in search engines again, this link is a nice vim cheatsheet that you might want to bookmark if you use vim a lot.

By the way, You can use :wq to save and exit the file ( you should first press esc key to exit insert or replace mode and then press commands ) and  use :q! to exit without saving.


No wireless extensions in ubuntu Basically I'm an information security student and I was trying to set up snort, I needed to turn off “Large Receive Offload” (lro) and “Generic Receive Offload” (gro) to get snort working which I have successfully done and edited /etc/network/interfaces and everything was working fine.

Minutes later my wifi went down and I have tried every single command to get it back up without any use, I undid all the changes I have made yet its not working.

when I type iwconfig this is what I get

lo no wireless extensions.

wlo1 IEEE 802.11bgn ESSID:o ff/any
Mode:Managed Access Point: Not-Associated       Tx-Power=0 dBm
Retry short limit:7 RTS thr:o ff Fragment thr: off
Encryption key:o ff
Power Management:o ff

eno1 no wireless extensions.

I tried to get the network up as well but I get error: input/output.

I've been going through this for about 6 hours now without success, my wired connection works but wireless doesn't.

Have you tried to check whether the device is for some reason blocked by RF-KILL? Is there a physical switch for WiFi on your computer (mine is FnF7 for "airplane mode" which is triggered by default on new Ubuntu installations, every time). Try:

rfkill list all

Also, Make sure you are using

sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid (network) key (passwd)
sudo dhclient wlan0

This is the only way I've been able to (consistently) get WiFi back up and running. If you run the command lshw and see a wireless interface, you know it's at least detected... so you are safe.

*Substitute wlan0 for whatever the name of your wireless device is

okay so, after two days and countless hours spent trying to get the wireless back up its finally working. Not sure if this is an actual answer to the question but here you go this is how i got it working again incase someone is ever in the same frustrating spot as me.
i made sure i deleted every single package i have installed for snort, including

flex
bison
tcpdumb
libpac
pulledpork
pcap
pcre
libdnet

and then ran this command to make sure i delete all traces of snort and its dependencies

sudo apt-get remove --auto-remove snort

and did the same command for every single package up there

then i rebooted the pc, still nothing worked. Then giving up i decided to format ubnutu, so i log into my windwos since i dual boot for the first time since this whole fiasco happened and that was the solution. Somehow, logging into my windows participation then back into my ubuntu fixed the issue.

i wanna thanks p Smith for his help, he's the one who suggested to revert back to settings before snort and remove all packages which could have helped solve the problem.

if anyone faces similar problem, please up this post or pm me and ill try to guide you through this.


Script to open a website using a terminal automatically, remembering cookies Is there any way to make a script, which opens the URL with a minute interval, automatically, remembering old cookies?

It must be run from ssh, not always connected.

New answer:

I make text only version of script what you may run in background easily, with help of screen or cron.

  Screen is better option for long running processes. Using screen you
  can simply get the same session running on remote server even after
  logout from ssh.

First start screen: $ screen

Run elinks 'Yoursite'. Manage login or anything else you want to affect cookies. Exit. Run my script in screen.

  Let’s detach your screen session with keyboard shortcut CTRL+a+d or
  ctrl+alt+d. It will return you to command line. Now exit your ssh
  session and again connect system through ssh and execute following
  command to get old screen session running.

  $ screen -r

Script follows, I have test it on web mail to test cookies, all work fine, loggeg in once and stay logged in restarts of script.

#!/bin/bash

while :
do
    elinks 'yandex.ru' &
    sleep 50s
    pkill -u "$(id -un)" elinks
    echo  "elinks killed, press ctrl-C to cancel loop. sleep 10s."
    sleep 10s
done

Note: elinks version from repo doesn't support javascript. Current version, if you build your self will support javascript if dependencies met.

Update: I have tested text only browsers links and lynx. First not remember cookies between sessions, second - I was unable to test it fully cause it doesn't allow to submit form may be because of javascript.(web mail was used to test, to see if I stay logged in on second browser run)


How do I hide the Toolbar in Evince Full Screen Mode? Let me preface this by saying I'm new to Linux, but I'm willing to try anything you wizards can conjure up (preferably a keyboard shortcut though)!

When I use Evince 3.10.3 in full screen mode I'm greeted with this nice-looking, but semi-annoying toolbar that takes up some of my screen real estate at the top...:

In the Evince documentation I see that the section on the Toolbar says to Show, hide, or edit the toolbar; when I go to the page all I see is a layout of the corresponding functions of the toolbar, but no information is given as to how I can hide the toolbar:

How do I hide the toolbar in Evince version 3.10.3, or a version that includes this similar setup with the toolbar?

P.S. Sometimes the toolbar magically fades away. I just want a way to invoke this behavior on demand. Thanks!

The short answer is, you can't.

Evince 3.4.0 (on 12.04) had the option to hide the toolbar from the menu View > Toolbar then select Fullscreen from the menu or via F11 key will hide the toolbar in fullscreen mode.

Apparently, this feature has been removed from newer version of Evince and it has been reported as bug on launchpad and in mailing list as well.

Perhaps this might be fixed with newer version, but who knows.

Immediate workarounds would be either:

using window manager as suggested by @zarnaik
use other PDF viewer such as MuPDF, etc.

I have used MuPDF on Xubuntu 14.04, and it seems to achieve what you want: no toolbar and able to zoom to any width, while viewing in fullscreen.

It's easy to get your thinking locked up to search for "a PDF reader" forgetting that you are most likely have a browser, and browsers like Chrome and Firefox have rather good PDF reading abilities(select cut,copy/past, bookmarking, scrolling continuously ... in contrast to MuPDF who is useful to just display a PDF as image and still broke it on scrolling) in addition to what you want that is a clear full screen without any distractions. As a bonus you can use browser features such as selecting/right click then search google for ... Try it.


I can't use update manager, access Ubuntu related sites or Launchpad I turned on my computer today and when I tried to run updates through Update Manager, it would just sit there slowly loading a repository forever.

Then I tried to access ubuntuforums.org and it wouldn't load. Then I tried one.ubuntu.com, launchpad.net, and none of them will load. Everything was working fine yesterday, but now the only sites I can access seem to be anything non Ubuntu related (Google, Yahoo, Twitter, IMDB, they all work).

This is one of the strangest things I've encountered and I can't figure it out.

It is very likely, that you are suffering from a problem at Telia Sonera. They have major network problems in London, close to Canonicals own networks that host Ubuntu related services.

To see if you are affected, open a terminal and make sure traceroute is installed (sudo apt-get install traceroute), then type traceroute 91.189.92.184 | grep --color=auto telia. If your universe repository is also based at Canonical (e.g. not a local mirror), see below on how to install traceroute withouth apt.

If this command outputs anything, then Telia is most likely the cause of your problems.
If this command does NOT output anything, it is still possible, that you are affected, because of asynchronous routing.

This problem is not within Canonicals reach, so they cannot really do something about it (besides building global redundancy), but it should be temporary.

(This answer is only valid close to the time of writing! If you read this in a couple of weeks or months, then this does most likely NOT help you!)

How to install traceroute without apt
You can download traceroute from a mirror that is not affected by that issue and install it via dpkg.

For amd64 arch run wget http://de.archive.ubuntu.com/ubuntu/pool/universe/t/traceroute/traceroute_2.0.18-1_amd64.deb && sudo dpkg -i traceroute_2.0.18-1_amd64.deb

For i386 arch run wget http://de.archive.ubuntu.com/ubuntu/pool/universe/t/traceroute/traceroute_2.0.18-1_i386.deb && sudo dpkg -i traceroute_2.0.18-1_i386.deb

Try to run this command on your terminal to find out if there's an errors on some applications and packages. I hope it will help.

sudo apt-get -f install

Read more: http://linuxpoison.blogspot.com/2008/10/useful-commands-in-ubuntu.html#ixzz24hYhLotQ


dell inspiron 1300 installed now no internet I installed Ubuntu on an old dell 1300, but the wireless isn't working on it. I don't have cable or Ethernet, I tether to my phone, and it worked on Windows.

I did the sudo bc installer thingy at the terminal but it says files don't exist.

Please give me a simple link to download to a flash drive that I can just open and run.

0-2-0 3.0 network controller 0280 Broadcom Corporation bcm4318 airforce one 54 G 802.11g Wireless LAN controller 14e4: 4318 rev.02
  subsystem Dell Wireless 1370 WLAN Mini PCI card 1028: 0005
  kernel driver in use b43 PCI bridge

Download these two files:

http://mirrors.kernel.org/ubuntu/pool/main/b/b43-fwcutter/b43-fwcutter_015-9_amd64.deb
http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2

for 32-bit Ubuntu you will need a 32-bit b43-fwcutter instead of 64-bit.

http://mirrors.kernel.org/ubuntu/pool/main/b/b43-fwcutter/b43-fwcutter_015-9_i386.deb

and copy them to the Ubuntu Home folder.

Then run in terminal:

sudo dpkg -i b43*.deb
tar xfvj broadcom-wl-5.100.138.tar.bz2
sudo b43-fwcutter -w /lib/firmware broadcom-wl-5.100.138/linux/wl_apsta.o

If you do it correctly, Wi-Fi will work after reboot.

Go to system settings>software and updates>additional drivers. Try to install any Broadcom drivers listed. If that doesn't work, tell me, and I'll post an alternative answer.


Ubuntu 20.04 network interfaces Is there any way to change configuration of IP address like in old distribution like 17.10 and 11.04.
For example I've changed Ip address in /etc/network/interfaces but in 20.04 it's impossible to do this way and netplan is not easy to use.

Yes, things change and systemd has taken control over many parts of linux. If you wnat a static ip for your device create a file with sudo:
/etc/systemd/network/myconnection.network

[Match]
Name=enp0s25 #check your interfaces for this name

[Network]
DNS=10.10.0.3 #DNS, it may be like the gateway
Address=10.10.0.10/24 #the ip address of your device
Gateway=10.10.0.1  #your router

I've commented the entries (I assumed that your local gateway is 10.10.0.1 - you must use yours of course)
That done the systemd service has to be enabled:
systemctl enable systemd-networkd
systemctl start systemd-networkd

Now you are set. The "enabled" keyword ensures, that the service will be started after a reboot, the "start" does it (once) immediately
You can check if everthing works with networkctl status enp0s25whereas your netwrok device may differ. The name of your device can be checked with:
ip a


What does 'without password' mean in sshd_config file? I just installed Ubuntu 14.04 on my server and I was setting up all my config files when I came across this in my sshd_config file:

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes

This made me very worried. I thought that it was possible that someone could be logging into my server as root without a password.

I tried connecting to my server as root via:

johns-mbp:~ john$ ssh root@192.168.1.48
The authenticity of host '192.168.1.48 (192.168.1.48)' can't be established.
RSA key fingerprint is 40:7e:28:f1:a8:36:28:da:eb:6f:d2:d0:3f:4b:4b:fe.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.48' (RSA) to the list of known hosts.
root@192.168.1.48's password:

I entered a blank password and it didn't let me in, which was a relief. So my question is: what does without password mean and why is this a default in Ubuntu 14.04?

From the manpage:

  PermitRootLogin

  Specifies whether root can log in using ssh(1).  The argument
  must be “yes”, “without-password”, “forced-commands-only”, or
  "no”.  The default is “yes”.

  If this option is set to “without-password”, password
  authentication is disabled for root.

  If this option is set to “forced-commands-only”, root login with
  public key authentication will be allowed, but only if the
  command option has been specified (which may be useful for taking
  remote backups even if root login is normally not allowed).  All
  other authentication methods are disabled for root.

  If this option is set to “no”, root is not allowed to log in.

Thus without-password allows root login only with public key authentication. This is often used with shell scripts and automated tasks.

Note that there are legitimate reasons for logging in via root (but using cryptographic keys and never a password). A typical example is remotely syncing two servers (to have one of them being used as fail-over). Because the structure must be identical, often a root password is required.

Here is an example using unison for the synchronisation.


Install oracle-java7-installer through apt-cacher-ng I've added the oracle-java7-installer ppa to my apt-cacher-ng server and to my clients. I cannot get it to install.

Any ideas on how I can do this? I think it fails when it tries to download the installation from Oracle. This is what happens when I try to install it:

admin@vgjs001:~$ sudo apt-get install oracle-java7-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 x11-common xfonts-encodings xfonts-utils
Suggested packages:
  default-jre equivs binfmt-support visualvm ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-gothic
  ttf-sazanami-gothic ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming firefox firefox-2 iceweasel
  mozilla-firefox iceape-browser mozilla-browser epiphany-gecko epiphany-webkit epiphany-browser galeon midbrowser
  moblin-web-browser xulrunner xulrunner-1.9 konqueror chromium-browser midori google-chrome
The following NEW packages will be installed:
  gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 oracle-java7-installer x11-common xfonts-encodings
  xfonts-utils
0 upgraded, 9 newly installed, 0 to remove and 10 not upgraded.
Need to get 4 269 kB/4 347 kB of archives.
After this operation, 7 548 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 "hyperlink-1" "repo-1" gsfonts all 1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1 [3 374 kB]
Get:2 "hyperlink-2" "repo-2"  libfontenc1 amd64 1:1.1.0-1 [15,4 kB]
Get:3 "hyperlink-3" "repo-3"  libxfont1 amd64 1:1.4.4-1 [133 kB]
Get:4 "hyperlink-4" "repo-4"  x11-common all 1:7.6+12ubuntu1 [57,7 kB]
Get:5 "hyperlink-5" "repo-5"  xfonts-encodings all 1:1.0.4-1ubuntu1 [583 kB]
Get:6 "hyperlink-6" "repo-6"  xfonts-utils amd64 1:7.6+1 [96,4 kB]
Get:7 "hyperlink-7" "repo-7"  gsfonts-x11 all 0.22 [9 108 B]
Fetched 3 232 kB in 33s (95,1 kB/s)
Preconfiguring packages ...
Selecting previously unselected package java-common.
download failed
Oracle JDK 7 is NOT installed.
dpkg: error processing oracle-java7-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1) ...
Setting up libfontenc1 (1:1.1.0-1) ...
Setting up libxfont1 (1:1.4.4-1) ...
Setting up x11-common (1:7.6+12ubuntu1) ...
Setting up xfonts-encodings (1:1.0.4-1ubuntu1) ...
Setting up xfonts-utils (1:7.6+1) ...
Setting up gsfonts-x11 (0.22) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

I was just battling with this, here are my findings for Ubuntu 14.04 Trusty Tahr.

The installer uses apt-config to determine which proxy to use. Specifically if Acquire::http::Proxy::download.oracle.com returns DIRECT to determine whether to use the default proxy of to download directly.

Specifically the install runs

# use apt proxy
APT_PROXIES=$(apt-config shell \
http_proxy Acquire::http::Proxy \
https_proxy Acquire::https::Proxy \
ftp_proxy Acquire::ftp::Proxy \
dl_direct Acquire::http::Proxy::download.oracle.com \
)

And later on

if [ "$dl_direct" = "DIRECT" ]; then
    unset http_proxy
    unset https_proxy
    unset ftp_proxy
fi

If you use the following apt config then the installer with download directly:

Acquire::http::Proxy "http://my.proxy.com:3142";
Acquire::http::Proxy {
        download.oracle.com DIRECT;
};

While this works it is somewhat annoying as the download takes forever and that somewhat defeats the purpose of the proxy.

I found that the installer checks a debconf variable to check whether to use a local file. The property checked is oracle-java8-installer/local and it is a string.

Specifically the installer runs:

db_get oracle-java8-installer/local
if [ -d "$RET" -a -f "$RET"/$FILENAME ]; then

    echo "Installing from local file $RET/$FILENAME"
    cp -f -p "$RET"/$FILENAME ${FILENAME}_TEMP
    mv -f ${FILENAME}_TEMP $FILENAME
else # no local file

So if you have the JDK downloaded and in a directory /jdk/dir then you need to run the following command before running the installer:

sudo debconf-set-selections <<< 'debconf oracle-java8-installer/local string /jdk/dir/'

Note the trailing / on the directory - this is required.

First you need to remove openjdk for this run the following command from your terminal:

sudo apt-get purge openjdk*

If you installed java 7 from any other PPA and you are having problem with java then you have to do following steps before installing the PPA mentioned here:

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update

Install oracle java 7 in ubuntu 13.04/12.10/12.04
Open the terminal and run the following commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

You can check the java version by searching java in dashboard.


Delay mounts after encrypted home folder is ready I have set up a few bind mounts in fstab, mounting one folder in my home directory to another (AeroFS no sym-link circumvent). My home folder is encrypted.

When the system boots up, it attempts to mount the folders inside home folder prior to mounting the encrypted home folder itself, causing an error.

How can I edit fstab to have the encrypted home folder mount first?

I tried adding noauto, it didn't work.

EDIT: Also, I want to maintain the encryption for security reasons.

fstab content:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=8e26dd0d-f57f-4b63-93b3-7f2743d6fe7a /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=C2BB-18A8  /boot/efi       vfat    defaults        0       1
# /home was on /dev/sda4 during installation
UUID=062418c7-ba50-40e4-b3ea-42663e92eba8 /home           ext4    defaults        0       2
# swap was on /dev/sda3 during installation
#UUID=ac66f7ee-7dbe-4e56-9f42-459038a11a12 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

#
#Bind mounts for AeroFS to sync outside it's folder:
#
/home/user/Desktop  /home/user/AeroFS/Desktop   none    bind    0   0
/home/user/Documents    /home/user/AeroFS/Documents none    bind    0   0
/home/user/Music    /home/user/AeroFS/Music     none    bind    0   0
/home/user/Pictures /home/user/AeroFS/Pictures  none    bind    0   0
#

lsblk output:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk
├─sda1   8:1    0   954M  0 part /boot/efi
├─sda2   8:2    0  55.9G  0 part /
├─sda3   8:3    0  14.9G  0 part
└─sda4   8:4    0   394G  0 part /home

The accepted answer doesn't work since non-root users are not able to use the --bind option.
What I used instead was bindfs. It allows non-root users to create bound mounts.
First install bindfs: sudo apt install bindfs. Then, open /etc/fuse.conf and uncomment the line user_allow_other.
Then, in your startup script (which runs after you log in), use the following commands to mount:
bindfs /home/user/Desktop   /home/user/AeroFS/Desktop
bindfs /home/user/Documents /home/user/AeroFS/Documents
bindfs /home/user/Music     /home/user/AeroFS/Music
bindfs /home/user/Pictures  /home/user/AeroFS/Pictures

Easy:

Remove the following lines from fstab:

#
#Bind mounts for AeroFS to sync outside it's folder:
#
/home/user/Desktop  /home/user/AeroFS/Desktop   none    bind    0   0
/home/user/Documents    /home/user/AeroFS/Documents none    bind    0   0
/home/user/Music    /home/user/AeroFS/Music     none    bind    0   0
/home/user/Pictures /home/user/AeroFS/Pictures  none    bind    0   0
#

create the following shell script:

#!/bin/bash
#
# This script binds AeroFS mounts to sync outside their folder,
# as an answer to https://askubuntu.com/questions/604361/delay-mounts-after-encrypted-home-folder-is-ready
#
# Copyright (c) 2014 Fabby

# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 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. See the GNU General Public License for more details.
# You DID NOT receive a copy of the GNU General Public License along with this program as the license is bigger then this program.

mount --bind /home/user/Desktop   /home/user/AeroFS/Desktop
mount --bind /home/user/Documents /home/user/AeroFS/Documents
mount --bind /home/user/Music     /home/user/AeroFS/Music
mount --bind /home/user/Pictures  /home/user/AeroFS/Pictures

Save it under /home/user/bin/MountAeroFS.sh (create the bin directory if it doesn't exist.)
Open Startup Applications, and add the following Command: MountAeroFS.sh.
As Name: and Comment: you can add anything to remind you what this is about.
Reboot (as you've just changed your fstab)

Done!


Upgrading Kernel, but being able to safely downgrade I'm on Ubuntu 18.04 and I'm having problems with my iGPU hanging my system (this bug here: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1861395).

I'm currently on the 5.3 kernel, but I want to try changing kernels to fix the problem.

I don't really need super-cutting edge kernel features, I'm more interested in stability.

Should I upgrade to 5.6? or downgrade to 5.2 or 4.XX?

How should I do it so that I can safely go back to the official kernel from the repos if something goes wrong?

Edit: It has been drawn to my attention that this question is quite similar to mine: How to update kernel to the latest mainline version without any Distro-upgrade?.

However, it only covers how to upgrade kernels, not how to ensure that I can safely revert my system to its previous state using the package manager. With most packages you install through PPAs, apt will replace the old version with the new on. Is it the same for kernels?

You can install mainline kernels from Ubuntu kernel PPA.

You can install as many as you like. The system will boot with the latest one by default, but you can select any kernel in grub menu.

To revert to the standard Ubuntu kernel, boot with it and remove all mainline kernels using e.g. synaptic.

Abstract

To upgrade to a kernel I would suggest going for a stable build. Also, as a rule of thumb, I recommend always upgrading your kernel and never downgrading because it can cause system flaws.

Required Installs for this Guide

sudo apt-get install -y gcc libncurses5-dev make wget flex bison vim libssl-dev libelf-dev

How To

In order to change your current kernel it takes some patience and caution, but there is definitely a way to do it while still having the ability to revert back to the original kernel. So let's get started, I recommend doing all of this with root so first do sudo -i and enter your password.

So let's go ahead and download the latest stable kernel as of now (2020-05-05).

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.5.19.tar.xz

Note: You may need to install wget for this to work (apt-get install wget).

Now let's extract this archive and move it to a suitable directory.

tar -xvf linux-5.5.19.tar.xz -C ../usr/src/

Note: You may need to install tar for this to work (apt-get install tar).

This extracted the archive to a directory that contains all the other kernels. We're now going to cd into that directory to complete the next few steps.

cd ../usr/src/linux-5.5.19/

Now for the fun part :)

If you don't have a strong computer this part can easily take 2 hours to complete so please be warned if you are on battery life or on a time crunch. Also, be sure to read all the following directions before rebooting (it will be essential if anything goes wrong).

We are now going to compile the kernel, so just follow the following commands and please let all of them run to completion. This first command usually takes the longest for people. Also, I will be using the -j4 flag on these make commands in order to speed up the process. It basically utilizes 4 cores for the compilation instead of one (I'm assuming you have 4 cores, and if not you can just leave off the -j4).

make -j4

Note: You may need to install make for this to work (apt-get install make).

make modules -j4

make modules_install -j4

make install -j4

DON'T REBOOT YET

We will now be modifying grub to give you time to choose the kernel you want to use on startup.

cd ~/../etc/default/

vim grub

Note: You can use any text editor you're familiar with, another popular one is nano, but please be familiar with your choice and know how to edit and save. I have chosen vim for this guide and you may need to install vim for it to work (apt-get install vim).

Modify the following lines to this (in vim you press i to start editing and navigate with the arrow keys):

GRUB_DEFAULT=2
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=25

To save the file, press ESC, then press :wq! and hit enter.

Now for your last and final step, you need to update grub.

update-grub2

Once that command finishes you may restart your system (reboot).

Once the system comes back you will notice that you are prompted at startup for some options. Select advanced options and then select your new linux-5.5.19 kernel.

If there are any issues with this guide please leave a comment and I will try to address the issue by editing this guide.

Hope it works!


How can I remove the Skype panel icon? As I use the Docky Skype indicator, and the green Skype icon doesn't look good next to all the grey ones -- it would be nice to remove the icon from the system tray.

Is this possible? How can I do it in Ubuntu 12.04 -- or other earlier versions?

Removing the Skype panel icon in 12.04 without removing sni-qt

  If you don't care about sni-qt, removing the icon is as simple as doing apt-get
  remove sni-qt sni-qt:i386
  Installing the Skype-provided deb is not a solution; all the Ubuntu version does is bundle the same Skype deb but make sni-qt a dependency to enable the icon.

A simple conf-file tweak or installing/removing a package isn't going to do it, we need
to get down and dirty here.

sni-qt is provided by these shared libraries:

/usr/lib/i386-linux-gnu/qt4/plugins/systemtrayicon/libsni-qt.so
/usr/lib/x86_64-linux-gnu/qt4/plugins/systemtrayicon/libsni-qt.so

A guaranteed way to remove the Skype icon while leaving sni-qt available for other
apps to use is to prevent Skype from loading these shared libraries.
That can be done in one of two ways: a civilized way and a brute-force bash-hacker
way.

1. Highly recommended: Use apparmor to prevent Skype from loading sni-qt

AppArmor is a security framework built into the Linux kernel which sets permissions
for what a program can and cannot access. It's enabled by default in Ubuntu.
An example profile for Skype is included in the app-armor profiles; I have modified that ONLY to achieve our goal of disabling the panel icon - other security features have been removed.
You can view the profile pasted here. Lines 24-25 are the bits that matter to us.

  WARNING: This profile DOES NOT provide any other kind of security -- Skype will run normally. Please see here for a more complete Skype AppArmor profile that you can use if you want to secure Skype further.

How to install

To install, exit Skype if it is running and then open a terminal with Ctrl-Alt-T,
and type/paste the below to install the pasted profile into your apparmor profiles
directory. (You can also manually paste it to /etc/apparmor.d/usr.bin.skype if you wish)

sudo wget -O/etc/apparmor.d/usr.bin.skype http://pastebin.com/raw.php?i=2EYME5eF
Then type sudo /etc/init.d/apparmor reload to reload all profiles, including the
skype one we just added. Wait for a few seconds...
To check that the profile was enabled, type sudo apparmor_status | egrep "mode|skype"

The result should show something like the below: Skype should be after "enforce mode" but before any of the other modes:

21 profiles are in enforce mode.
/usr/bin/skype
22 profiles are in complain mode.

Start Skype, and the panel icon should hopefully be gone!

How can I add this behavior to my own Skype AppArmor profile?

Just add these lines near the beginning of the profile, right after the includes (they simply prevent Skype from reading/loading the sni-qt libraries)

deny /usr/lib/i386-linux-gnu/qt4/plugins/systemtrayicon/libsni-qt.so r,
deny /usr/lib/x86_64-linux-gnu/qt4/plugins/systemtrayicon/libsni-qt.so r,

2. Not recommended: an ugly bash hack

I will only give pseudocode to prevent the new from falling into traps, but a simple bash script which does the following is enough to disable the panel icon too:

Remove read permissions from the appropriate libsni-qt.so for the uid (user) skype is running as.
Start Skype, wait a little bit so it's loaded.
(The icon is gone because Skype couldn't load sni-qt.)
Restore permissions to libsni-qt.so.

As of what I know, you can't remove Skype from the systray but what you can do is either to remove the systray if you haven't any software that use it or replace the icon of Skype which is here : /usr/share/icon/skype.png by what you want.


Ubuntu stopped detecting my second monitor, and my lap top screen I got two new Benq 27" monitors last night, plugged them in and everything worked great.  Started by machine this morning, and it will not detect my second monitor, and if I unplug everything my laptop screen is now blank!  I have a Dell G7 with Nvidia. Driver version 455.45.01-0ubuntu0.20.04.1, GeForce GTX 1660 Ti
So it will only detect one monitor, it will no longer see my laptop screen, settings do not show an option for a second monitor, but it did last night, and Nvidia settings do not show a second monitor either, but it did last night.
I have now tried many "solutions" posted on here, but nothing is working.  Should I do a reinstall?
Any ideas?

In the absence of the linux version 3 approaches, without using the command line, are suggested:
1st:
Installation of a prior nvidia driver on Software and Updates > Additional drivers > choose other nvidia driver version > reboot the laptop > if you don't see the second monitor go to the screen settings and check if the second monitor is selected as active.
If not working select another nvidia driver using the above procedure.
2nd:
Reboot the laptop and press Esc in order to enter the GRUB menu > select a prior version of the ubuntu kernel; example: Ubuntu, with 5.X.X-XX-generic > if you don't see the second monitor go to the screen settings and check if the second monitor is selected as active.
3rd:
Reboot the laptop > on the users login screen select Configurations/ Options > select Wayland


How to remove Ubuntu Software Center I recently updated 13.04, and upgraded the kernel. After that, the software center seems not to be working. when I click on the icon, the logo just blinks and nothing happens. Is it possible to correct this, or how do I remove the software center.

When I issue the command

sudo apt-get remove software-center

it, asks to remove ubuntu-desktop too. What is ubuntu-desktop, and is it very important for the system ?

Try

 sudo apt-get -f update
 sudo apt-get -f upgrade

just to fix any existing problems. Then

 sudo apt-get --reinstall install software-center

to re-install software center.

Firstly Don't remove software center because it is of great use.

Secondly:rather installing from software center install the packages from Terminal using
"apt-get install package_name"
"apt-fast install package_name"

before using apt-fast you need to install it by typing

"apt-get install apt-fast"

using apt-fast increases the downloading speed of your install


Solaris-style boot environments? I'm moving from a FreeBSD desktop that boots a zfs poot to a Ubuntu system that I'd like to do the same. I've got a couple of questions about setting it up that I can't seem to find an answer for. I've added Ubuntu (using btrfs) to my laptop for testing as well.

1) Is there a boot environment tool? No, not dual booting (that's what the term turns up here), but booting different versions of the same OS on different ZFS file systems in the root pool. Looking for this for btrfs as well.

2) I can't seem to find any documentation on root pools, just some howto's. They all say "don't use this howto for dual boot", but don't say why. Is it just because the howto doesn't cover it or it hasn't been tested, or is there some fundamental reason I shouldn't do that?

You can check https://moinakg.wordpress.com/2017/05/02/boot-environments-on-linux/ to have a boot environment in Btrfs.

I looked into this a little and apparently the Ubuntu Team has included OpenZFS in recent releases.  Yay!

The installation and configuration procedure can be found here:

https://wiki.ubuntu.com/Kernel/Reference/ZFS


Is Ubuntu security enough? I work with sensible data, so I need a reasonable level of security and use Ubuntu as main operative system in a professional activity.

I have developed a php platform that performs some sensible operations with AES and RSA, so I need to have a local web server.

Does it break system security? Which fixes may I apply?

And, more in general, are Ubuntu default setting safe enough?

If you are classifying your system as a high-value asset, I would say the defaults are not sufficient. I would recommend downloading and reading the CIS benchmarks for Debian and Apache and implementing the hardening recommendations. More specifically out of the box 'root' logins are permitted with SSH server which is truly stupid. Attached is a link to the site where you can download them.

http://benchmarks.cisecurity.org/en-us/?route=downloads.benchmarks

If I understand correctly, you will have a apache server. If not please, don't read:

Far I know the default settings are NOT secure enough(but yes, is very secure for normal professional use). In google you probably found some tutorials about security for a apache web server.


Does "Trusty Tahr" support EFI ia32? Does "Trusty Tahr"(Ubuntu 14.04) supports ia32 booting?

Judging by the pre-release images, the answer is "yes and no."

As Rinzwind has pointed out, there is a 32-bit build of the EFI version of GRUB 2 provided with Ubuntu 14.04; however, the .iso images I've seen do not include the necessary files to boot the Ubuntu installer on a 32-bit EFI-only computer (like a Minnowboard or some tablets). Thus, to install Ubuntu in EFI mode on such a computer, you'll need to either build your own installation medium with a working boot loader or install Ubuntu in BIOS mode (if your computer supports that) and then install an EFI boot loader afterwards.

Yes and No:

No from the installation point of view, see https://bugs.launchpad.net/ubuntu-cdimage/+bug/1025555
Yes once the system is installed, as you can install the grub-efi-ia32 package.


Uninstall Ubuntu 14.10 from Windows 8.1 computer I want to completely uninstall ubuntu 14.10 from my system.But I run it alongside windows 8.1,so I cant just format the drive.Also,will I be able to login into windows once ubuntu is uninstalled because grub may create problems once ubuntu is uninstalled and I fear I wont get an option to login into windows.

Computers that ship with Windows 8 or later are different from previous ones. They can completely leverage UEFI and won't have bootloader in MBR overwriting each other. Instead, they have an EFI System Partition where bootloaders all have their own directory.
Check is you have such an installation, which you can check by running the following command:
$ mount | grep efi

Which should give you output similar to this:
none on /sys/firmware/efi/efivars type efivarfs (rw)
/dev/sda1 on /boot/efi type vfat (rw)

Then you can just delete the Ubuntu partition, without having to worry.
Related:

How do I remove "Ubuntu" in the bios boot menu? (UEFI)

Login to the Ubuntu then click on restart this will take you to the "advanced option of Ubuntu" in this page select the option windows (loader) (on /dev/sda1) which will be last option. This will help to boot to  windows. After login to the windows Right click on the computer---->Manage---->Disk Management.

After selecting the Disk Management identify the Ubuntu partition then right click on the Ubuntu partition and delete the volume. After doing this create a new volume and restart the computer. Once the machine restarted Press Enter key--->Next--->Repair your computer---->troubleshooting---->Advanced options--->command prompt

In the command prompt type as

bootrec.exe  /fixmbr

You will receive message as operation completed successfully. Close the command prompt and click on continue. This will help to uninstall Ubuntu without any affect to windows.


Dual Graphic Card Setup (Integrated + Discrete) on Desktop My current setup is as follows:

AMD HD Radeon 4250 integrated GPU
Nvidia GTX 460 1 GB GPU
Three monitors, two running via the GTX 460 and the other running via
the onboard.

This setup works without any issues on Windows 10. I am able to output to two of the monitors via my GTX 460 and the third via the integrated card.

After trying this setup with Ubuntu 14.04 however, it did not work. Upon first installing Ubuntu I was able to get a video signal on all three monitors, however it had defaulted to using the Nouveau Nvidia driver (which is really sluggish and slow). So I installed the Nvidia proprietary driver (352 I believe) and upon restarting Ubuntu I was greeted with the following message:

Is what I'm trying to do possible on Ubuntu?

Nvidia uses optimus in Windows to perform discrete and integrated GPU switching. There is some effort to bring this in to Linux as well, such as project bumblebee. However, it seems like it is outdated. I personally just install the proprietary Nvidia driver and forget this switching as it seems not fully supported, especially for more recent GPU.

Check this out for more info: https://help.ubuntu.com/community/HybridGraphics

Sorry, I can't help much beyond this answer, I also just started with Linux.


Extract a number which is assigned to a string using a Perl script I have a file input.txt which has some strings and each string has some values assigned to it.

My task is to write a Perl script to extract the number which is assigned to any of the strings.

For example, given this input.txt

Tom=0×1234,Bob=0x4567,rock=0x8912.

I have to extract the value which is assigned to rock.

I need some help writing a script to do this.

One variant on @terdon -- for each /rock=(...)/, say it:

perl -nE 'say for /rock=(\w+)/'

and a solution with grep

grep -Po 'rock=\K\w+' file

Something like this

echo Tom=0×1234,Bob=0x4567,rock=0x8912 | perl -E'while(<<>>){print map$_->[1],grep$_->[0]=~/rock/,[split/=/]for split/,/,$_}';

That compiles with warnings and uses the new <<>> so it's really good perl code.


Problems with Windows 8 Installation I've followed all the instructions and when I get to dual screen boot I choose Ubuntu and I receive a message:
1. Insert Windows Installation Disc and restart.
2. Choose Language end then press next.
3. Preess restore device.

If you don't have this disc get in touch with system administrator  or the manufacturer.

Info: There's a file missing or it contained an error which is preventing from booting the OS.

Enter= OS selection                  Esc UEFI configuration

Please help me on what to do to complete the installation.
Thanks

First start the ubuntu and update you GRUB(booting in ubuntu) by running the following commands:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair

and visit:-
http://www.howtogeek.com/114884/how-to-repair-grub2-when-ubuntu-wont-boot/

Try to install window8 in different partition and run type "msconfig" -> select boot option and manage your boot list of window8 or ubuntu .

You can also try easyBCD software for booting.


How to mount .img file created from ddrescue from failing hard drive I've been following this tutorial which got me far enough to create an image file of my failing disc.

https://www.technibble.com/guide-using-ddrescue-recover-data/

I'm following step 3a, but I am greeted with an error that says:
"wrong fs type, bad option, bad superblock on /dev/loop8"

I followed the directions found at the following link to no avail:
Why do I get "wrong fs type, bad option, bad superblock" error?

I installed nfs-common, but it didn't help.

I then tried booting into windows and simply mounting the image through windows, and I'm getting a "The disc image is corrupted" error.

My guess is that I don't know what type of file system the disc image is. (It's off a friends computer, and all I know is that is was a Linux system) Maybe if I knew the file system type I could use this command with the proper trigger and it'd work?

sudo mount -t fstype -o loop,ro partition.img mountpoint

So, I guess my question is this. How can I look at the type of filesystem that the .img file is? Or, even better how can I mount this .img file so I can browse the files that I was able to recover (ddrescue reported 49% recovered) and just copy the ones that survived to another drive?

For what it's worth, I am only running Ubuntu on a Live USB, and therefore if I boot into Ubuntu again to do this, I'll have to reinstall any necessary programs etc. So, if you can help, the more you can spell out to me, the better! I'm an Ubuntu newb, so don't really know what I'm doing at all!

You're on the right track. To discover the fstype just do a blkid partition.img and look at the TYPE. It should be the parameter listed last.
for instance:

ubuntu@ubuntu:/$ blkid /media/ubuntu/media/restore/20190915-ddrescue.img
/media/ubuntu/media/restore/20190915-ddrescue.img: UUID="a2d5575a-98d3-415d-b569-8f9138f08eb4" UUID_SUB="2f192535-a318-478e-bd16-d7d8093ec1ed" TYPE="btrfs"


Create launcher shortcut for RDesktop I am trying to create a 'shortcut' that I can pin to my launcher in Ubuntu 12.04.3 LTS that will launch an RDesktop session.

It works fine from the command line thus:

rdesktop -u UserName -d Domain -g 1024x720 -a 16 ServerName

I found something close in Terminal command script launcher, but it does not quite work.

I made the desktop file that contains this (made it executable etc as per the link above):

[Desktop Entry]
Version=1.0
Name=RDP-ServerName
Comment=Open an RDP session to ServerName
Exec=rdesktop -u UserName -d Domain -g 1024x720 -a 16 ServerName
Terminal=true
Type=Application
Categories=Utility;Application;

I figured if I could get it to work from the desktop, then I could somehow pin it to the launcher afterwards?

However,  when I run it from the desktop, nothing seems to happen.  I tried choosing the 'terminal' option, and also the 'run' option, but neither seems to work.

You can just copy your *.desktop file to ~/.local/share/applications.

Or use alacarte application for this.

sudo apt-get install alacarte

For the Exec= line Try /usr/bin/rdesktop as the command to execute. That worked for me when creating a shortcut on my desktop.


0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed I was trying to install the cubemap package, using sudo apt-get install cubemap. I can't remember whether I used the keyboard shortcut Ctrl+C while it was installing, or if the package just failed to install.

Anyway, now whenever I turn on my computer from a shutdown, a popup appears in the top left of my screen that says something along the lines of "system problem detected. do you want to report it?"

In addition, whenever I install, remove, upgrade, etc or do anything with apt-get, It will work fine, but at the end, after it finishes, it says E: Sub-process /usr/bin/dpkg returned an error code (1) I cant remove the cubemap package, and I have tried apt-get remove cubemap(returns this), I also tried apt-get purging, and apt-get autoremoving cubemap, but none work to remove it.

I know that in the above linked pastebin it says "Package 'cubemap' is not installed, so not removed", but it also says " 1 not fully installed or removed.", and I think that the 1 package not fully removed is cubemap.

EDIT:
link to the full apt-get session

The problem is the libsimgearcore2017.3.1 package, and it looks to be because the package is not doing adequate env setup/checking during installation.

Option 1: Safest Cleanup

It's complaining about a missing directory which is causing a symlink creation to fail.
Try this:

sudo mkdir -p /usr/share/games/flightgear/
sudo apt-get -f install

If that doesn't fix it, then it may be looking for another sub directory.
Try this:

sudo mkdir -p /usr/share/games/flightgear/Timezone
sudo apt-get -f install

Option 2: Not safe, or recommended

dpkg has an option for handling removal of packages which are in a broken state. It's a force, so use with care!

  reinstreq

  A  package  marked  reinstreq  is  broken  and  requires reinstallation. These packages    cannot    be    removed,     unless     forced     with     option --force-remove-reinstreq.

Try this:

sudo dpkg -r --force-remove-reinstreq libsimgearcore2017.3.1

Synaptic Package Manager or gksu nautilus.
These allow elevated (sudo) permissions to access the file system on Ubuntu with a GUI.

For terminal procedures try the following:

To find if cubemap is installed:

dpkg -l | cubemap

To check which packages are missing, edit with nanoor vim or gedit:

/var/lib/dpkg/info/cubemap.postinst

but since you don't know if it was post-install or pre-remove problem you might have to check and edit:

/var/lib/dpkg/info/cubemap.prerm `

There are few other commands which can be helpful.

Autoclean clears out the local repository of retrieved package files.

`sudo apt-get autoclean`

Force installation/removal of packages. ☠Use with caution

sudo apt-get --force-yes install <pkgname>

and

`sudo apt-get --force-yes remove <pkgname>`

Also as always, you can use dpkg to install, remove and purge packages.This is what Synaptic Package Manager facilitates with its GUI.

Install

sudo dpkg -i <pkgname>

Remove

sudo dpkg -r <pkgname>

Purge

sudo dpkg -P <pkgname>

Similar Q&A here: How to remove/install a package that is not fully installed?


Firefox Keeps Crashing Over and Over Here is what Firefox says when it crashes:

Add-ons: {e968fc70-8f95-4ab9-9e79-304de2a71ee1}:0.7.3,langpack-en-GB@firefox.mozilla.org:11.0,langpack-en-ZA@firefox.mozilla.org:11.0,ubufox@ubuntu.com:0.9.4,{972ce4c6-7e08-4474-a285-3208198ce6fd}:11.0,jid0-qvNTOHrOc01SzSinPbesRVcpAoY@jetpack:1.1.1,jid0-YxzrUsJ0WOiOaU89TngAzLcIs18@jetpack:0.7.5
BuildID: 20120310193444
CrashTime: 1335509696
EMCheckCompatibility: true
FramePoisonBase: 00000000f0dea000
FramePoisonSize: 4096
InstallTime: 1335270972
Notes: OpenGL: DRI R300 Project -- Mesa DRI R300 (RS400 5A62) 20090101 x86/MMX/SSE2 NO-TCL DRI2 -- 1.5 Mesa 7.9-devel -- texture_from_pixmap

ProductID: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
ProductName: Firefox
ReleaseChannel: release
SecondsSinceLastCrash: 325
StartupTime: 1335509380
Theme: classic/1.0
Throttleable: 1
Vendor: Mozilla
Version: 11.0

This report also contains technical information about the state of the application when it crashed.

It doesn't crash every time I start it just most of the time, sometimes it will run fine until it crashes then I start it up and it crashes repeatedly, then it will stay normal and run fine after a few restarts and then start again.

Gathering Information About Your Firefox Installation

Since this is a bug, you should consider submitting the crash report. It sounds from your question like you're getting a crash report to submit data to Mozilla.org, rather than to Launchpad. That suggests that you're not running the version of Firefox that comes with Ubuntu. If the following advice doesn't solve your problem, you should edit your question to provide the output of the following commands in the Terminal:

apt-cache policy firefox
firefox -v
which -a firefox

A Simple Fix That Often Works

However, you may simply be able to solve this problem by clearing out your Firefox profile. To do this, make sure Firefox is not running. Then, if you do not use other Mozilla applications such as Thunderbird, run this command:

mv ~/.mozilla ~/.mozilla.old

Alternatively, if you do use other Mozilla applications such as Thunderbird, run this command:

mv ~/.mozilla/firefox ~/.mozilla/firefox.old

Then run Firefox and see if the problem is fixed. You won't have your bookmarks, cache, cookies, saved passwords, and other data, but it's likely that Firefox will be repaired.

This technique doesn't actually delete your user-specific Firefox data; instead, it moves it out of the way so Firefox doesn't use it.

To restore it--which would break Firefox again, if this fixed it--first make sure Firefox is not running. Then do this if you followed the first method:

mv ~/.mozilla ~/.mozilla.new
mv ~/.mozilla.old ~/.mozilla

Or this if you followed the second method:

mv ~/.mozilla/firefox ~/.mozilla/firefox.new
mv ~/.mozilla/firefox.old ~/.mozilla/firefox

If you want you can install Chromium for web browsing. Just open a terminal (Ctrl+Alt+T) and type:

sudo apt-get install chromium-browser

Press Enter and you'll be asked for your password. As you type it, it won't appear on the screen, but that's fine. Then press enter. If you're then asked if you really want to install, press y and Enter.


Missing launcher after 12.04 upgrade I recently upgraded to Ubuntu 12.04 and after doing some updates and such my application launcher and title bars (for window dialogues) are missing. Basically the entire Unity GUI is missing!

Not sure what happened so I installed GNOME 3 and it was missing a launcher too, but did have title bars. In addition the bar found at the top that lets you know what's open and allows GNOME extensions to be displayed is not interactive. I can't click, right click, alt + click (right or left), alt + super click (right or left) anywhere! I even installed an application menu from the GNOME site and it is not interactive either. However, since there is no way to launch applications I have to use terminal and if I minimize an app it will disappear completely.

Then I decided to try Unity 2D and it is incredibly messed up. Black background, launcher is there but icons and top bar while on desktop are completely distorted. They're not just pixelated; they're all sorts of funky colors and when I open something from Unity 2D launcher it will show it's opened in the launcher but nothing appears on my screen.

When trying to view videos on YouTube the video is distorted and looks just as Unity 2D does. Strange enough: the audio works fine, just not videos. Pictures loads, but not ads that stream video.

Any suggestions to get my launcher and the Unity GUI back? I tried reinstalling GNOME, Unity 3D, and Unity 2D from terminal. No change. Also reinstalled Unity desktop and tried resetting it: nothing happened.

I had the same problem.
I tried with unity --reset (as it used to fix things when I messed things up before with compiz-config) but that didn't solve my problem now.
The only thing I could do for getting everything working as normal was to reset compiz settings.

Just backup (rename) ~/.compiz-1 and ~/.config/compiz-1 directories and let them to be created again with the default settings (you'll need to logout and log back in again).

mv ~/.compiz-1 ~/.compiz-1.BACKUP
mv ~/.config/compiz-1 ~/.config/compiz-1.BACKUP

After having restarted and confirmed that everything works as expected, you can simply remove these backups (unless you have a use for them).

rm -Rfv ~/.compiz-1.BACKUP
rm -Rfv ~/.config/compiz-1.BACKUP

Note: To some people, one of the following links might have the solution. Try them if you don't want to lose all your compiz customizations.

Unity doesn't load, no Launcher, no Dash appears
How do I reset my Unity configuration?

In my case just resetting Unity wasn't enough, so I decided to get rid of all compiz settings.

All you have to do is;
Start Ubuntu tweak, go to Tweaks menu, select Desktop Icons, and change Show Desktop Icons to On.

and that's it!


How do I find the amount of free space on my hard drive? Is there a way to quickly check the amount of free / used disk space in Ubuntu?

I would assume you could right click on 'file system' in the file browser and choose 'properties' or something but there is no such option.

Open System Monitor from Dash and select the Filesystems tab.

Or alternatively open a Terminal and type:

df -h

Simply you can find available free space using free command ..
Here you can get clear explanation about free command usage

using "free" command to find free space available on Linux


Does an Intel 1.80GHz quad core processor meet the 2GHz dual core processor system requirements? My laptop has an Intel® Core™ i5-3337U CPU @ 1.80GHz × 4 processor. On the Ubuntu website, it says that I need a 2 GHz dual core processor as a requirement to install Ubuntu 18.04. Does this mean that I cannot install it?

Here are the full specs of my laptop:

A 1.8GHz quad core processor is the approximate equivalent of a 3.6 GHz dual core processor in overall performance. I have Ubuntu 18.04 installed on a computer with a 1.6 GHz quad core processor and 4 GB RAM and it runs OK, there's nothing wrong with the performance at all.

You can run Ubuntu 18.04 with your machine. Here's is what Canonical is mentioning about the hardware recommendation (not obligatory):

Recommended system requirements:

2 GHz dual core processor or better
2 GB system memory
25 GB of free hard drive space
Either a DVD drive or a USB port for the installer media
Internet access is helpful

But, according to my experience, when you have the choice, always choose that:
- a processor with a minimum of 2 GHz (not taking into account the "turbo mode") - But your machine will do fine
- 4GB Ram (3.7GB in your case means you have 4GB)
- leave at least 25GB of free hard drive space (less heating, faster working)


No effect after editing grub.cfg & updating it I've reached a dead end in this matter & I was wondering if someone out there could help me out.

I located the grub file located in etc/default and edited it following reliable instructions. After I do & run the sudo update-grub & reboot, nothing changes & it stays the same.

I even have an application called "start-up manager" to simply adjust let's say the time-out, sadly that didn't work either.

Could someone help me out?

Note: I do have this thing called burg to have a GUI when booting, but even before I installed it the problem was there.

Here's my grub.cfg:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=" vga=775"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=800x600

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Files in etc/grub.d:
00_header, 05_debian_theme, 10_linux, 20_linux_xen, 20_memtest86+, 30_os-prober, 40_custom, 41_custom, readme

boot/grub/grub.cfg

http://pastebin.ubuntu.com/538608/

You say that you have located the file grub in /etc/default but the file you have pasted above is /etc/grub/gruf.cfg.

Are you sure that you are editing the right file?  /etc/grub/grub.cfg is an auto-generated file and it will update from configuration in other files whenever you run update-grub. You need to make changes into /etc/default/grub for them to take effect.

What I think is happening at the moment is that you change /etc/grub/grub.cfg and then you run update-grub, which reverts your changes, and then when you reboot you don't get what you want. Please try changing /etc/default/grub and then let us know what the output is.

Here is the process step by step:

sudo -i                             gives root access

sudo gedit /etc/default/grub        gedit is editor

GRUB_DEFAULT=X                      Change depending on order of boot eg 3
                                        where numbering starts with 0.

Save file and run the following from the terminal.

sudo update-grub                    updates file


How can I chroot sftp-only SSH users into their homes? I want to give a client access to my server, but I want to limit those users to their home directories. I will bind-mount in any files I want them to be able to see.

I've created a user called bob and added him to a new group called sftponly. They have a home directory at /home/bob. I've changed their shell to /bin/false to stop SSH logins. Here is their /etc/passwd line:

bob:x:1001:1002::/home/bob:/bin/false

I've also changed the /etc/ssh/sshd_config to include the following:

Match Group sftponly
        ChrootDirectory /home/%u
        ForceCommand internal-sftp
        AllowTcpForwarding no

When I try to log in as them, here's what I see

$ sftp bob@server
bob@server's password:
Write failed: Broken pipe
Couldn't read packet: Connection reset by peer

If I comment out the ChrootDirectory line I can SFTP in but then they have free rein over the server. I have found that ChrootDirectory /home works, but it still gives them access to any home directory. I have explicitly tried ChrootDirectory /home/bob but that doesn't work either.

What am I doing wrong? How can I limit bob to /home/bob/?

----EDIT-----

Okay so I just had a look at /var/log/auth.log and saw this:

May  9 14:45:48 nj sshd[5074]: pam_unix(sshd:session): session opened for user bob by (uid=0)
May  9 14:45:48 nj sshd[5091]: fatal: bad ownership or modes for chroot directory component "/home/bob/"
May  9 14:45:48 nj sshd[5074]: pam_unix(sshd:session): session closed for user bob

I'm not entirely sure what's going on there,  but it suggests something is wrong with the user directory. Here is the ls -h /home output:

drwxr-xr-x 26 oli      oli      4096 2012-01-19 17:19 oli
drwxr-xr-x  3 bob      bob      4096 2012-05-09 14:11 bob

All this pain is thanks to several security issues as described here. Basically the chroot directory has to be owned by root and can't be any group-write access. Lovely. So you essentially need to turn your chroot into a holding cell and within that you can have your editable content.

sudo chown root /home/bob
sudo chmod go-w /home/bob
sudo mkdir /home/bob/writable
sudo chown bob:sftponly /home/bob/writable
sudo chmod ug+rwX /home/bob/writable

And bam, you can log in and write in /writable.

I created a script from @Oli's answer:
#!/bin/bash

# 1. adds a user to the group sftponly, which have only access to their home directory
# 2. creates a writable folder in the users home directory
# 3. mounts a folder into the users home directory with bind
# see https://askubuntu.com/questions/134425/how-can-i-chroot-sftp-only-ssh-users-into-their-homes

if [ "$1" == "" ]; then
  echo "usage: $0 [username] [path to share] [local foldername]"
  exit 0
fi
U=$1

if [ "$2" == "" ]; then
  echo "no 2. param path to share given (without trailing slash)"
  exit 0
fi
PATH_TO_SHARE="$2"

if [ "$3" == "" ]; then
  echo "no 3. param local foldername given"
  exit 0
fi
LOCAL_FOLDER_NAME="$3"

set -ex

adduser $U
adduser $U sftponly
sudo chown root /home/$U
sudo chmod go-w /home/$U
sudo mkdir /home/$U/writable
sudo chown $U:sftponly /home/$U/writable
sudo chmod ug+rwX /home/$U/writable
mkdir -p "/home/$U/$LOCAL_FOLDER_NAME/"
mount --bind "$PATH_TO_SHARE/" "/home/$U/$LOCAL_FOLDER_NAME/"

echo "$PATH_TO_SHARE/ /home/$U/$LOCAL_FOLDER_NAME/ none defaults,bind 0 0">>/etc/fstab


How to change Gsettings via remote shell? I need to automate desktop configuration via Puppet, virtual terminal  or ssh.

Unfortunately, invocation of gsettings via ssh or virtual terminal gives:

gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize "4"

(process:29520): dconf-WARNING **: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY

When I set the $DISPLAY with export DISPLAY=:0.0 it gives another error:

(process:29862): dconf-WARNING **: failed to commit changes to dconf: Could not connect: Connection refused

What can I do?

The key is to set the DBUS_SESSION_BUS_ADDRESS environment variable.

On this thread I found the following script, that helps to get the correct value of that variable. It requires name of the process, that is running on the desktop, on which we want to change the dbus settings. (There can be more than 1 running graphical sessions in parallel). Lets call it discover_session_bus_address.sh

#!/bin/bash

# Remember to run this script using the command "source ./filename.sh"

# Search these processes for the session variable
# (they are run as the current user and have the DBUS session variable set)
compatiblePrograms=( nautilus kdeinit kded4 pulseaudio trackerd )

# Attempt to get a program pid
for index in ${compatiblePrograms[@]}; do
    PID=$(pidof -s ${index})
    if [[ "${PID}" != "" ]]; then
        break
    fi
done
if [[ "${PID}" == "" ]]; then
    echo "Could not detect active login session"
    return 1
fi

QUERY_ENVIRON="$(tr '\0' '\n' < /proc/${PID}/environ | grep "DBUS_SESSION_BUS_ADDRESS" | cut -d "=" -f 2-)"
if [[ "${QUERY_ENVIRON}" != "" ]]; then
    export DBUS_SESSION_BUS_ADDRESS="${QUERY_ENVIRON}"
    echo "Connected to session:"
    echo "DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}"
else
    echo "Could not find dbus session ID in user environment."
    return 1
fi

return 0

With this script we can do the following, assuming that unity process is running on the desktop, on which we want to apply our settings:

. ./discover_session_bus_address.sh unity
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize "4"

And things should work OK.

I have a POST-Install script that sets my gsetting. Because I run the script as sudo the EUID is 0, there fore I have to find the $RUID (Real User ID).

here is my approach:

#!/usr/bin/env bash
# Get the Real Username
RUID=$(who | awk 'FNR == 1 {print $1}')

# Translate Real Username to Real User ID
RUSER_UID=$(id -u ${RUID})

# Set gsettings for the Real User
sudo -u ${RUID} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUSER_UID}/bus" gsettings set org.gnome.desktop.interface clock-show-date false

exit


(32) insufficient privileges I'm getting an error called (32) insufficient privileges while trying to connect to my wifi network. The existing solutions don't seem to work.
bhagirath@bhagirath-HP-ProBook-440-G2:~$ rfkill list
0: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no

I found the following instructions, give them a shot

pkill nm-applet
then become root
start nm-applet
set up connection and check "Available to all users."
Kill nm-applet again
Exit root
start nm-applet as a normal user

Source: http://crunchbang.org/forums/viewtopic.php?id=21636


Wifi cannot reconnect in any way after long time sleep/suspend/hibernate I just installed ubuntu 16.04. I have the problem that wifi cannot reconnect in any way after a long time sleep or suspend or hibernate( I leave the computer until next day ).

I googled, I've tried any method I can find online, but they don't work:

I followed this thread, edit the /etc/NetworkManager/NetworkManager.conf, but it's not working
this thread, run the command: systemctl restart network-manager.service
sudo killall NetworkManager && sudo NetworkManager
$ sudo nmcli networking off
$ sudo nmcli networking on
$ sudo ifdown -a
$ sudo ifup -a
sudo ifconfig wlp4s0 up
service network-manager restart

I don't know whether my problem is caused by this bug, but I don't see the fix for this bug:
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1574347

nmcli dev shows that the type is wifi, but it is disconnect, I can't make it reconnect except reboot system.

Can someone help me?

I recently had this problem with Elementary OS. I tried everything under the Google sun, but the only thing that solved my problem was to do a very hard turning off and on by reinstalling the OS.

I understand that this is not thy type of answer you were looking for, but it is a potentially valid solution, if all else fails. I believe that there is a prolific variety of Q&A on this very problem through the Internet. I encourage you to look through these and to report the results here.


Facebook and YouTube not working in Chrome or Firefox Can somebody explain why in my Ubuntu 13.04 the facebook site and youtube site can't be opened by Chrome or Firefox. Other sites can be opened except for this two site. I really need a hand here.

result from ip addr:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1402 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:23:18:a1:c1:96 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.103/24 brd 192.168.0.255 scope global eth0
    inet6 fe80::223:18ff:fea1:c196/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 40:61:86:9c:18:cf brd ff:ff:ff:ff:ff:ff

victor@victornolii:~$ ping -c 4 youtube.com
PING youtube.com (120.28.26.50) 56(84) bytes of data.
64 bytes from 120.28.26.50: icmp_req=1 ttl=50 time=905 ms
64 bytes from 120.28.26.50: icmp_req=2 ttl=50 time=2155 ms
64 bytes from 120.28.26.50: icmp_req=4 ttl=50 time=1796 ms

You have DNS issues.

From the ping command, I see that your system resolves youtube.com to 120.28.26.50. Well, that is not Youtube or Google. No, that's an internet sevice provider in the Philippines. That's scary. Somebody is trying to be the "man in the middle" here! Be aware.

Try using Google Public DNS on your system instead. Follow the instructions in this answer on how to do that: https://askubuntu.com/a/310752/88802

$ whois 120.28.26.50
% [whois.apnic.net node-7]
% Whois data copyright terms    http://www.apnic.net/db/dbcopyright.html

inetnum:        120.28.0.0 - 120.28.255.255
netname:        GLOBET-PH
descr:          Globe Telecom/Innove Communication
descr:          Internet Service Provider, Makati City
country:        PH
[...]

And it has no reverse DNS (all Google servers have that!):

$ host 120.28.26.50
Host 50.26.28.120.in-addr.arpa not found: 2(SERVFAIL)

In the Netherlands, it looks like this (and you should have similar results - though the IP address will be different of course):

$ whois 173.194.65.93 # result of ping youtube.com
[...]
NetRange:       173.194.0.0 - 173.194.255.255
CIDR:           173.194.0.0/16
OriginAS:       AS15169
NetName:        GOOGLE
[...]

OrgName:        Google Inc.
OrgId:          GOGL
Address:        1600 Amphitheatre Parkway
City:           Mountain View
StateProv:      CA
PostalCode:     94043
Country:        US

$ host 173.194.65.93
93.65.194.173.in-addr.arpa domain name pointer ee-in-f93.1e100.net.

I've reached the same error. The problem was resolved after i've changed the interface's MTU to 1464. The original value was 1500.


Not able turn on the wifi on Lenovo Y520 I have recently installed Ubuntu on a Lenovo Y520. I'm not able to turn on the wifi.

I heard that there are some issues with WiFi in Ubuntu 17.04 but they all are related to connectivity.

I wonder if it could be related to BIOS settings as I had to change a few to install Ubuntu on this machine.

I didn't find any key on the keyboard or any button on the laptop to enable/disable wifi physically.

Wifi is working fine in Windows OS on the same machine. So I don't think it is switched off.

03:00.0 Network controller [0280]: Intel Corporation Wireless 8265 / 8275 [8086:24fd] (rev 78)
Subsystem: Intel Corporation Device [8086:1010]
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi

$ rfkill list all
0: ideapad_wlan: Wireless LAN
    Soft blocked: no
    Hard blocked: yes
1: ideapad_bluetooth: Bluetooth
    Soft blocked: yes
    Hard blocked: yes
3: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
4: hci0: Bluetooth
    Soft blocked: yes
    Hard blocked: no

There is no change after rfkill unblock all

Run in a terminal

sudo tee /etc/modprobe.d/ideapad.conf <<< "blacklist ideapad_laptop"

and reboot.

First try rfkill unblock all. if this doesn't fix your problem try the following.
open the file /etc/network/interfaces as sudo nano /etc/network/interfaces and append the following lines to /etc/network/interfaces.

auto "your wireless interface's name"
iface "your wireless interfaces's name" inet auto

here replace "your wireless interface's name" by the name of your wireless network interface as you see it in ifconfig -a". After doing this you have to make the service network-manager manages the interfaces listed in /etc/network/interfaces, because network-manager doesn't manage the interfaces listed in the /etc/network/interfaces file out of the box i.e. by default.

To turn on interface management, open the network-manager config file i.e. sudo nano /etc/NetworkManager/NetworkManager.conf. and change the line

[ifupdown]
managed=false

to

[ifupdown]
managed=true

then restart the network-manager service by:

sudo service network-manager restart

the interface should be managed and up.

If this fails try ifup "your wireless interface's name".


Unable to turn on seamless mode in VirtualBox I'm not able to switch to Seamless Mode in VirtualBox with Ubuntu 10.04 or 9.10 as guest OS's. I have tried the seamless mode with XP as guest OS, and it works absolutely fine. The host OS is Windows 7.

I have in-built Via/S3G Unichrome Pro IGP graphics, and I have allocated 30 MB out of 64 MB of graphics memory. I've also 1.5 GB of RAM.

I also tried installing Guest Additions but it still didn't work. VirtualBox version is 4.0.4r70112.  The Host+L does not lead to seamless mode. i.e. under the Machine menu in Virtual box window "Seamless mode" is disabled (comes in grey color). How can I get the seamless mode to work? Please help!

For seamless mode (Host+L) Virtual Box Guest Additions of the same program version need to be installed in the guest OS.

How to install Guest Additions see also this answer. In some cases you will simply need to reinstall the Guest Additions if they don't run the way they should.


The configuration defaults for GNOME Power Manager have not been installed correctly. Cannot login I have booted my ubuntu 11.04 on my other PC ( I have put my disk into it and booted it) and now don't know why, when I put it back to my lappy I get this error

I cannot login to the GUI. I know I can repair it from the virtual terminal but how ? Can you help me on that ?

So finally I have solved the issue with launching these commands in virtual terminal :

apt-get purge gnome-power-manager
apt-get install gnome-power-manager

I could solve the same issue by cleaning /media/* path. below cmd may help some one.

cd /media
sudo chmod 777 *
sudo rm-rf *

The actual issue in my case was, mounted volumes put a trace in /media path which crashes the login with message "The configuration defaults for GNOME Power Manager have not been installed correctly".


how to install grub on installed ubuntu disk? I have installed ubuntu, and somehow my grub is not detected because my 1st disk has a bad sector, I have tried using this command:

sudo grub-install /dev/sdb1 --recheck --force-lba

and it didn't work. It prompted a message like:

/dev/loop0 does not have any corresponding BIOS drive.

How to install grub on current running partition?

Try boot-repair by booting into ubuntu from live USB.

Install boot repair --> For this, open a terminal and do the following:

sudo add-apt-repository ppa:yannubuntu/boot-repair

sudo apt-get update

sudo apt-get install -y boot-repair

Run boot-repair -->

sudo boot-repair

Click on "Recommended repair". Write on a paper the new URL that will appear.

Reboot your PC

Normally you install grub to the whole drive ( /dev/sdb ), not a partition on it, but in your case, you seem to be using WUBI, so you can't use grub-install.  My recommendation would be to stop using WUBI and do a real install of Ubuntu, since wubi is no longer supported.