How do I use OAuth from an Ubuntu Touch app? I'm writing an Ubuntu Touch application in QML. I'd like to integrate with Trello. There are two ways to log into Trello in the API, one of which is OAuth, which I plan on using. What is the best way to do this from QML? I'd prefer not to use a C++ backend, but I am willing to do so if that is the only way.

You could create an account plugin for Trello, so that a Trello account could be created from the "Online Account" panel in the System Settings. The you could use the Ubuntu.OnlineAccounts QML module to login, like this:

import QtQuick 2.0
import Ubuntu.OnlineAccounts 0.1

Rectangle {
    width: 400
    height: 300

    AccountServiceModel {
        id: accounts
        service: "trello-board"
    }
    ListView {
        id: listView
        anchors.fill: parent
        model: accounts
        delegate: Item {
            width: parent.width
            height: 60
            AccountService {
                id: accts
                objectHandle: accountServiceHandle
                onAuthenticated: { console.log("Access token is " + reply.AccessToken) }
                onAuthenticationError: { console.log("Authentication failed, code " + error.code) }
            }
            Text {
                anchors.fill: parent
                text: providerName + ": " + displayName
                MouseArea {
                    anchors.fill: parent
                    onClicked: accts.authenticate(null)
                }
            }
        }
    }
}

This code will get you the OAuth token. In order to create the account in the first place, you need to create the following files:

/usr/share/accounts/providers/trello.provider
/usr/share/accounts/services/trello-board.service
/usr/share/accounts/qml-plugins/trello/Main.qml

Given that Trello uses OAuth 1.0 like Flickr and twitter, just create the above files using the twitter or flickr version as a template, and modify them as needed (for the .service file, you could use flickr-sharing.service); in trello.provider you'll need to change the API endpoints as following:

<setting name="RequestEndpoint">https://trello.com/1/OAuthGetRequestToken</setting>
<setting name="TokenEndpoint">https://trello.com/1/OAuthGetAccessToken</setting>
<setting name="AuthorizationEndpoint">https://trello.com/1/OAuthAuthorizeToken</setting>

And of course, change the other fields (callback URL, client ID and secret) to match those you set when you registered your app with Trello.
If all goes well, you'll be able to create a Trello account from the "Online Accounts" panel in the System Settings.

Since the approach that mardy uses isn't actually available to apps under confinement on Ubuntu Touch, it is necessary to do the OAuth dance your self. Essentially, you need to load the login page in a WebView and then intercept the response using the onUrlChanged signal to extract the auth token. Below is an example using StackExchange's own OAuth implementation.

In OAuth.qml:

import QtQuick 2.0
import QtWebKit 3.0
import "OAuth.js" as OAuth

Rectangle {
    height: 750
    width: 500

    Text {
        id: nextState
        visible: false
        anchors.centerIn: parent
        text: "Log in successful!"
    }

    Item {
        id: stackOAuth
        property string nextState: "AuthDone"
        anchors.fill: parent
        Component.onCompleted: OAuth.checkToken()
        property string token: ""
        WebView {
            id: loginView
            visible: false
            anchors.fill: parent
            onUrlChanged: OAuth.urlChanged(url)
        }
        Rectangle {
            height: 50
            width: parent.width
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            Text {
                text: loginView.url
            }
        }

        states: [
            State {
                name: "Login"
                PropertyChanges {
                    target: loginView
                    visible: true
                    url: "https://stackexchange.com/oauth/dialog"+
                         "?redirect_uri=https://stackexchange.com/oauth/login_success"+
                         "&client_id=YOUR_CLIENT_ID&scope=read_inbox"
                }
            },
            State {
                name: "AuthDone"
                PropertyChanges {
                    target: loginView
                    visible: false
                    opacity: 0
                }
                PropertyChanges {
                    target: nextState
                    visible: true
                }
            }
        ]
    }
}

Then in OAuth.js you have code to extract the token from the url and handel storing/checking it from your database:

.import QtQuick.LocalStorage 2.0 as Sql

function urlChanged(url) {
    var authorized = false;
    var mUrl = url.toString();
    var token = "";
    if (mUrl.indexOf("https://stackexchange.com") > -1) {
        var query = mUrl.substring(mUrl.indexOf('#') + 1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if (pair[0] == "access_token") {
                authorized = true;
                token = pair[1];
                console.log("Found token: " + token)
                saveToken(token);
            }
        }
    }
    if (authorized) {
        stackOAuth.token = token;
        stackOAuth.state = "AuthDone";
    }
}

function saveToken(token) {
    console.log("Saving...")
    var db = Sql.LocalStorage.openDatabaseSync("Token", "1.0", "the token", 1);
    var dataStr = "INSERT INTO Token VALUES(?)";
    var data = [token];
    db.transaction(function(tx) {
        tx.executeSql('CREATE TABLE IF NOT EXISTS Token(token TEXT)');
        tx.executeSql(dataStr, data);
    });
}

function checkToken() {
    var db = Sql.LocalStorage.openDatabaseSync("Token", "1.0", "the token", 1);
    var dataStr = "SELECT * FROM Token";
    db.transaction(function(tx) {
        tx.executeSql('CREATE TABLE IF NOT EXISTS Token(token TEXT)');
        var rs = tx.executeSql(dataStr);
        if (rs.rows.item(0)) {
            stackOAuth.token = rs.rows.item(0).token
            stackOAuth.state = "AuthDone"
            console.log("Auth done...")
        } else {
            stackOAuth.state = "Login"
            console.log("Logging in....")
        }
    });
}

This example is (more or less) a port of the old QtQuick 1.0 example from Nokia to QtQuick 2.0.


Quickly is Not Packaging My Application? I Can't Package my Quickly Command Line Application , The Following is The Error Output

quickly package --verbose shows the following output

    /host/cryptonite$ quickly package --verbose
running install_egg_info
Writing /tmp/tmp5mW39i/cryptonite-14.02.1.egg-info
Searching packages which provide required Python modules:
Can't update changelog.
An error has occurred when creating debian packaging
ERROR: can't create or update ubuntu package
ERROR: package command failed
Aborting

Try with sudo, some of the operations may need root privileges.


Why does 14.10 remove Empathy? I had installed 14.04 Trusty Tahr sometime earlier this year and it came with Empathy preinstalled. I then upgraded to 14.10 this morning, and I saw it removed Empathy and any plug-ins.

Why was it removed as the default IM application?

I am using the 64bit version of Ubuntu 14.10 and it has Empathy

They might have removed it from the 32bit version? You could always download it from the Ubuntu Software Centre


Will GRUB be upgraded if I upgrade my system to a newer release? I have a system with Ubuntu 11.10 and GRUB classic installed. Does an upgrade to the most recent version of Ubuntu also updates my GRUB to GRUB2?

If your Ubuntu version is 11.10, it's unlikely you have GRUB "classic" installed, unless it is installed by another, separate operating system. Ubuntu started using GRUB2 in 9.10.

One point of confusion is that a GRUB installation with version number 1.98 or later is GRUB2. It's only GRUB1, or GRUB legacy, if the version is 1.97 or earlier.

