./path of file to execute not executing

I am trying to execute matlab from desktop path of file is

      /usr/local/MATLAB/R2017b/bin/matlab

executing ./usr/local/MATLAB/R2017b/bin/matlab

also tried .//usr/local/MATLAB/R2017b/bin/matlab

and ./ /usr/local/MATLAB/R2017b/bin/matlab
how it works?

Solution:

Just run /usr/local/MATLAB/R2017b/bin/matlab to access the binary via the full path otherwise you will run try to run it via the relative path: <CURRENT DIR>/usr/local/MATLAB/R2017b/bin/matlab if you put a . before.

You can also change the add /usr/local/MATLAB/R2017b/bin/ to your path variable in order to be able to execute the command matlab without having to specify its whole path each time.

Also change your ~/.bashrc file and add PATH=$PATH:/usr/local/MATLAB/R2017b/bin to be able to keep those change after a reboot and just run matlab

Advertisements

startx /bin/bash in fullscreen without desktop

Ok so I know it’s a weird case but hang in here with me.

So the thing is I’ve got an very old laptop running ubuntu 14.04 server without any desktop aka shell only. BUT the laptop also has a touch screen so we want to be able to use the “mouse”/touchscreen/touchpad to select text inside the terminal and/or click/copy/paste/cut/etc. It’s part of art project with some students and also one of the tasks is to run as less as possible. So running a desktop in the background is not really an option. My question is:

Is there a way to start the Ubuntu terminal as UI application in fullscreen without the actual desktop in the background but giving the functionality of an mouse cursor.

(If someone knows a even better solution for adding a mouse without starting the desktop its appreciated)

Solution:

Try this: create a ~/.xinitrc with content : exec gnome-terminal, then run startx

Or another solution is to stay in and install gpm for mouse control

Does fork() work differently on Ubuntu in Comparison to other Linux Distribution?

Ok, so here is the initial Code I was working with on an Ubuntu 17.10.

#include <unistd.h>
#include <stdio.h>
void main()
{
   printf("Demonstrating fork():\n");
   fork();
   printf("After fork():\nProcess Id is %d\n", getpid());
}

So at this stage I found out the output to be : Initial Output

So yeah I executed twice to confirm it. But later I noticed that in Online GCC Compilers and on RedHat in my College Campus, The output is pretty different:

other gcc output

Now as per my knowledge, the fork() creates another instance of the process it is called from. But in Ubuntu it seems it copies from the point where it is introduced in the code, and rather the whole Process. To detect it, I slightly chaged the code to :

#include <unistd.h>
#include <stdio.h>
void main()
{
    fork();
    printf("Demonstrating fork():\n");
    printf("After fork():\nProcess Id is %d\n", getpid());
}

And to my surprise I was right on my observation with the output :

After Change Output

So can anyone confirm this, and explain me why is this happening, or just a bug on my system ?

Solution:

But later I noticed that in Online GCC Compilers and on RedHat in my College Campus, The output is pretty different.

It has to do with the user-space buffer printf() uses.

If the program is executed at the terminal and the output is not redirected to a file, then the buffer is flushed by printf()ing \n.

The online version does not flush the buffer by printf()ing a \n because it is using another flushing policy (e.g.: the output is probably being redirected to a file).

Send characters to console application

I have simple console application that runs in terminal window reads and prints character:

int main(int argc, char **argv, char **envp)
{
    while (true)
    {
        char c =getchar();
        printf("%c \n",c);

    }

}

Now I would like to make test application that could emulate character press in first application terminal.

Which way I should go? What API functions I should use for this purpose?

Solution:

No need for special APIs or whatever. Since your sample application is only reading from standard input, you can just send stuff to there.

Before running the program in a terminal, check its connected terminal using tty command. Then send data to that tty that tty reports.

Alternatively, grab the PID of your running application and send data to /proc/$PID/fd/0 so you don’t need to check for tty.

Install devtools package in ubuntu VM

I try to install devtools package in an Ubuntu 16.04 VM
in which I am wrong.

Other packages I tried the installed successsfully

However I can’t install it and the process in the console is this:

> install.packages("devtools")
Installing package into ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘curl’, ‘openssl’, ‘httr’, ‘git2r’

--2018-01-26 22:14:08--  https://cran.rstudio.com/src/contrib/curl_3.1.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 366086 (358K) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/downloaded_packages/curl_3.1.tar.gz’

     0K .......... .......... .......... .......... .......... 13% 1017K 0s
    50K .......... .......... .......... .......... .......... 27% 1,62M 0s
   100K .......... .......... .......... .......... .......... 41% 1,32M 0s
   150K .......... .......... .......... .......... .......... 55% 4,09M 0s
   200K .......... .......... .......... .......... .......... 69% 4,59M 0s
   250K .......... .......... .......... .......... .......... 83% 12,0M 0s
   300K .......... .......... .......... .......... .......... 97% 2,84M 0s
   350K .......                                               100% 19,6M=0,2s