Furthermore, in Ubuntu, the normal package providing GRUB2 for machines with BIOSes is called grub-pc. (Traditionally, BIOS is a major part of what's thought to make a computer a "PC," which may explain this naming convention.) The GRUB package for GRUB legacy is called grub.

There is a grub2 package but currently it is a dummy package with grub-pc and grub-common as dependencies.

I am composing this answer from an Ubuntu 11.10 system. My system definitely has GRUB2, but the grub-pc version is 1.99-12ubuntu5.1. That's perfectly normal.

If you upgrade your Ubuntu 11.10 system to a later version of Ubuntu, the version of GRUB it provides will also be upgraded. It will take on a version number that starts with 2. But it was GRUB2 before that, too.

yeah. latest ubuntu using grub2, anyway u can install back to grub-pc (legacy) for replace grub2.


nslookup finds ip for a hostname in .local domain, but ping does not I know this looks like all the other "can ping via ip but not dns" questions, but those didnt really help me at all.

Also, having hosts files in all machines is not doable as this server will eventually handle a lot of computers connecting to it.

I have a ldap+dns server set, and I want the computers on my network to authenticate on the ldap server.

The ldap part of it is working just fine and I can ssh into the ldap server with the ldap credentials just fine.

The problem comes with the client machines, the client is set to use the dns server (in this case 192.168.0.243) and if I get in the terminal and do a nslookup it finds the ldap server just fine.

fernando@desktest:~$ nslookup ldap.mynet.local
Server:     192.168.0.243
Address:    192.168.0.243#53

Name:   ldap.mynet.local
Address: 192.168.0.243

But when I ping it, it doesn't find the ip address. It just hangs there looking pretty till I CTRL-C it.

Of course pinging by ip address works just fine.

Here are the zone files for the dns server:

fernando@ldap:~$ cat /etc/bind/named.conf.local
zone "mynet.local" {
    type master;
    file "/etc/bind/db.mynet.local";
};

zone "0.168.192.in-addr.arpa" {
    type master;
    notify no;
    file "/etc/bind/db.192";
};
fernando@ldap:~$ cat /etc/bind/db.mynet.local
;
; BIND data file for local loopback interface
;
$TTL    604800
@   IN  SOA ns.mynet.local. root.mynet.local. (
                  7     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
         604800 )   ; Negative Cache TTL
;
@   IN  NS  ns.mynet.local.
ns  IN  A   192.168.0.243
server  IN  A   192.168.0.250
desktest    IN  A   192.168.0.249
remote  IN  A   192.168.0.248
winserver   IN  A   192.168.0.247
web         IN  A   192.168.0.246
tempfs  IN  A   192.168.0.245
ldap    IN  A   192.168.0.243
antenarfb   IN  A   192.168.0.253
antenapan   IN  A   10.82.223.7
adslgvt IN  A   192.168.0.1
fernando@ldap:~$ cat /etc/bind/db.192
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@   IN  SOA mynet.local. root.mynet.local. (
                  6     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
@   IN  NS  ns.
1   IN  PTR ns.mynet.local.
2   IN  PTR server.mynet.local.
3   IN  PTR desktest.mynet.local.
4   IN  PTR remote.mynet.local.
5   IN  PTR winserver.mynet.local.
6   IN  PTR web.mynet.local.
7   IN  PTR tempfs.mynet.local.
8   IN  PTR ldap.mynet.local.
9   IN  PTR antenarfb.mynet.local.
10  IN  PTR antenapan.mynet.local.
11  IN  PTR adslgvt.mynet.local.
fernando@ldap:~$

I am really at a loss about what to do and any help will be greatly appreciated.

---- edit ----

before anybody asks, yes the server is running :)

root@ldap:/etc/bind# rndc status
version: 9.7.0-P1
CPUs found: 1
worker threads: 1
number of zones: 16
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running

---- end edit ----

I believe this is caused by mdns - multicast dns, for autoconfiguration of the .local domain.

If you check in /etc/nsswitch.conf, you will probably see:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

mdns4 is what is doing multicast dns. Try changing this to:

hosts: files dns

And see if it makes any difference. If it makes it work, you can remove mdns permanently with:

Try apt-get remove libnss-mdns

Which will do the nsswitch.conf change for you as well.

Alternatively, don't use .local - use .lan or something instead.

Another thing that I have seen interfere with DNS is installing winbind. It seems to put a wins entry before [NOTFOUND=return] in /etc/nsswitch.conf, which causes DNS to fail, but can be fixed by moving wins to after the "NOTFOUND" part, also, preferably after dns so that dns lookup happens first, see this:

http://ubuntuforums.org/showthread.php?t=1496488

(not sure why this happens by default though; comments welcome!)


What do I do with the iso of 14.04 and 13.10 to use Ubuntu on my windows 7 computer? What do  I do with the iso?  I did install with Wubi last year but now I have a new computer.

Per the official Ubuntu documentation documentation, download the application available here, run the application, and point it towards your .iso file (you will need a USB drive of at least 2 gigs). Wait for the application to finish doing its thing then get ready:

With the USB stick still in your computer, restart your computer. With any hope your machine will sound like its starting normally, but in stead of seeing the windows loading screen, you will see a purple background with Ubuntu in white lettering. If you've gotten this far, you'll be taken into what's called a "Live Session" of Ubuntu. Basically, the operating system is running off your USB drive, you can do anything you feel like doing (I recommend playing around and trying to figure out how to do things, it will be different from Windows). If you decide you like it, double click the icon on the desktop that says "Install Ubuntu" at this point you'll be given the option to either erase Windows, or partition to install along side it. I'm going to assume you want to install along side your Windows partition, so choose that and the rest should be fairly straight forward.

It sounds like you've used Ubuntu before, but are more comfortable with Windows, so I'm going to refer you to the Linux Mint page (linuxmint.com). Mint is built on top of Ubuntu, and is designed to be easier for people coming from Windows to get used to, but of course feel free to choose any Linux distro you like.

Finally, if when you restart your computer you in stead see Windows loading, wait for it to load, then restart your computer again. You will need to access the computer's BIOS by pressing a certain key (usually escape or delete). At this point I can't help you much more without knowing exactly what computer you're using, but hunt around for something that looks like "boot order" and be sure "USB" or "removable" is at the top of the list, but also being sure not to completely remove any from the list, just reorder them.

Best of luck, and please add [SOLVED] to the title of this thread if this helped you out, otherwise, feel free to come back for help!


Ubuntu 12.04 freezing on startup Possible Duplicate:
  What should I do when Ubuntu freezes?

Have been looking everywhere to find a solution to this problem but have yet to find a solution. I am running 64 bit 12.04 LTS on a AMD C-50 Dual core 6 gigs ram AMD Ratheon HD 6250.

The problem I am experiencing is when ubuntu gets to the wallpaper screen it will sometimes freeze soon after the the image appears or shortly there after gnome loads locking up keyboard and mouse. When I try to log in via the console the same thing happens (this is as ubuntu is loading).

At the moment the system is set to auto login previously it was set to ask for password but it did the same thing. Switching to from lightdm to gdm did nothing to alleviate the issue.

I have never had so many issues with ubuntu I have to say 12.04 is the most buggy version yet.

I discovered the real problem. It was AMD Catalyst. I have removed it since I have no need for 3d graphics on my system. There is another solution however it is found here.

http://www.upubuntu.com/2012/06/install-amd-ati-catalyst-126-display.htmlenter link description here

I tried this but I ended up with a watermark saying unsupported hardware. I was unable to remove it so instead I removed catalyst completely.

To fix the resolution problem I simply edited my xorg.conf file and added the right resolution for my monitors. Have not had it freeze since doing this.

I experienced a very similar problem. You may be having a problem where Compiz is incompatible with your graphics driver. Compiz is not needed to get to the login screen so you get to that point OK. Then when you login, Compiz loads (or tries to) and blows up. There are lots of tips on this site regarding how to fix broken Compiz, none of which worked for me and several of which bricked the PC completely. A possible workaround (not the solution) is to try and load the legacy Unity 2D desktop rather than the newer Unity 3D desktop (which is a Compiz plugin and hence rides on top of Compiz. To do this, boot the computer so you see the login display. If you configured auto-login, you need to figure out how to disable this. I ended up completely repeating the install process from scratch and when prompted whether to auto-login or not I selected no.  At the login screen, there is a Ubuntu icon immediately to the right of your login ID.  Click this and you'll see an option for desktop options: Unity (the new Compiz-based version) and Unity 2D (the old Compiz-free version). Select Unity 2D and then click Back and then finish logging in. When you log into your desktop, lightDM will not try to load Compiz at all. If your desktop then loads fine, you at least have a functioning system and know where the problem is, even if you are missing a bit of bling.

Running the command echo $DESKTOP_SESSION in a shell will tell you whether you are currently running Unity (3D/Compiz) or Unity 2D (no Compiz).

To make permanent your decision to use Unity 2D, run gksu gedit /etc/lightdm/lightdm.conf and change user-session=ubuntu to user-session=ubuntu-2d.  Save, exit gedit and reboot.  You should not have to manually select Unity 2D vs. Unity 3D at login as lightdm will read its config file and automatically load Unity 2D.  Good luck.


Devices are not working affecting my performance on Ubuntu especially my graphic card , Guys what to do? I am having this problem from the first time I installed Ubuntu, I tried to search for any solutions, but I couldn't find anyone mentioning how to solve the missing graphic card and other drivers.

I know that Ubuntu identify my drivers automatically and installs them, but for me, I couldn't see that "Maybe because I changed my built-in motherboard long ago"I don't know

This is affecting my overall performance and especially Davinci Resolve 16

If you can tell me how to solve this I will be so thankful.

This is my grep radeon results, red-colored all radeon:

lsmod  | grep radeon
radeon               1478656  2
ttm                   106496  2 amdgpu,radeon
drm_kms_helper        184320  3 amdgpu,radeon,i915
drm                   491520  15 gpu_sched,drm_kms_helper,amdgpu,radeon,i915,ttm
i2c_algo_bit           16384  3 amdgpu,radeon,i915

This is when I hit lspci -k | grep -EA3 'VGA|3D|Display':

00:02.0 VGA compatible controller: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07)
    DeviceName:  Onboard IGD
    Subsystem: Dell Skylake GT2 [HD Graphics 520]
    Kernel driver in use: i915
--
01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 520 Mobile] (rev 81)
    Subsystem: Dell Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 520 Mobile]
    Kernel driver in use: radeon
    Kernel modules: radeon, amdgpu

My sincere

Your graphics card isn't particularly powerful. It's got less power than a GT545 which is from 2014. DaVinci Resolve will not work as expected regardless of which OS you run it on. Try and find the Adrenalin software for your system/card and see if you're able to update the drivers. Even then, you're not likely to get much better performance, but give it a try :)


Eclipse content-assist popup is unreadable on Ambiance/Radiance theme I use ubuntu 10.10 and installed the Eclipse indigo from the official eclipse website. It's a java editor (not CDT) and characters on the content assist popup are not readable.

Is there any solution?

After little research:

gedit ~/.gtkrc-2.0

paste and save:

style "eclipse_fix"
{
    base[ACTIVE] = shade(0.7, "#F2F1F0")
}

class "GtkTreeView" style "eclipse_fix"

Then you must logout or change your style in order to reload new settings.

This might be a dumb answer but... is it possible that the font color is set to white so you can't actually see anything? I guess you can change the font color somewhere in in Preferences.


How do I uninstall Ubuntu Wubi? I want to uninstall Ubuntu because I just don't like it...  I have windows 7 and no boot disk or anything special to uninstall, when I installed Ubuntu it said easy to uninstall and I would love to know how to actually uninstall it. Thank You.

I will hate my answer since I always tend to tell people to use Ubuntu and give a chance (Either adapting to the new ways of using it or checking if the benefits it offers over Windows outweigh the amount of problems they face on a daily basis with Windows)

LIVECD
Assuming you install Ubuntu using the LiveCD (not Wubi), the fastest way is to use the Windows 7 CD/DVD. Boot from it and select "Repair your computer". Then from a repair prompt execute the following line to replace the Grub bootloader: bootrec /fixmbr

That will eliminate the bootable part of GRUB and reinstall the Windows 7 Boot way. After that you will have to remove the Ubuntu partition or partitions created with it. You can later merge them with Windows or install Ubuntu in case you feel you made a mistake ^^.

WUBI
Go to Control Panel, Uninstall a program (Vista/7) or Add/remove programs (XP), and double-click on the Ubuntu entry to automatically uninstall. Reference.

If this does not work, or for more information about Wubi uninstallation (or general Wubi information), follow the instructions to manually remove Wubi

In any case I would give Ubuntu a chance, at least a 1 week test drive. Of course, remember to update everything since 12.04 has many changes that need updates after a fresh installation. I could mention the MANY benefits of using Ubuntu but I leave it to you to feel the force.

Luring Link - Benefits of Ubuntu - Google Search (Feel the force)

I've never done this before, but I this is what I would do:

Step 1 - Give a second chance to Ubuntu. I this fails, go to step 2.

Step 2 - First, backup everything just in case. Secind, reboot your computer with an Ubuntu Live CD. Open the "GParted Partition Editor" to remove Ubuntu.

I can't give you detailed steps because I never did this. But I hope this answer can help you a little bit.


Ubuntu 16.04 not dynamically assigning an ip address to enp5s0 I've done a fresh install of Ubuntu 16.04

When i connect another computer or Gigabit switch through the wired connection it fails to assign an ip address to enp5s0.

I understand i could configure a static ip but i would prefer to resolve this issue.

Thanks for all your help, however i've made the following progress.

I ran this command to check the model number of my Ethernet Controller

lspci | grep Realtek

The output

05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 05)

I then checked checked what driver the kernel was loading

lsmod | grep r816*

The output

r8169                  81920  0
mii                    16384  1 r8169

Seeing that they did not match i headed over to the Realtek website to get the RTL8101 Driver but they only have it for the 3.x, 2.6.x and 2.4.x kernels.

And so either I have to wait until Realtek release a driver for kernel 4.x or upgrade my hardware.

spacelander thanks for the link i learned from it

heynnema i assure you that you can connect direct and get an ip number, as I've been doing it for years and I'm sure with the correct driver I'll do it again.

Thanks & Regards
Jonny


Will installing Ubuntu to dual boot with Windows slow down any OS or my laptop? I am going to install Ubuntu to dual boot with Windows 8 soon, but one of my friends warned me that partitioning my hard drive will slow my computer down. I run on a 500GB HDD and 8GB of ram if that helps at all. Is that true if I do it?

There are several factors to take into account but generally speaking, Ubuntu normally is at disadvantage when installing. This is because Windows is normally at the beginning of the disk, and Ubuntu (or any other distro) is at the end. Disks are faster then closer they are to the start, hence Windows will have shortest seek times, that will give it a boost opposed to Ubuntu.

Another thing is that Windows will not run at the same time that Ubuntu, nor the reverse. Hence while you are running Windows, only your system inherent performance is taken into account. I have not seen (nor imagine) any circumstance that Windows will slow down because you installed Ubuntu.

Bottom line, Windows normally will have the advantage on the hardware, but Ubuntu (Linux) will use it more efficiently. That's all.

Nobody here has addressed the issue of the windows page file. If you rely on the page file currently and reducing the space available to windows decreases your page file size, it can lower the total memory consumption (hardware + paged) available to Windows.

Really a minor issue though.


Ubuntu-14.04.2-desktop iso image I try to download ubuntu-14.04.2 desktop from

http://www.ubuntu.com/download/desktop

But after whole downloading the iso image, when I getting to burn it to a CD or install on a bootable USB it says not probable image.

Run the command:

md5sum <download-filename>

Then compare the output to the correct version of your download on this list

This checks that the file isn't corrupted in any way.

Verify the image's checksum against the one provided by Ubuntu:

b436b6d4c7de064652f30d783bda5b4e  ubuntu-12.04.2-desktop-amd64.iso

You can calculate the checksum by running md5sum [file].


How can I reboot extra fast? There are often occasions where Ubuntu users need to do a quick reboot, e.g. after a kernel update or when testing some settings that require rebooting.

I would like to have a method (e.g. a script) that allows me to save as much time as possible performing a reboot.

Those are things which can probably be avoided to reduce reboot time until the user session is ready:

if possible, skip BIOS/UEFI/firmware initialization and POST
skip GRUB menu (preselect the desired entry once and directly boot it without any timeout)
skip login screen (use passwordless auto-login once)

Maybe there are even more things that could be skipped for a quick reboot.

I have seen the RapidReboot spec in the Ubuntu Wiki, but the page was last edited 2010-02-03.

But even if we might not yet properly be able to use this described kexec to skip firmware initialization and stuff, temporarily preselecting the GRUB entry and using auto-login for exactly one reboot should be possible. How can I set this up?

I'm using Ubuntu 16.04, 64 bit with Unity DE, lightdm and GRUB in dual boot with Windows 10 (and soon some more Linux distros) on an Acer Aspire E5-773G machine with UEFI.

Reboot times

We can procrastinate rebooting at times in this world of "overly busy" and not wanting to waste 5 or 15 seconds. When I had first looked at this question my boot times had gone from 45 seconds to 14 seconds with an SSD and systemd tweaking.

Recently I acquired a "modern" laptop with a NVMe M.2 Gen 3.0 x 4 SSD with blazing 3.4 GB/s Windows read speed and 2 GB/s Linux read speed. So it should be faster right? Um... no. It's painfully slower:

$ systemd-analyze
Startup finished in 6.823s (firmware) + 4.447s (loader) + 3.467s (kernel) + 8.412s (userspace) = 23.151s

This time is actually after tweaking. It was much worse 80 seconds because nVidia and Dell choose to cut power to HDMI audio on nVidia GTX970M graphics card which drives the HDMI port. As such a setpci command was required which caused "low grapics error" message and you had to wait 20 seconds for mouse pointer to proceed. Then it would reload all graphic drivers and restart lightdm.

Another problem with the "modern" laptop is BIOS POST was taking 15 seconds. Tweaks in BIOS to turn off hardware error checking, turn off loading boot drivers for NICs and other tweaks I can't remember just now changed BIOS POST time to 6 seconds. By comparison the "old" laptop BIOS POST time was only a couple of seconds using Legacy BIOS CSM and no BIOS tweaking.

Ubuntu's RapidReboot project from 2010

The Ubuntu RapidReboot project mention in ByteCommander's post is from 2010. The project's rationale is summed up thusly:

  Rationale

  There are a few cases where we can safely assume the user does not
  want to see the boot loader; in these cases, we should use kexec to
  avoid long reboots, BIOS POSTs, and boot loader time. This can take 10
  seconds in optimal situations; but with SCSI or RAID BIOS and network
  boot roms, the time can climb to 20, 30, or even over 60 seconds, even
  in cases where the time between loading the kernel and seeing the
  log-in screen is 30-60 seconds.

The project's usage examples:

  Use cases

  Bob has just upgraded his kernel; update-notifier informs him he must reboot for the changes to take effect, and the 'Restart' button
  uses kexec to make this faster.
  Alice just upgraded dbus; update-notifier tells her to restart, and uses kexec.
  Seveas has performed several updates in the past month, and now is under three times as much memory pressure due to different programs
  using different copies of shared libraries. He decides to reboot to
  clear this up, and uses a "Quick Reboot" to make this faster.
  Keybuk just installed Ubuntu Edgy and wants to boot into it. The LiveCD loads the target kernel and initrd with kexec; umounts all
  disk-based file systems; sync; and then uses kexec to start the new
  system rather than rebooting.

Using kexec to reboot

kexec is the magic spell we cast to reboot without BIOS post and some other low level discovery mechanisms such as RAID setup.

Kernel must be compiled with CONFIG_KEXEC flag

The first step is to ensure your kernel was compiled with the CONFIG_KEXEC=y option:

$ uname -r
4.14.2-041402-generic
$ grep KEXEC= /boot/config-`uname -r`
CONFIG_KEXEC=y

The first command uname -r is optional just to show what kernel you've booted with. As we can see on the second command the kernel is compiled by Ubuntu team with the necessary flag set. Not sure when this was added but likely <= year 2012.

Install kexec-tools

The next step is to install the kexec tools for user space:

$sudo apt install kexec-tools

After normal binary downloads you are greeted with this screen:

I answered No in part because of this bug report that the option is not relevant in systemd.

Then the installation continues (snippet shown below):

Unpacking kexec-tools (1:2.0.10-1ubuntu2.4) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21) ...
Setting up kexec-tools (1:2.0.10-1ubuntu2.4) ...
Generating /etc/default/kexec...
Generating grub configuration file ...
  (... CUT ...)
Found Windows Boot Manager on /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi
Found Windows Boot Manager on /dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
Processing triggers for systemd (229-4ubuntu21) ...

Configuring kexec

Our cohorts at ArchLinux have great documentation for kexec but it needs massaging for Ubuntu / Debian distributions.

Basic usage are with two commands:

sudo kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initrd.img-`uname -r` --reuse-cmdline
sudo kexec -e

from this point forward it appears every time you click reboot it automatically reloads the last kernel in fast reboot mode.

Using Systemd to load kexec

Create the file /etc/systemd/system/kexec-load@.service:

[Unit]
Description=load %i kernel into the current kernel
Documentation=man:kexec(8)
DefaultDependencies=no
Before=shutdown.target umount.target final.target

[Service]
Type=oneshot
ExecStart=/usr/bin/kexec -l /boot/vmlinuz-%i --initrd=/boot/initrd.img-%i --reuse-cmdline

[Install]
WantedBy=kexec.target

Then enable the service file for the kernel you want to load, for example to simply set the current kernel uname -r:

$ sudo systemctl enable kexec-load@`uname -r`
Created symlink from /etc/systemd/system/kexec.target.wants/kexec-load@4.4.0-101-generic.service to /etc/systemd/system/kexec-load@.service.

Then to kexec:

$ sudo systemctl kexec

If you have youtube running there might be a system inhibitor preventing you from rebooting in which case use:

$ sudo systemctl kexec -i

If you wish to load a different kernel for the next kexec, for example 4.12.2-041202-generic, disable the service for the current kernel and enable the one for the new kernel:

$ sudo systemctl disable kexec-load@`uname -r`
$ sudo systemctl enable kexec-load@4.12.2-041202-generic

More to come

I have to post this answer now as it's time to boot, fix, boot, fix, repeat. I have a complicated setup where systemd loads five nVidia drivers which I have to unload, run setpci to power on audio to hdmi, reload nVidia drivers and restart lightdm. It might take awhile to work out.

After getting the cli methods working I'll create a desktop shortcut for one-click rebooting with sudo password prompt. After that I'll create a desktop shortcut to a yad dialog box allowing you to pick from installed kernels to reboot. Similar to grub's advanced options menu.

If you want to partially restart your computer (and not speed-up the boot), here is my understanding : there are 3 main parts in Linux boot :

Step 1 : Computer boot until boot manager / OS selection (rEFInd, Grub, ...)
Step 2 : Start Linux and main services
Step 3 : Start the session

user login
window manager like Cinnamon, KDE, Gnome, ...)

Restart step 3 only :

Type Alt-F2 and R
Or sudo service $(cat /etc/X11/default-display-manager) restart

Restart step 2 and 3 only :
I don't know how to restart Linux from your boot manager

Restart all steps

In the main menu, choose "restart"
From command line, type sudo reboot


How do I find a recent file by date created? If I want to find a file by name, I do the following:

find -name app

If I want to find a file by type, I do the following:

find -name app -type d

However, because app is such a generic name, many results show up. I would like to find a directory named app, which was created today. Is there a flag or command to achieve this?

To search the whole filesystem (/) for

directories (-type d),
called app (-name app),
that were modified more recently than one day (i.e., 24 hours) ago (-mtime 0),

...Use:

find / -name app -type d -mtime 0

Source: man find.

In particular see the explanation of the -mtime flag and the "find $HOME -mtime 0" example:

  [T]o match -mtime 0, a file will have to have a modification in the past which is less than 24 hours ago.

(Thus the time in days since the file was modified is rounded down to the nearest integer for purposes of being matched by -mtime.)

Creation is considered a form of modification for the purpose of file timestamps, so this will work even if the file's contents weren't altered after it was created. It will also match folders with modification timestamps in the last day that were created earlier, but you probably don't have many such folders whose exact name is app.

When a file was created is not typically stored in the filesystem. But the time at which its metadata were last changed (e.g., name/location, ownership, permissions) is stored. If you prefer to go by that to when the file's contents were modified, use -ctime in place of -mtime:

find / -name app -type d -ctime 0

For both -mtime and -ctime, the original creation of the file qualifies as a modification / status change.

You can use the modification time, either

find -name app -type d -mtime -1

(modified less that 1 x 24 hours ago) or

find -name app -type d -newermt yesterday


How to securely upgrade Ubuntu from 16.04 to 18.04 Is it possible to upgrade Ubuntu from 16.04 to 18.04?

Are there any known issues with upgrading from 16.04 to 18.04 so far?