2018-01-26 22:14:09 (2,18 MB/s) - ‘/tmp/RtmpIF4wAz/downloaded_packages/curl_3.1.tar.gz’ saved [366086/366086]

--2018-01-26 22:14:09--  https://cran.rstudio.com/src/contrib/openssl_0.9.9.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1112927 (1,1M) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/downloaded_packages/openssl_0.9.9.tar.gz’

     0K .......... .......... .......... .......... ..........  4% 1,02M 1s
    50K .......... .......... .......... .......... ..........  9%  194K 3s
   100K .......... .......... .......... .......... .......... 13%  215K 3s
   150K .......... .......... .......... .......... .......... 18%  227K 3s
   200K .......... .......... .......... .......... .......... 23% 10,2M 3s
   250K .......... .......... .......... .......... .......... 27%  253K 3s
   300K .......... .......... .......... .......... .......... 32%  271K 2s
   350K .......... .......... .......... .......... .......... 36%  289K 2s
   400K .......... .......... .......... .......... .......... 41%  317K 2s
   450K .......... .......... .......... .......... .......... 46% 3,97M 2s
   500K .......... .......... .......... .......... .......... 50%  338K 2s
   550K .......... .......... .......... .......... .......... 55%  346K 1s
   600K .......... .......... .......... .......... .......... 59%  372K 1s
   650K .......... .......... .......... .......... .......... 64% 5,58M 1s
   700K .......... .......... .......... .......... .......... 69%  317K 1s
   750K .......... .......... .......... .......... .......... 73%  315K 1s
   800K .......... .......... .......... .......... .......... 78%  344K 1s
   850K .......... .......... .......... .......... .......... 82%  344K 1s
   900K .......... .......... .......... .......... .......... 87% 6,08M 0s
   950K .......... .......... .......... .......... .......... 92%  404K 0s
  1000K .......... .......... .......... .......... .......... 96%  567K 0s
  1050K .......... .......... .......... ......               100% 7,47M=2,8s

2018-01-26 22:14:13 (394 KB/s) - ‘/tmp/RtmpIF4wAz/downloaded_packages/openssl_0.9.9.tar.gz’ saved [1112927/1112927]

--2018-01-26 22:14:13--  https://cran.rstudio.com/src/contrib/httr_1.3.1.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 147593 (144K) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/downloaded_packages/httr_1.3.1.tar.gz’

     0K .......... .......... .......... .......... .......... 34%  934K 0s
    50K .......... .......... .......... .......... .......... 69%  100K 0s
   100K .......... .......... .......... .......... ....      100%  342K=0,7s

2018-01-26 22:14:15 (212 KB/s) - ‘/tmp/RtmpIF4wAz/downloaded_packages/httr_1.3.1.tar.gz’ saved [147593/147593]

--2018-01-26 22:14:15--  https://cran.rstudio.com/src/contrib/git2r_0.21.0.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1155512 (1,1M) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/downloaded_packages/git2r_0.21.0.tar.gz’

     0K .......... .......... .......... .......... ..........  4% 1,06M 1s
    50K .......... .......... .......... .......... ..........  8% 1,52M 1s
   100K .......... .......... .......... .......... .......... 13% 1,28M 1s
   150K .......... .......... .......... .......... .......... 17% 1,54M 1s
   200K .......... .......... .......... .......... .......... 22% 6,96M 1s
   250K .......... .......... .......... .......... .......... 26% 1,10M 1s
   300K .......... .......... .......... .......... .......... 31% 1,21M 1s
   350K .......... .......... .......... .......... .......... 35%  940K 1s
   400K .......... .......... .......... .......... .......... 39% 1,72M 0s
   450K .......... .......... .......... .......... .......... 44% 5,84M 0s
   500K .......... .......... .......... .......... .......... 48% 1,38M 0s
   550K .......... .......... .......... .......... .......... 53% 2,17M 0s
   600K .......... .......... .......... .......... .......... 57% 2,20M 0s
   650K .......... .......... .......... .......... .......... 62% 5,09M 0s
   700K .......... .......... .......... .......... .......... 66% 2,36M 0s
   750K .......... .......... .......... .......... .......... 70% 3,40M 0s
   800K .......... .......... .......... .......... .......... 75% 1,73M 0s
   850K .......... .......... .......... .......... .......... 79% 2,03M 0s
   900K .......... .......... .......... .......... .......... 84% 42,4M 0s
   950K .......... .......... .......... .......... .......... 88% 2,49M 0s
  1000K .......... .......... .......... .......... .......... 93% 1,68M 0s
  1050K .......... .......... .......... .......... .......... 97% 3,40M 0s
  1100K .......... .......... ........                        100% 83,9M=0,6s