What precautions can I take to minimize the potential for data loss and down time? And how do I start the update?

Thank you in advance

Charlie

When in doubt err on the side of caution. The best thing to do is test, test and test some more. Using this script: Bash script to clone Ubuntu to new partition for testing 18.04 LTS upgrade you can clone your Ubuntu 16.04 to a new partition and run the upgrade to 18.04 on the new partition.

If the upgrade fails, find out why, wait for fix, clone the data again and rerun the upgrade.

After the upgrade succeeds test each application you use. If one doesn't work, find out why, wait for fix, clone the data again and rerun the upgrade.

The other part about testing is to choose which of the five unique signons you like best between Gnome, Unity, Wayland, X11 and combinations therein.

Additionally you can install new applications previously not available such as tweak tools and experiment with them. If you break something, clone the data again and rerun the upgrade.

Wash, Rinse, Repeat then Repeat again...

As far as I know, there are no risks whatsoever. Canonical even states that it's safe. They did say that it would be easier, however, to simply reinstall the OS later on than upgrading. Here's a link to their guide on upgrading to another version (NOTE: it didn't work on my install, but I didn't have a good, reliable internet connection).


How do I upgrade to a newer version of Ubuntu? What are the different ways I can use to upgrade Ubuntu from one release to another?

Summary
This answer summarizes the recommended community upgrade process.
You should always read the release notes for any potential issues that may affect your upgrade.
Backup
Before you start any upgrade process – ask yourself this question:
Can I afford to lose any/all my data such as documents and files?
If the answer is no - then backup your installation.
Upgrading Ubuntu works 99 times out of 100 – a backup will save you lots of frustration later if things do go wrong.
Comparison of backup tools
Graphics
If you have installed proprietary drivers from the Additional Drivers or Hardware Drivers window then these should be automatically upgraded with the Nvidia/ATI binary driver appropriate for 12.04/14.04
If you have downloaded and installed proprietary drivers manually directly from the manufacturers website then the recommendation is to remove these drivers first and revert to the open-source drivers before upgrading.  Potentially what can happen is that a /etc/X11/xorg.conf file will remain after the upgrade and subsequently on first reboot, you will boot into a 'black screen'.
These questions describe the removal process:

How do I remove ATI/AMD Drivers downloaded from their site?

Remove nVidia driver and go back to Nouveau

PPAs
During the upgrade, any PPA sources you may have added will be automatically disabled.  Generally, PPAs do not affect the upgrade process.
There are a couple of specific PPAs that could cause issues - x-swat and xorg-edgers.  These PPAs should be removed via ppa-purge before upgrading

ubuntu-x-swat/x-updates
xorg-edgers/ppa

How to Upgrade
Your 13.10 upgrade program will alert you of the new release and offer an upgrade. If this does not happen then see the trouble-shooting section below.
Please see the trouble-shooting section for the special case for LTS users between 12.04/14.04 and the release 12.04.1/14.04.1
The official ubuntu.com page has information:

For desktop and server editions.

Immediately after a Ubuntu release, the download servers are extremely busy.  Thus, if you can, we suggest to wait a few days if you want to upgrade.
Alternatively, download using a bittorrent client such as Transmission, the official desktop ISO torrent.
Upgrade over the Network
You can easily upgrade over the network with the following procedure.

Launch the update manager.
Click the Check button to check for new updates.
If there are any updates to install, use the Install Updates button to install them, and press Check again after that is complete.
A message will appear informing you of the availability of the new release.

For 10.04LTS/12.04LTS users you need to check the "Release upgrade - Show new distribution releases" drop-down to make sure "Long term support releases only" is selected, and change it if otherwise. See the Trouble-shooting section below for more details.  Please see the trouble-shooting section for the special case for LTS users between 12.04/14.04 and the release 12.04.1/14.04.1

Click Upgrade.

Follow the on-screen instructions.
See Also:

https://help.ubuntu.com/community/TrustyUpgrades for more information on some alternate methods of upgrading for certain cases.

Upgrading by using the CD or USB image
If you are using 10.04 LTS/12.04 LTS or 11.10/13.10 and you either insert the live CD or boot from the live CD to start installing it will give a option of upgrading to 12.04/14.04. It will automatically detect installed applications and install the updated version of your applications also.
If you download an ISO, the recommendation is to perform a md5sum check to ensure both the ISO downloaded and the burned CD are valid.

Upgrade from 10.04 LTS/12.04 LTS (here shown with dual boot):

NOTE: Upgrades from 10.04 to 12.04 / Upgrades from 12.04 to 14.04 are not activated yet, see this question for more detail:

Why is "No new release found" when upgrading from a LTS to the next?

Upgrade from 11.10/13.10

Upgrading using the command line (eg Ubuntu Server):
11.10/13.10 and later

Run do-release-upgrade in a terminal

10.04/12.04

edit /etc/update-manager/release-upgrades and set Prompt=lts

Run do-release-upgrade in a terminal

Troubleshooting
If your 10.04/12.04 or 11.10/13.10 update-manager does not prompt you to upgrade, then check your software sources to see if it is set to "Never".  If it is then change the value to "Long Term Support Releases Only" (10.04 LTS/12.04 LTS) / "For any new version" (11.10/13.01):

for 10.04 LTS/12.04 LTS

for 11.10/13.10
According to Ubuntu Engineering Foundations team manager Steve Langasek:

Upgrades between LTS releases are not enabled by default until the first point release,  It is recommended that most LTS users wait until then before upgrading.

If you choose to upgrade before then, you can pass the -d option to the upgrade tool, running do-release-upgrade -d or update-manager -d, to upgrade from vanilla 10.04/12.04 to 12.04/14.04.
See this Q&A for further details:
Why is "No new release found" when upgrading from a LTS to the next?
If you are using an End of life version of Ubuntu
You might need to make changes to /etc/apt/sources.list to refer to the old-releases server of Ubuntu. Follow the answers given in this question to make necessary modifications and then upgrade to a newer version of Ubuntu:

How to install software or upgrade from an old unsupported release?

For the recent Ubuntu releases, e.g. 12.04 onwards, once a new Ubuntu release is available, you will be prompted to upgrade. Once you click "upgrade" in the prompt, follow the instruction on the screen, you will be upgraded to the new release.

If there is no prompt, you can check the following.
Type the following command in terminal:

update-manager

The update manager window will appear and check for the updates. Install all the updates detected.

Click "Setting..." In the update manager, and click "update" tab of the window. For the question "Notify me of a new Ubuntu version", if you choose "For Long term supports version", the new Ubuntu upgrade may not be prompted as the new version of Ubuntu may not be the "Long Term Supports" one. If you choose "For any new version", the new Ubuntu upgrade prompt will most likely appear.

In https://wiki.ubuntu.com/Releases  you will find which version is Long-term supports (LTS) and which is not. Also, you will see each version's release date and life time. Quite useful information.

When the new Ubuntu version released, usually the upgrade prompt would not be appeared immediately. For when the new Ubuntu upgrade prompt will be available for your current Ubuntu version, you can check the Release Notes of the new version in https://wiki.ubuntu.com/Releases


Error opening documents with WPS from ntfs disk When trying to open documents (spreadsheets, presentations or text files) with WPS office the following error occurs:

  Errors occur when WPS Spreadsheets opening this file. Please try one
  of the following. •Make sure you are permitted to access this file or
  drive. •Make sure there is enough memory and disk space.   •Make sure
  this file is recognizable format. (/media/user/Dates/WORK/02 - GOE
  Feb2020.xls)

This error does not occur with LibreOffice. as the error indicates it must be a problem with the permissions but I don't know how to solve it.

You can set it in the app store. Select the installed application, click permissions, allow the read drive.


Slow boot time in ubuntu with ssd I had only 7sec boot time with windows 10 with ssd. When I replaced it with Ubuntu 19.10 it got sucked and now taking a minute to boot the system though i've ssd.

Try installing using CD drive instead of USB. I face same problem everytime when I install Ubuntu with USB. Infact, Ubuntu even run slow. I know it sounds weird and I don't know the reason behind, but it does happen everytime. So, try installing using CD drive.


Necessary to increase size? I used the Windows installer to install Ubuntu 12.10 64 bit. The PC also has Vista Ultimate 32 bit.

In any case, I recall that one of the question asked was where and how much space to provide for Ubuntu installation, which I think I allocated 10 GB on a pretty large partition.

Is there a way to allocate more than 10 GB now that Ubuntu is installed?  If so, how?  Thanks.

You can use gparted software to resize another partition and add resized partition to your Ubuntu partition. Goto software center and type gparted. Most of the case the first result will be the GParted software(Free software) itself install and enjoy.

Updated: Both facts mentioned by Uri Herrera are true. But I've made some assumptions here. Continue if your system has partitions like this.
1. You have at-least 3 partitions, one for Windows, second for Ubuntu, another for your stuff.
If this is so, you can resize partitions other than Ubuntu and Windows partition using gparted but you cannot add to Ubuntu since it was mounted.

So you can do from windows itself.
Browse and download Easeus partition manager. You can do both resizing and adding to Ubuntu partition. At-least you can expand up-to 30 GB.


How to run a nohup script with upstart? I'm porting some SysV-style service scripts for HBase (a java service) to upstart.

The sysv scripts don't call java directly, but instead call hbase-daemon.sh. This is a start-stop-daemon-like tool that ships with the package which pulls in a lot of configuration and ultimately ends in a nohup java ... & to actually run the process as a daemon.

Since the configuration logic in hbase-daemon.sh is involved, I would rather not modify or rewrite it (to remove the nohup) and instead have upstart call it directly.

This seems to be what the expect clause is for, except in my case it isn't working.  Even with expect daemon (the two fork case), I end up tracking the wrong pid on service start.  This suggests that my scenario is forking too much, or perhaps nohup shouldn't be handled with expect, or yet something else.

How can I use upstart to manage a service that expects to be started with a script that calls nohup?

You could try using crontab, and enter this in the terminal:

 crontab -f nohup

and then enter this:

 pyton(version) -v -f echo 'nohup' & disown

and then enter this in the terminal:

 crontab reboot

and it might work fine this way.


Login screen loops unless you login as Guest I am running a VMWare Player with a Ubuntu 12.04 LTS Precise Pangolin as Guest on my Windows 7.
Sometimes I get the shutdown blue screen error in Windows, this time it happened when I was running the Player. When I restarted everything Ubuntu gave me the "Login Loop" on adminstrator login.
I log in and there's this black screen where I can only read:

piix4...smbus:0.0.0.07.3 Host Smbus controller not enabled .

When I go to the prompt in root mode it fails to update and only upgraded, specially some plugins ( I think graphic plugins) which also appear in one an error message after quitting the prompt, but they´are successfully installed.
They are not the error message. After that I have been working with the Fail/safe Mode recovery panel.
When I try to update via Root I get errors like this:
W:failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/release.gpg could not        resolve 'extras/ubuntu.com

There are 8 more like this referring to areas like:
-archive/canonical.com
-ppa.Launchpad.net
-security.Ubuntu.com
-Us.archive.ubuntu.com - release.gpg
                        precise-updates/release.gpg
                        precise_backport/release.gpg

Final Message: some index files failed to download.....they have been ignored or old files are used.
The black screens most of the time pass by too fast for me to pick up any information. But in general I think I have done everything I was able to in the recovery panel including updating network and graphic packages and recovering filesystem packages and the basic stuff ( I am a beginner regarding Linux ) in the root prompt.
Now I am stuck in this screen with graphic options:
- Run in low-graphics mode just for one session
- Reconfigure Graphics
- Troubleshoot the error
- Exit to console login

I am trying to choose to reconfigure graphics but the mouse disappears in the virtual machine screen and sometimes when options change it´s only the first and last option. But this happens from the blue without messages.
This particular option menu is in the regular GUI style against a black screen in Terminal style. Really strange.

I am not sure if what I was experiencing is the same but maybe this will work for you.

I have Ubuntu 12.04 Server LTS updated 6-7-2012 and Desktop installed. I am also running this as a VM in vmware player, not sure if that matters or not.

I had done a ctrl+alt+F1 from desktop to get a shell. When I tried to to start the gui again (sudo startx), I got errors, then after a reboot I got the log-in and when I put in my password it would just loop no error for bad PW! But when I switched to the Guest log-in it would boot normally! What a pain, huh!

So what I did was

switch to shell (Ctrl+Alt+F1)
logged in as the user
cd /home/user (I think that cd ~ will get you to the same place)
sudo mv .Xauthority .XauthorityBak
sudo reboot

This worked it booted normal and all is good!

There are specifics of my installation which may not apply to yours but maybe it will work.

Hope this helps,
K

P.S. I got this info from http://ubuntuforums.org/showthread.php?t=1890457
Thanks carranty

EDIT: I started to get a System Problem Detected when I would log in from a locked desktop so I sudo chown 777 .Xauthority and that seemed to have cleared up the problem. I am not sure if this causes a security issue.

EDIT: Not sure if this did clear up the problem, things are getting funky!

These suggested instructions apply to my case only and should be considered as a non-professional comment and therefore to be tried AT YOUR OWN RISK.

I am using ACER Aspire 4755g with Ubuntu 12.04.1 LTS.

I have also encountered this problem, and in my case, I had a problem with lightdm.
As a temporary measure, when you get to the login screen, press the keyboard sequence Ctrl+Alt+F1. This will get you to a terminal-like screen. It will show you something like this:

[COMPUTER NAME] login:

for example,

Aspire-4755g login:

type in your username and press Enter. This will result into something like this,

Aspire-4755g login: shiela

Password:

Enter your password, and, if correct, would show something like this:

Aspire-4755g login: shiela

Password:

Last login: Tue Jan  1 06:45:02 JPT 2013 on tty1

Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-35-generic-pae i686)

* Documentation: https://help.ubuntu.com/

2 packages can be updated.

0 update are security updates.

shiela@Aspire-4755g:~s

Then, press the keyboard sequence Ctrl+Alt+F7 to get you back to the login screen. This procedure logs you into the system using the terminal-like window. You can now try to login to your account using the login screen. In my experience, I was able to reach the desktop. It seems that there is something wrong with the lightdm configuration that it was not able to log you in to the system.

Should you not make it to the desktop (as it was called in Windows), you may try adding an additional command by pressing the Ctrl+Alt+F1:

shiela@Aspire-4755g:~s ecryptfs-mount-private

press Enter, and it will ask you your password. Enter your password, then press the keyboard sequence Ctrl+Alt+F7 to get you back to the login screen (or to where you last left).

This command loads your Home folder, together with its contents, should you have chosen to encrypt the home folder upon installation of Ubuntu.

Once successful, you may try to review your lightdm configuration located on /etc/lightdm/lightdm.conf.


how to block torrent traffic on ubuntu server? I want to block all P2P (including bittorrent) traffic going through my Ubuntu Server. I have tried :

Blocking certain strings, but it's not effective or user friendly
Blocking IPs that resolve to trackers, but it's impossible to keep pace with them so I need a more effective solution

What other options are there?

iptables -I FORWARD -p tcp -m iprange --src-range 192.168.1.2-192.168.1.100 --dport 1000:65010 -m time --timestart 05:00 --timestop 23:59 --weekdays Mon,Tue,Wed,Thu,Fri,Sat,Sun -j DROP
iptables -I FORWARD -p udp -m iprange --src-range 192.168.1.2-192.168.1.100 --dport 1000:65010 -m time --timestart 05:00 --timestop 23:59 --weekdays Mon,Tue,Wed,Thu,Fri,Sat,Sun -j DROP

Block torrents using iptables

Log Torrent

iptables -N LOGDROP > /dev/null 2> /dev/null
iptables -F LOGDROP
iptables -A LOGDROP -j LOG --log-prefix "LOGDROP "
iptables -A LOGDROP -j DROP

Block Torrent

iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j LOGDROP
iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j LOGDROP
iptables -A FORWARD -m string --algo bm --string "peer_id=" -j LOGDROP
iptables -A FORWARD -m string --algo bm --string ".torrent" -j LOGDROP
iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j LOGDROP
iptables -A FORWARD -m string --algo bm --string "torrent" -j LOGDROP
iptables -A FORWARD -m string --algo bm --string "announce" -j LOGDROP
iptables -A FORWARD -m string --algo bm --string "info_hash" -j LOGDROP

Block DHT keyword

iptables -A FORWARD -m string --string "get_peers" --algo bm -j LOGDROP
iptables -A FORWARD -m string --string "announce_peer" --algo bm -j LOGDROP
iptables -A FORWARD -m string --string "find_node" --algo bm -j LOGDROP

References

How to Block BitTorrent traffic on your Linux firewall

How to Block Bittorrent Traffic with IPtables


Emacs C IDE / Gnu Global helm-gtags Hello Ubuntu Community,

so first of all I'd like to say that I am quite new to ubuntu (16.10) and linux. I decided to use Windows as little as possible and also wanted to start learning the Programming language C. However, I thought it would be nice to do so in Emacs so I started learning Emacs and did some Tutorials on emacs. Mostly Basics and than learning by doing.
So I found this Tutorial https://tuhdo.github.io/c-ide.html
Before that I installed a lot of packages including helm and gtags and helm-gtags. I also installed ncurses libary in order to install gnu global.

So now we get to my problem / question.
First of all if i am honest I don't really now what gtags is, but I thought I gonna figure it out when I install it (Something for navigation I guess). But under section 'Source Code Navigation' he talks about:

"Before using ggtags or helm-gtags, remember to create a GTAGS database by running gtags at your project root in terminal: "..
and then some commands

I think i somehow have to connect a libary with emacs. I the GNU_Global FAQ is written to create a link to my project folder reffering to:
 /usr/src/lib

But in my /usr/src directory is no lib folder. Now I guess , because Ubuntu has slightly different structures than other linux distros this libary is somewhere else ?
Or am I completely wrong ? I couldn't find answers with google so maybe you can enlighten me.

Thanks in advance, Andi

gtags is a Linux tool that generates a symbol database for source code and then allows searching of those symbols for usage and definition.  ggtags is the "plugin" for Emacs that provides an automated frontend to the tool.  Some alternatives that have similar functionality to gtags are ctags, etags, and cscope, most of which have their own Emacs plugins.
Notably, many of these tools are not very good at handling large codebases (Linux kernel size and larger) because of the way they store their databases.  The Linux kernel for example will generate a 2GB text file when using just gtags, and that file has to be loaded and searched whenever you try to do a symbol lookup.  Workarounds exist to resolve this problem (below).
Simple solution
1.Install gtags on your system.
sudo apt-get install global

On a command line you should now be able to run this command and see where it's installed:
which gtags

2.Tell the Emacs ggtags plugin where to find the gtags tool.
Using the path returned by the which gtags command, add the following line to your ~/.emacs file:
(setq ggtags-executable-directory "/path/to/gtags/parent/dir")

3.Create a gtags database for a code project.
By default ggtags will search upward through the directory tree from the file in which you performed a symbol lookup trying to find a GTAGS file.  That GTAGS file (and possibly some associated ones) is your symbol database. If it doesn't find a match for the symbol in the first database file, it will continue searching up the directory tree for additional databases.  Matches are prioritized based on file proximity of symbol usage/definition to the file you're doing the lookup in. Generation of this database is called "tagging", and it's usually located at the root of a source tree you want to tag.  The gtags tool itself does not do this continuation search since it's passed a path to a specific database, and the native Emacs provided gtags plugin maintains this single-database behavior.

To create a gtags database for a source folder out of Emacs when you're using the ggtags plugin (recommended over the native Emacs gtags plugin), you need to run the command ggtags-create-tags.  The default key-binding for running arbitrary commands in Emacs is M-x, so press that and then type ggtags-create-tags.  It will prompt you for a folder everything should be tagged and the database should be placed, so point it to the top directory of the source folder you want to tag.  It will run for a while, possibly quite a while if you have a large source tree, blocking the entire Emacs GUI while it generates the tag database.  Once it completes it will get used automatically by ggtags when relevant.
Much better solution
One of the problems with gtags, ctags, etags, and cscope is the size of the databases produced.  Since they're tagging where symbols are defined as well as where they're used, you can end up with a database larger than your actual source tree.  Very large databases then present the problem of searching them in a reasonable time.  Using ggtags with the default Ubuntu gnu-global tool installed produces a very inefficient database format that gets exponentially worse the larger it grows.  Mostly this is because Ubuntu is still providing the gnu-global tool from 2008 rather than a modern version, and it's not built to use the much more efficient ctags tools as an underlying framework.

To avoid the problems with gtags and get it to use the more efficient ctags, you need global-6.4 or later, and it needs to be built to point to your ctags installations.  The only way I've really found to do this is to build it from source and provide the proper options as well as all the necessary dependent package installations.  I ended up writing a shell script to do this installation and setup for me, and I keep it in GitHub with the rest of my emacs configuration and installation scripts.  You can get it from https://github.com/mtalexan/emacs-settings/blob/master/global_install.sh.
You'll need to set a few things in your ~/.emacs to make full use of this:
(setq ggtags-use-idutils t)
(setq ggtags-use-project-gtagsconf nil)