2018-01-26 22:14:16 (1,93 MB/s) - ‘/tmp/RtmpIF4wAz/downloaded_packages/git2r_0.21.0.tar.gz’ saved [1155512/1155512]

--2018-01-26 22:14:16--  https://cran.rstudio.com/src/contrib/devtools_1.13.4.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 486348 (475K) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/downloaded_packages/devtools_1.13.4.tar.gz’

     0K .......... .......... .......... .......... .......... 10% 1,10M 0s
    50K .......... .......... .......... .......... .......... 21% 1,40M 0s
   100K .......... .......... .......... .......... .......... 31% 1,54M 0s
   150K .......... .......... .......... .......... .......... 42% 1,72M 0s
   200K .......... .......... .......... .......... .......... 52% 2,99M 0s
   250K .......... .......... .......... .......... .......... 63% 1,54M 0s
   300K .......... .......... .......... .......... .......... 73%  867K 0s
   350K .......... .......... .......... .......... .......... 84% 2,16M 0s
   400K .......... .......... .......... .......... .......... 94% 3,66M 0s
   450K .......... .......... ....                            100% 8,73M=0,3s

2018-01-26 22:14:17 (1,63 MB/s) - ‘/tmp/RtmpIF4wAz/downloaded_packages/devtools_1.13.4.tar.gz’ saved [486348/486348]

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: openssl@1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status
* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of void*... 8
checking for library containing inflate... -lz
checking for library containing EVP_EncryptInit... no
checking for openssl... no
configure: error: in `/tmp/RtmpQ9e11v/R.INSTALL82977388520/git2r':
configure: error: 
  ---------------------------------------------
   The OpenSSL library that is required to
   build git2r was not found.

   Please install:
     libssl-dev    (package on e.g. Debian and Ubuntu)
     openssl-devel (package on e.g. Fedora, CentOS and RHEL)
     openssl       (Homebrew package on OS X)
   and try again.

   If the OpenSSL library is installed on
   your system but the git2r configuration
   is unable to find it, you can specify
   the include and lib path to OpenSSL with:
   R CMD INSTALL --configure-args='--with-libssl-include=INCLUDE_PATH --with-libssl-lib=LIB_PATH' git2r
  ---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/git2r’
Warning in install.packages :
  installation of package ‘git2r’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘git2r’ are not available for package ‘devtools’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpIF4wAz/downloaded_packages’

Any idea how could I install it? The problem is the same if I use instead of Rstudio I use the terminal for R

Also installing car package from github, as I can’t find it in the list of Tools->Install Packages has problem:

> library(devtools)
> install_github("cran/car")
Downloading GitHub repo cran/car@master
from URL https://api.github.com/repos/cran/car/zipball/master
Installing car
--2018-01-26 22:39:07--  https://cran.rstudio.com/src/contrib/pbkrtest_0.4-7.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 156406 (153K) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/pbkrtest_0.4-7.tar.gz’

     0K .......... .......... .......... .......... .......... 32% 1,16M 0s
    50K .......... .......... .......... .......... .......... 65% 1,45M 0s
   100K .......... .......... .......... .......... .......... 98% 3,79M 0s
   150K ..                                                    100% 8,52M=0,09s

2018-01-26 22:39:07 (1,68 MB/s) - ‘/tmp/RtmpIF4wAz/pbkrtest_0.4-7.tar.gz’ saved [156406/156406]

Installing pbkrtest
--2018-01-26 22:39:11--  https://cran.rstudio.com/src/contrib/lme4_1.1-15.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3610706 (3,4M) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/lme4_1.1-15.tar.gz’

     0K .......... .......... .......... .......... ..........  1% 1,05M 3s
    50K .......... .......... .......... .......... ..........  2% 1,52M 3s
   100K .......... .......... .......... .......... ..........  4% 3,40M 2s
   150K .......... .......... .......... .......... ..........  5% 1,36M 2s
   200K .......... .......... .......... .......... ..........  7% 3,97M 2s
   250K .......... .......... .......... .......... ..........  8% 15,4M 2s
   300K .......... .......... .......... .......... ..........  9% 2,23M 2s
   350K .......... .......... .......... .......... .......... 11% 65,5M 1s
   400K .......... .......... .......... .......... .......... 12% 3,85M 1s
   450K .......... .......... .......... .......... .......... 14% 60,4M 1s
   500K .......... .......... .......... .......... .......... 15% 79,4M 1s
   550K .......... .......... .......... .......... .......... 17% 6,83M 1s
   600K .......... .......... .......... .......... .......... 18% 2,60M 1s
   650K .......... .......... .......... .......... .......... 19% 4,68M 1s
   700K .......... .......... .......... .......... .......... 21% 83,6M 1s
   750K .......... .......... .......... .......... .......... 22% 91,2M 1s
   800K .......... .......... .......... .......... .......... 24% 96,8M 1s
   850K .......... .......... .......... .......... .......... 25% 4,27M 1s
   900K .......... .......... .......... .......... .......... 26% 91,6M 1s
   950K .......... .......... .......... .......... .......... 28% 1,39M 1s
  1000K .......... .......... .......... .......... .......... 29% 3,98M 1s
  1050K .......... .......... .......... .......... .......... 31% 27,1M 1s
  1100K .......... .......... .......... .......... .......... 32% 91,8M 1s
  1150K .......... .......... .......... .......... .......... 34% 86,4M 1s
  1200K .......... .......... .......... .......... .......... 35% 3,19M 1s
  1250K .......... .......... .......... .......... .......... 36% 5,66M 1s
  1300K .......... .......... .......... .......... .......... 38% 43,6M 0s
  1350K .......... .......... .......... .......... .......... 39% 86,1M 0s
  1400K .......... .......... .......... .......... .......... 41% 5,28M 0s
  1450K .......... .......... .......... .......... .......... 42% 16,6M 0s
  1500K .......... .......... .......... .......... .......... 43% 9,84M 0s
  1550K .......... .......... .......... .......... .......... 45% 3,84M 0s
  1600K .......... .......... .......... .......... .......... 46% 4,36M 0s
  1650K .......... .......... .......... .......... .......... 48% 19,5M 0s
  1700K .......... .......... .......... .......... .......... 49% 4,09M 0s
  1750K .......... .......... .......... .......... .......... 51% 84,7M 0s
  1800K .......... .......... .......... .......... .......... 52% 1,32M 0s
  1850K .......... .......... .......... .......... .......... 53%  104M 0s
  1900K .......... .......... .......... .......... .......... 55% 14,4M 0s
  1950K .......... .......... .......... .......... .......... 56% 23,1M 0s
  2000K .......... .......... .......... .......... .......... 58% 3,18M 0s
  2050K .......... .......... .......... .......... .......... 59% 2,28M 0s
  2100K .......... .......... .......... .......... .......... 60%  103M 0s
  2150K .......... .......... .......... .......... .......... 62% 2,08M 0s
  2200K .......... .......... .......... .......... .......... 63% 13,6M 0s
  2250K .......... .......... .......... .......... .......... 65% 3,23M 0s
  2300K .......... .......... .......... .......... .......... 66% 4,50M 0s
  2350K .......... .......... .......... .......... .......... 68% 13,9M 0s
  2400K .......... .......... .......... .......... .......... 69% 98,1M 0s
  2450K .......... .......... .......... .......... .......... 70% 42,6M 0s
  2500K .......... .......... .......... .......... .......... 72% 4,12M 0s
  2550K .......... .......... .......... .......... .......... 73% 17,2M 0s
  2600K .......... .......... .......... .......... .......... 75% 73,7M 0s
  2650K .......... .......... .......... .......... .......... 76% 94,0M 0s
  2700K .......... .......... .......... .......... .......... 77%  102M 0s
  2750K .......... .......... .......... .......... .......... 79% 80,8M 0s
  2800K .......... .......... .......... .......... .......... 80%  101M 0s
  2850K .......... .......... .......... .......... .......... 82% 3,39M 0s
  2900K .......... .......... .......... .......... .......... 83% 89,8M 0s
  2950K .......... .......... .......... .......... .......... 85% 88,7M 0s
  3000K .......... .......... .......... .......... .......... 86% 82,8M 0s
  3050K .......... .......... .......... .......... .......... 87% 7,12M 0s
  3100K .......... .......... .......... .......... .......... 89% 80,9M 0s
  3150K .......... .......... .......... .......... .......... 90% 79,9M 0s
  3200K .......... .......... .......... .......... .......... 92% 7,38M 0s
  3250K .......... .......... .......... .......... .......... 93%  100M 0s
  3300K .......... .......... .......... .......... .......... 95% 88,2M 0s
  3350K .......... .......... .......... .......... .......... 96% 9,04M 0s
  3400K .......... .......... .......... .......... .......... 97% 11,9M 0s
  3450K .......... .......... .......... .......... .......... 99% 99,2M 0s
  3500K .......... .......... ......                          100% 97,2M=0,6s

2018-01-26 22:39:12 (6,14 MB/s) - ‘/tmp/RtmpIF4wAz/lme4_1.1-15.tar.gz’ saved [3610706/3610706]

Installing lme4
--2018-01-26 22:39:20--  https://cran.rstudio.com/src/contrib/nloptr_1.0.4.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 353957 (346K) [application/x-gzip]
Saving to: ‘/tmp/RtmpIF4wAz/nloptr_1.0.4.tar.gz’

     0K .......... .......... .......... .......... .......... 14% 1,11M 0s
    50K .......... .......... .......... .......... .......... 28%  106K 1s
   100K .......... .......... .......... .......... .......... 43%  644K 1s
   150K .......... .......... .......... .......... .......... 57%  677K 0s
   200K .......... .......... .......... .......... .......... 72% 5,64M 0s
   250K .......... .......... .......... .......... .......... 86%  628K 0s
   300K .......... .......... .......... .......... .....     100% 2,39M=0,8s

2018-01-26 22:39:22 (448 KB/s) - ‘/tmp/RtmpIF4wAz/nloptr_1.0.4.tar.gz’ saved [353957/353957]

Installing nloptr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpIF4wAz/devtools756410ec724/nloptr' --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests 

ERROR: failed to lock directory ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2’ for modifying
Try removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/00LOCK-nloptr’
Installation failed: Command failed (3)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL '/tmp/RtmpIF4wAz/devtools7561eb5da54/lme4'  \
  --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests 

ERROR: dependency ‘nloptr’ is not available for package ‘lme4’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/lme4’
Installation failed: Command failed (1)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpIF4wAz/devtools75623bf595c/pbkrtest' --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests 

ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/pbkrtest’
Installation failed: Command failed (1)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpIF4wAz/devtools75635e8f138/cran-car-4f39fce' --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests 

ERROR: dependency ‘pbkrtest’ is not available for package ‘car’
* removing ‘/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/car’
Installation failed: Command failed (1)

Solution:

Certainly, the answer is within the output you pasted. You need to isntall in the OS (as opposed as in R) the following dependencies:

libcurl4-openssl-dev
libssl-dev

To install them, run in your terminal:

sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev

And then go to R and try reinstalling “devtools”.

Locally modified /boot/grub/menu.lst on update ubuntu 16.04 with AWS EC2

I’m running ubuntu 16.04 on an Amazon AWS EC2 and have just run sudo apt-get dist-upgrade to update the suggested packages in the console.

During which I have been prompted with A new version of /boot/grub/menu.lst is available, but the version installed currently has been locally modified. in the package configuration of menu.lst

We haven’t made any changes so I am to assume that this is a setting by Amazon AWS EC2.

How should I proceed?

Line by line differences between versions

--- /run/grub/menu.lst root.root 0644 2018-01-25 22:33:02
+++ /tmp/fileeCfBYY root.root 0600 2018-01-25 22:33:02
@@ -3,11 +3,9 @@
   title Ubuntu 16.04.3 LTS, kernel 4.4.0-97-generic 
   root (hd0)
   kernel /boot/vmlinuz-4.4.0-97-generic root=LABEL=cloudimg-rootfs ro console=hvc0
-initrd /boot/initrd.img-4.4.0-97-generic 

   title Ubuntu 16.04.3 LTS, kernel 4.4.0-97-generic (recovery mode)
   root (hd0)
   kernel /boot/vmlinuz-4.4.0-97-generic root=LABEL=cloudimg-rootfs ro single 
-initrd /boot/initrd.img-4.4.0-97-generic 

### END DEBIAN AUTOMAGIC KERNELS LIST 

Screenshot

Solution:

File permissions have changed

old : root.root 0644
new : root.root 0600

as suggested I would select “package maintainer’s version”

How can I replace a full line with a blank one by searching for a certain keyword

I have a file that stores data like a catalog. I want to search a keyword in this file and replace the line which contains it, with a blank line.
The keyword will be saved in $2.

This is what I got so far:

sed '/$2/ c' " "' file.txt

Thanks for helping.

Solution:

Tested with GNU sed:

$ a="blank"   # One can use "$2" instead of "$a" below. It would work the same.
$ sed -i "s/.*$a.*//g" test.txt  # -i option overwrites test.txt with the replacement

Example test.txt

$ cat test.txt
This is a test line
Replace this line with a blank line
This is another line

output:

This is a test line

This is another line