This enables the use of the very efficient idutils sub-package, and makes sure gtags calls use your global settings for gtags that you've now compiled in.
How to use gtags/ggtags/helm-gtags
I personally use ggtags and not helm-gtags or gtags.  Emacs provides a default gtags "plugin", but it has a much worse interface than ggtags and will only search a single database.  I use helm regularly for most things, but I like my ggtags interface separated from my helm interface when I'm parsing matches so I don't use helm-gtags.  Also helm-gtags is pretty slow if your gtags database is large.

For ggtags you need to set ggtags-mode for it to be useful.  This can be done by adding it to automatically trigger on c-mode by adding something like the following to your .emacs file
(add-hook 'c-mode-common-hook
  (lambda ()
    (when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
     (ggtags-mode 1))))

Alternatively you can set it to always be enabled by instead using a line like this:
(setq ggtags-global-mode 1)

Settings I recommend if you're going to be using a large codebase require the following lines in your ~/.emacs file:
; Allow very large database files
(setq ggtags-oversize-limit 104857600)
(setq ggtags-sort-by-nearness t)

When browsing the code, the most common things I do are to follow a symbol underneath my cursor, find all uses of a symbol underneath my cursor, and occasionally to do a symbol lookup unrelated to where my cursor is.  These correspond to the commands: ggtags-find-tag-dwim and ggtags-find-reference.  These commands operate on a point (your Emacs cursor position) but will open a prompt for you to enter a symbol when there is no symbol under your point or when they're called from M-x.
When you run ggtags-find-tag-dwim it can do a number of things best understood by playing with it, but generally will jump to a match when there's only one match (equivalent that doesn't auto-jump is ggtags-find-tag) or will open a side windows like ggtags-find-reference with a list of possible matches that includes the file, line number, and some context for it where each entry is clickable to jump directly there.
Be careful when that window is open, it puts you in a special minor mode that means the up and down keys will switch between matches until you press Enter to officially select a match.
Conveniently when you select a match your tag-mark is left behind.  This means you can use the command pop-tag-mark to jump back to the last place you were at.  tag-mark is a stack of tag-marks, so you can repeatedly look up symbols and will always be able to go back to each location prior to following a lookup.
If you want to just do a manual lookup rather than one based on the symbol at the point, there are some ggtags functions that operate like ggtags-find-tag-dwim, but prompt you for the symbol in the minibuffer.  ggtags-find-tag-dwim will do this as well if there is no symbol under the point.

sudo apt get global

/*********************** Below is irrelevant *****************/
Welcome to linux and C. and this is my first post. LOL

You are in the right path! congrats! I am a EE student doing CS now.

I hope my advice will help you.

GET rid of windows, dont even use it in a virtual machine.
if cant, but a second laptop only for linux and programming C/C++.

Windows is for entertaining, for non-programmer, I might be a little extreme. YEAH, C/C++ and unix are for the bold, for the pro!

My guess is you havent start learn C++ yet.
If ture, Dude, start C++ first, use  or any book from stack exchange, or quora.

why? C++ is harder, and more job, and if you familiar with C++. I am not sure, I think C can be pick up easily.

why C++ first, a lot of C programming style is not suggested in C++. Some are forbidden if you want to write good and modern C++.

YES, learn C the hard way. there is even a book called that.

HAHA, but if you are EE student, and doing embedded system, learn C! Learn C! Learn C! C is definitely the wonderland here.

To become a god in C programming: (my path)

K&R book, the bible!
APUE, the bible again! there is a online course in APUE, people are serious.
I think you are good to go, no need to read more, BUT!

if you have enough time and energy, read UNIX source code. there is a book called "unix source code commentary". It was a must-have computer science book in MIT. but before that, you need some knowledge about OS.

Enough about C!

Lets talk about IDE, since you are new to Linux.

Use Emacs, Vi, or .. for both C and C++, python, oh, might be other programming languages.

IDE makes you lazy, not thinking about what is really going on.

Think about this, C/C++ are created long before some fancy IDE, windows OS!

how do folks programmed OS those days? use a IDE? haha

Learn C/C++ the hard way. I guarantee you will enjoy it.

LAST, DONT get gnu global.

"It is useful for hacking a large projects which contain many sub-directories" says the web.

Are you maintaining some large projects or just doing some textbook programming exercises?

Again, it makes you lazy!


Nginx stealing port 80! I'm getting a bit frustrated here.
I want port 80 for apache2 but nginx has stolen that port apparently.

I cant find where to remove this, the config for nginx say its listening to port 8000 and 8001

what i can find is that the PID/Program name "6021/nginx -g daemo" uses this as local adress 127.0.0.1:80.

When i do systemctl status nginx this is the info i get the following

    ● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-05-05 01:33:40 CEST; 5s ago
  Process: 6110 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 6118 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 6113 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 6120 (nginx)
    Tasks: 17
   Memory: 8.9M
      CPU: 46ms
   CGroup: /system.slice/nginx.service
           ├─6120 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           ├─6121 nginx: worker process
           ├─6122 nginx: worker process
           ├─6123 nginx: worker process
           ├─6124 nginx: worker process
           ├─6125 nginx: worker process
           ├─6126 nginx: worker process
           ├─6127 nginx: worker process
           ├─6128 nginx: worker process
           ├─6129 nginx: worker process
           ├─6130 nginx: worker process
           ├─6131 nginx: worker process
           ├─6132 nginx: worker process
           ├─6133 nginx: worker process
           ├─6134 nginx: worker process
           ├─6135 nginx: worker process
           └─6136 nginx: worker process

May 05 01:33:40 Headsrv systemd[1]: Starting A high performance web server and a reverse proxy server...
May 05 01:33:40 Headsrv systemd[1]: Started A high performance web server and a reverse proxy server.

I have tried to run the command grep -r "127.0.0.1:80" /* and grep -r "nginx -g daemo" /* but no results, were the hell is nginx getting this port conf!?!
Any tips for troubleshooting is gold to me since i've run in to a wall now..

And before someone ask i have edited /etc/nginx/conf.d/wok.conf and /etc/nginx/sites-available/default to not using port 80

I just had this problem with Debian 10 running openmediavault (OMV). After a restart (where the system had been running for months), the nginx instance that serves the OMV web interface on port 88 suddenly also served an nginx welcome page (from /usr/share/nginx/html/index.html) on port 80. Pretty annoying as I have a Nextcloud instance supposed to be available on that port.
The reason was that some time during some upgrade process, the following lines had been added to the end of the http config in /etc/nginx/nginx.conf:
...
http {
    ...

    client_max_body_size 0;

    server {
        client_max_body_size 0;
    }
}
...

Because the server part doesn't specify a listen directive, it defaults to port 80. And because no root directive was specified, it defaults to /usr/share/nginx/html on my particular system.
Edit It turns out that I actually did the change myself when following this guide to setup my system.

Try to remove the whole section:

http {
    ....
    ....
}

Then, restart nginx.


How to remove php 5.6 I just went ahead and added PHP7 to my server following a guide by using ondej's PPA. Now I want to remove the old php so obviously I did sudo apt-get remove --purge php5 and ti seemed like everything went fine except it is not uninstalled. If I do php -v I get version 7 but I can still do php5 -v and get 5.6 or php5.6 -v and get the same thing. When I do sudo apt-get remove php5 (or php5.6) now I get that the package is not installed, but apparently is since I can execute the command.

x@x-server:~$ php -v
PHP 7.0.6-1+donate.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
x@x-server:~$ php5 -v
PHP 5.6.21-1+donate.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
x@x-server:~$ php5.6 -v
PHP 5.6.21-1+donate.sury.org~trusty+2 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
x@x-server:~$ sudo apt-get remove --purge php5 php5.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'php5.6' is not installed, so not removed
Package 'php5' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
x@x-server:~$

How can I completely remove php5?

And just because I know someone would ask - I want to remove it because I see that there are some processes running because of it that I don't want to have.

 1192 root      20   0  358756  30920  23568 S   0.0  2.1   0:00.12 apache2
 1238 root      20   0  309316  29708  23448 S   0.0  2.0   0:00.11 php-fpm7.0
 1176 root      20   0  166212  17848  14408 S   0.0  1.2   0:00.07 php-fpm5.6
 1226 www-data  20   0  359312  15488   7656 S   0.0  1.1   0:00.09 apache2
 1227 www-data  20   0  359008  14028   6380 S   0.0  1.0   0:00.00 apache2
 1228 www-data  20   0  359008  13496   5856 S   0.0  0.9   0:00.00 apache2
 1229 www-data  20   0  358788   9324   1964 S   0.0  0.6   0:00.00 apache2
 1230 www-data  20   0  358788   9324   1964 S   0.0  0.6   0:00.00 apache2
 1377 www-data  20   0  358788   9324   1964 S   0.0  0.6   0:00.00 apache2
 1242 www-data  20   0  309316   8496   2236 S   0.0  0.6   0:00.00 php-fpm7.0
 1243 www-data  20   0  309316   8496   2236 S   0.0  0.6   0:00.00 php-fpm7.0
 1299 root      20   0  105680   6540   5468 S   0.0  0.4   0:00.06 sshd
 1178 www-data  20   0  166212   5580   2140 S   0.0  0.4   0:00.00 php-fpm5.6
 1179 www-data  20   0  166212   5580   2140 S   0.0  0.4   0:00.00 php-fpm5.6

Package named php5 or php5.6 is just a meta-package that pulls one of the available web SAPIs (apache2, fpm or cgi). The easiest way how to remove full stack of packages is to remove php5-common and/or php5.6-common package as everything else depends on it, e.g.:

apt-get purge php5-common

The other option would be to use wildcard support in apt-get and do:

apt-get purge 'php5*'

Try running apt-get autoremove.  I think what you are seeing is the FastCGI Process Manager which might have been installed with the core PHP5, but not removed as part of the uninstall.  Failing that apt-get remove php5.6-fpm --purge --autoremove.  You are already running the v7 of fpm so shouldn't see any adverse effects.


sshpass broken since ubuntu 16.04 Since I upgraded to 16.04, the following command fails:

sshpass -p password ssh user@host

with the error:

Could not create directory '/home/mylocaluser/.ssh'.

(~/.ssh folder already exists).

The following command:

ssh user@host

still works.

Before upgrade the first command used to work perfectly.

EDIT:

Discovered that .ssh directory in my home folder was only a symlink to /home/mylocaluser/Dropbox/Mockup/.ssh (and that one doesn't exist)!!!
I removed the symlink and now the command sshpass still fails with no errors.

With the last openssh upgrade, I had to reauthorize all of my connections before forwarding them to sshpass.

It's possible that the folder /home/mylocaluser doesn't have the right permissions.

Try running the following commands:

sudo chown mylocaluser:mylocaluser /home/mylocaluser
sudo chmod u+rwx /home/mylocaluser

(Obviously replacing all "mylocaluser" with the appropriate username.)

The first line changes the ownership of the folder to your user and the group (also of the same name).

The second line adds the read, write, and execute (or access) permissions to the directory.

You should now be able to create a folder under that directory, which is what sshpass appears to be complaining about.


Could not load 'vboxdrv' after upgrade to Ubuntu 16.04 (and I want to keep secure boot) I upgrade from Ubuntu 15.10 to 16.04 and since then VirtualBox 5.0.18 isn't starting my VMs anymore. It complains that 'vboxdrv' isn't loaded. So I try to load it and get the following error:

$ sudo modprobe vboxdrv
modprobe: ERROR: could not insert 'vboxdrv': Required key not available

I believe it is related to secure boot which I use and which I want to continue using. Actually with Ubuntu 15.10 secure boot and VirtualBox were working just fine.

Also I tried $ sudo apt-get --reinstall install virtualbox-dkms which built the kernel module successfully but didn't solve this issue.

Any idea how to get vboxdrv loaded while keeping secure boot enabled?

Update 2: Also I tried executing sudo mokutil --disable-validation. When executing this command, during the next boot I get prompted to disable secure boot, add a key or hash from disk. Since I don't want to disable secure boot, it seems that this doesn't solve my issue either. Also I want to keep UEFI activated for a parallel Windows installation.

Note: If you don't mind disabling secure boot, see Why do I get "Required key not available" when install 3rd party kernel modules or after a kernel upgrade? instead.

Since kernel version 4.4.0-20, it was enforced that unsigned kernel modules will not be allowed to run with Secure Boot enabled. Because you want to keep Secure Boot, then the next logical step is to sign those modules.

So let's try it.

Create signing keys

openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Descriptive common name/"

Option: for additional security, skip the -nodes switch, which will ask for a password. Then before moving on to the next step, make sure to export KBUILD_SIGN_PIN='yourpassword'
Sign the module (vboxdrv for this example, but repeat for other modules in ls $(dirname $(modinfo -n vboxdrv))/vbox*.ko) for full functionality)

sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)

Confirm the module is signed

tail $(modinfo -n vboxdrv) | grep "Module signature appended"

Register the keys to Secure Boot

sudo mokutil --import MOK.der

which will ask for a password to use to confirm the import in the next step.
Reboot and follow instructions to Enroll MOK (Machine Owner Key). Here's a sample with pictures. The system will reboot one more time.
Confirm the key is enrolled

mokutil --test-key MOK.der

If VirtualBox still does not load, it may be because the module didn't load (sudo modprobe vboxdrv will fix that) or that the key is not signed. Simply repeat that step and everything should work fine.

Resources: Detailed website article for Fedora and Ubuntu implementation of module signing. @zwets for additional security. @shasha_trn for mentioning all the modules.

Additional resource: I created a bash script for my own use every time virtualbox-dkms upgrades and thus overwrites the signed modules. Check out my vboxsign originally on GitHub.

I got error about vboxdrv after upgrade too. But there was problem with old version (5.0.14) of Oracle VM VirtualBox Extension Pack. I downloaded and installed newer version (5.0.18) of this pack and problem disappeared.


Cannot boot because: Kernel panic - not syncing: Attempted to kill init! This is what I've got. I cannot boot and I see the two of three little lights on the keyboard blinking all the time and the cooling is working on full power, almost.

I saw in other askubuntu topic suggestion for memory test. I did it. I didn't have any errors.

I am 99,9% sure it is not a hardware problem, because I have Windows 7 and I can boot it and it works just fine.

This problem came without any warning or something. I just turned off the laptop one day and at the other day I couldn't boot.

From recovery mode I get this:

There you go /sbin/init: No such file or directory. Looks like it can't find a /sbin/init on /dev/sda6.

Maybe have a look from a Live CD, and see what is on sda6? Is it the right partition? Is just that file missing?

You can probably fix it from a Live CD, but I'm not sure what caused it, so I can't give instructions. Reinstalling is probably easier, if you don't know how to fix it, yourself.

I got this issue with ubuntu 18.04, on upgrading my distro from 16.04 to 18.04, The boot process throws, Kernel Panic

e2fsck
sbin/init: No Such file or Directory
Kernel Panic - Not Syncing : Attempted to kill init !

In order to resolve this, I booted from Live Ubuntu 18.04 disk, then i replaced the contents of my filesystem directories

/bin & /sbin

with the corresponding content of the directories /bin & /sbin of stock filesystem  of Live Ubuntu disk.

First find the disk partition which has the probelm in my case it was /dev/sda5 now boot from the live disk and mount /dev/sd5 with the Live Disk

open terminal and run the following commands to replace the contents

cp -r -i /bin /media/ubuntu/<name of your partition folder>
cp -r -i /sbin /media/ubuntu/<name of your partition folder>

example:

cp -r -i /bin  /media/ubuntu/cdfb882d-e33c-49b5-8965-fea541464686/bin/
cp -r -i /sbin /media/ubuntu/cdfb882d-e33c-49b5-8965-fea541464686/sbin/

shutdown the pc and reboot.

Done
Hope this may help!


Can't access BIOS on dual boot system 18.04 with Win10 I boot my system and hammer the Esc, F2, and Delete keys. The system flashes the Lenovo logo for a split-second, and then goes straight to GRUB. I continue hammering the F2 key and the system will boot to Ubuntu or Windows depending on which one I select. Throughout this process there's no chance to get into the BIOS like I could in the good old days despite my hammering of all top row keys on my keyboard (Esc, F2, etc).
I've tried to access the UEFI Firmware settings similar to the screen below. Every option is there System Restore, System Image Recovery, etc. EXCEPT the one I need UEFI Firmware settings. It's simply missing.
How do I get into my BIOS?

If you can not access directly in the BIOS with F2 or Del you probably did not do a good boot of Windows at first.When you want to have a dual boot, you first need to install windows with the correct BIOS settings and then boot 18.04.You must avoid UEFI mode in bios,try with legacy mode.
Good luck.

I realize it is an old topic, but yesterday I encountered the same issue on a Lenovo T520 with Windows 10 (dual booting with GRUB). No UEFI settings in Windows advanced startup and pressing Enter, Del or F1 on Lenovo screen doing nothing.

I had success in entering UEFI settings, however, by hitting Enter then F1 in quick succession while on Lenovo boot screen.


'sudo apt-get -f install' produces error with overwriting I am new to Ubuntu and Linux in general. I installed Ubuntu 16.04 but I can not install any applications in it. The error messages tell me there are unmet dependencies and tell me to run 'sudo apt-get -f install'. But running it produces the following errors:

Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 178237 files and directories currently installed.)
Preparing to unpack .../libasyncns0_0.8-5build1_i386.deb ...
Unpacking libasyncns0:i386 (0.8-5build1) over (0.8-4) ...
dpkg: error processing archive /var/cache/apt/archives/libasyncns0_0.8-5build1_i386.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libasyncns0/changelog.Debian.gz', which is different from other instances of package libasyncns0:i386
Preparing to unpack .../liblcms2-2_2.6-3ubuntu2_i386.deb ...
Unpacking liblcms2-2:i386 (2.6-3ubuntu2) over (2.2+git20110628-2ubuntu3.1) ...
dpkg: error processing archive /var/cache/apt/archives/liblcms2-2_2.6-3ubuntu2_i386.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/liblcms2-2/copyright', which is different from other instances of package liblcms2-2:i386
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../libogg0_1.3.2-1_i386.deb ...
Unpacking libogg0:i386 (1.3.2-1) over (1.2.2~dfsg-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libogg0_1.3.2-1_i386.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libogg0/copyright', which is different from other instances of package libogg0:i386
Preparing to unpack .../libsamplerate0_0.1.8-8_i386.deb ...
Unpacking libsamplerate0:i386 (0.1.8-8) over (0.1.8-4) ...
dpkg: error processing archive /var/cache/apt/archives/libsamplerate0_0.1.8-8_i386.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libsamplerate0/changelog.Debian.gz', which is different from other instances of package libsamplerate0:i386
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../libwrap0_7.6.q-25_i386.deb ...
Unpacking libwrap0:i386 (7.6.q-25) over (7.6.q-21) ...
dpkg: error processing archive /var/cache/apt/archives/libwrap0_7.6.q-25_i386.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libwrap0/changelog.Debian.gz', which is different from other instances of package libwrap0:i386
No apport report written because MaxReports is reached already
                                                              Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libasyncns0_0.8-5build1_i386.deb
 /var/cache/apt/archives/liblcms2-2_2.6-3ubuntu2_i386.deb
 /var/cache/apt/archives/libogg0_1.3.2-1_i386.deb
 /var/cache/apt/archives/libsamplerate0_0.1.8-8_i386.deb
 /var/cache/apt/archives/libwrap0_7.6.q-25_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Use Following Command before using install -f:

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


How can I split the standard Ubuntu terminal? I would like to have several terminals in the same window. I know I can have tabs, but with them we can't see two terminals at a time.

I know Terminator is another terminal able to do this, but I really like the standard terminal.

Is it possible ?

Not with the standard terminal. There are, however, a number of applications that you can install that will extend your terminal to allow for it, called multiplexers. Tmux and Screen are two of the most common.

Very interesting commands using tmux:
sudo apt install tmux
tmux
Ctrl+b " Split current pane horizontally into two panes
Ctrl+b % Split current pane vertically into two panes
Ctrl+b o Go to the next pane
Ctrl+b ; Toggle between the current and previous pane
Ctrl+b x Close the current pane
Ctrl+b d keep your terminal running in background (you can close the terminal even if a socket is running.
Ctrl+b w list your panes (e.g. after reopening the terminal)
For more options you can see here: https://linuxize.com/post/getting-started-with-tmux/


How to remap pgup and pgdown to home and end Thinkpad X1 Carbon Ubuntu 13.10 Gnome-shell I have used the xmodmap technique, I even made a file called .Xmodmap and put it in the start up commands in the gnome tweak tool, but there are still occasions where the buttons don't perform what I specified. I know because opening my terminal and doing "xmodmap ~/.Xmodmap" fixes the behavior to what I need.

Any ideas on what might not be working right here?

for linux mint you can use the last post in this topic.
http://forums.linuxmint.com/viewtopic.php?f=208&t=135999
also seems that using different type of loading (kdm or startx) is loading through different files so you should check if realy xinitrc is loaded at all . If not xinitrc then try .xsession may be. I didn't work for me though

Sorry . This should be rather comment but I don't have rights to do comments.
How it works for me on linux mint 17:

create remapkey (show have right to run 555 for example) file in /usr/lib/bin/
in start up programs I added

  bash /usr/local/bin/remapkey

command to start

in this file I have

  xmodmap $HOME/.Xmodmap


regain control of mouse by restarting Xorg? Lately whilst browsing the web the mouse will "hold down left click" and not let go -- i.e. I get a closed hand icon that can move around but doesn't interact with the screen. Restarting the OS solves it but I don't want to to continually lose what I'm working on.

This is a problem with trackpad or USB mouse equally. From googling it looks like since Ubuntu 8 or earlier there has been a problem with Xorg whereby mouse errors in Firefox cause this problem.

The error was also noticed by this user: USB mouse moves but doesn't accept left clicks

I was able to solve the problem once by closing openbox and restarting with awesome but today that's not working. Any other ideas? Could I restart Xorg without losing everything and thereby "restart the mouse"?

I have the same problem and it has nothing to do with Firefox in my case.

Its definitely NOT a hardware problem (I've tried multiple mice).

The symptoms : I do "something" (haven't quite put my finger on it yet) that causes the left mouse button to appear stuck down (its like a MOUSE_DOWN event happened, but never a corresponding MOUSE_UP event).

The stuck mouse button seems to manifest itself mostly in Intellij IDEA, which basically becomes unusable.

I generally have the following three programs running at all times :

Intellij IDEA
Virtual Box (usually running a few windows VMs)
Chromium

To solve the problem, I end up having to reboot (which kills a lot of time, because I have to alsy cycle the VMs).

As far as what triggers this problem - it is somewhat hard to determine but I think it may have something to do with using the mousewheel while the focus is on one of the virtual box VMs.

One other thing I've noticed is that the problem only seems to happen in Unity.  If I choose Gnome shell then I've not had the issue (but I end up coming back to Unity since its grown on me).

Hit Ctrl+Alt+F6 (switch in console mode), and after Ctrl+Alt+F7 for return in graphic mode (my mouse has always start to work again).


Ubuntu 16.04 LTS and Virtual Interfaces Hi tried different options googling for advice.

As for today I have:

Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial

updated as yesterday

trying to make:

sudo ip address add 192.168.0.7/24 dev enz3   ;
sudo ip address add 192.168.0.8/24 dev enz3

permanent

I modified the etc/network/interfaces files as:

 # interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

iface enz3 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1

auto enz3:1
allow-hotplug enz3:1
iface enz3:1 inet static
address 192.168.0.7
netmask 255.255.255.0
gateway 192.168.0.1

auto enz3:2
allow-hotplug enz3:2
iface enz3:2 inet static
address 192.168.0.8
netmask 255.255.255.0
gateway 192.168.0.1

then I restart network service

systemctl restart networking

I get an error:

xx@xx-VBox:~$ systemctl status  networking.service
networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)

Drop-In: /run/systemd/generator/networking.service.d
           └─50-insserv.conf-$network.conf
 Active: failed (Result: exit-code) since mer 2019-06-05 12:15:39 CEST; 5s ago
     Docs: man:interfaces(5)
Process: 4423 ExecStop=/sbin/ifdown -a --read-environment --exclude=lo (code=exited, status=0/SUCCESS)
Process: 4963 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 4959 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclu
Main PID: 4963 (code=exited, status=1/FAILURE)

giu 05 12:15:38 xx-VBox systemd[1]: Starting Raise network interfaces...
giu 05 12:15:38 xx-VBox ifup[4963]: RTNETLINK answers: File exists
giu 05 12:15:38 xx-VBox ifup[4963]: Failed to bring up enz3:2.
giu 05 12:15:39 xx-VBox systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
giu 05 12:15:39 xx-VBox systemd[1]: Failed to start Raise network interfaces.
giu 05 12:15:39 xx-VBox systemd[1]: networking.service: Unit entered failed state.
giu 05 12:15:39 xx-VBox systemd[1]: networking.service: Failed with result 'exit-code'.

but nevertheless

ip addr

shows

 enz3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    inet 192.168.0.2/24 brd 192.168.0.255 scope global enz3
       valid_lft forever preferred_lft forever
    inet 192.168.0.7/24 brd 192.168.0.255 scope global secondary enz3:1
       valid_lft forever preferred_lft forever
    inet 192.168.0.8/24 brd 192.168.0.255 scope global secondary enz3:2
       valid_lft forever preferred_lft forever
    inet6 XXXXXXXXXXXXXXXXXXXXXXXXXX scope link
       valid_lft forever preferred_lft forever

and

ifconfig

shows

  enz3

  enz3:1

  enz3:2

and I am able to connect and visualize apache2 index.html

from oustide for the 192.168.0.2 address default webserver

and for the two virtual hosts webservers at 192.168.0.7 and 192.168.0.8

What Am I missing ? why I am getting the error ? Is something else that wont work with this set up ?

Edit

The system works just to access apache2 webservers:
from outside I can access: 192.168.0.02
                          192.168.0.07
                          192.168.0.08

from inside (192.168.0.2) I can access:  localhost
                                          192.168.0.7
                                          192.168.0.8

but I am not able to ping 192.168.0.2 from outside (192.168.0.3) or surf the net from inside (192.168.0.2).
I can ping the host 192.168.0.3  from inside the VM (192.168.0.2 is a VM on VirtualBox)

nslookup dosent work from inside th VM (192.168.0.2)

debian manual says

    iproute2 method

Also, ifupdown supports specifying multiple interfaces by repeating iface sections with the same interface name. The key difference from the method described above is that all such sections are treated by ifupdown as just one interface, so user can't add or remove them individually. However, up/down commands, as well as scripts, are called for every section as it used to be.

Note however that this method is dangerous! Certain driver/hardware combinations may sometimes fail to bring the link up if no labels are assigned to the alias interfaces. (Seen this on Debian Wheezy and Jessie with RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 01) auto-negotiating to 10/full. A similar warning from another person exists in the history of this page.)

This /etc/network/interfaces text assigns three IP addresses to eth0.

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.42/24
    gateway 192.168.1.1

iface eth0 inet static
    address 192.168.1.43/24

iface eth0 inet static
    address 192.168.1.44/24

# adding IP addresses from different subnets is also possible
iface eth0 inet static
    address 10.10.10.14/24

But even using labels (or at least I think I am using them):

    auto enz3
allow-hotplug enz3
iface enz3 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1

iface enz3:1 inet static
    address 192.168.0.7
    netmask 255.255.255.0

iface enz3:2 inet static
    address 192.168.0.8
    netmask 255.255.255.0

I still get the error:

giu 05 17:38:43 dv-VBox systemd[1]: Stopped Raise network interfaces.
giu 05 17:38:43 xx-VBox systemd[1]: Starting Raise network interfaces...
giu 05 17:38:43 xx-VBox ifup[5004]: RTNETLINK answers: File exists
giu 05 17:38:43 xx-VBox ifup[5004]: Failed to bring up enz3.
giu 05 17:38:43 xx-VBox systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
giu 05 17:38:43 xx-VBox systemd[1]: Failed to start Raise network interfaces.
giu 05 17:38:43 xx-VBox systemd[1]: networking.service: Unit entered failed state.
giu 05 17:38:43 xx-VBox systemd[1]: networking.service: Failed with result 'exit-code'.

What Should I try next ?

maybe this is the answer ?

How do I use /etc/network/interfaces instead of network-manager

Not sure is valid for 16.04 too ?

nope

 [ifupdown]
managed=false

is already there


Can I run Ubuntu on a Surface laptop? My dad bought a Surface laptop for me.
Can run Ubuntu on it?
I tried and the keyboard does not work, so is there any version available that solves this problem?

Noo linux distro contains drivers for any of surface machines. Only way to make it work is with those guys
https://github.com/jakeday/linux-surface

You didn't provide any information as to what type of surface you own, so I'll give you a blanket solution, and refine it if you edit your question. Before you try this, please try giving us more information, such as your Ubuntu version(16.04,19.10, etc.), the output of lsusb and what type of surface you own(year, model number, serial number, and most importantly, keyboard serial number).
According to the surface linux subreddit

Type Cover (2017): Partially Working, touchpad Multi-Touch works, sometimes detaching/re-attaching results in a buggy experience, little to no debugging has been done on the issue. The keyboard itself does not work. This is almost certainly remediable by adding the device ID's into the Linux kernel, so, please report the device ID's (and please differentiate your model of Type Cover (i.e. with Biometrics, without Biometrics, Signature, etc.)
Surface Laptop Integrated Keyboard/Trackpad: Partially Working, touchpad Multi-Touch works, the keyboard itself does not work. This is almost certainly remediable by adding the device ID's into the Linux kernel, so please report the device ID's.

this thread is a good example of the process of adding and ID to the kernel.
So what does this mean for you? It means that if you haven't tried already, this may be remedied by installing the custom surface linux kernel


I am trying to harden our Ubuntu 14.04 server. Can I delete some builtin system users I am relatively new to managing Ubuntu servers.  I am currently trying to harden our webserver.  I have noticed that the following users are setup on the server and I believe they are default users that were created when the system was setup.  I am curious if I can delete these users without causing harm.  Also, do these users cause any security issues. The users include: games, new, list, backup, uucp, proxy, messagebus, lp.

Finally, there are some other users that previous adminstrators setup.  Is there a way that I can see if they are actually being used by a service or if they are safe to delete.  I appreciate any insight.

Thanks
Brian

Pasting from https://www.debian.org/doc/manuals/securing-debian-howto/ch12.en.html

  12.1.12.1 Are all system users necessary?

  Yes and no. Debian comes with some predefined users (user id (UID) <
  99 as described in Debian Policy or /usr/share/doc/base-passwd/README)
  to ease the installation of some services that require that they run
  under an appropriate user/UID. If you do not intend to install new
  services, you can safely remove those users who do not own any files
  in your system and do not run any services. In any case, the default
  behavior is that UID's from 0 to 99 are reserved in Debian, and UID's
  from 100 to 999 are created by packages on install (and deleted when
  the package is purged).

Please take a look at the above link for details on this.

No you cant, those users are there because of some program are using it. To harden your server, remove unnecessary program and it will remove the user tied to it as well as part of the removal process.


Dual boot with windows 8 (raid) I know there are quite a lot of other posts like these, but I really read all of them and I still couldn't solve my problem.

I recently got a dell with a 1TB hdd disk and a 32gb ssd disk (using RAID) installed with windows 8 and now I want to install ubuntu 13.04 in the hdd disk.

The problem is that it seems that ubuntu can`t recognize the partitions on the drive.
When I start ubuntu installation, no partitions are shown:
http://postimg.org/image/otkjg28ot/

And if I try to open Gparted I get the following error:
http://postimg.org/image/q9w1y7blp/

And clicking in cancel, it recognizes the disk as an unallocated disk.

Any help would be really appreciated, thanks!

The Intel Matrix Storage fakeraid SSD caching setup is unsupported in Linux.  You will have to destroy the raid and use the disks independently to dual boot.

Maybe you can choose "something different" in the installation dialog. But for this, first make a partition in windows and select it in Ubuntu. So i got Ubuntu 13.04 on my windows8 pre-installed laptop.