cannot install VBoxGuestAdditions on debian 9 with vagrant - vagrant

I cannot install VBoxGuestAdditions.
I tried both with the vagrant plugin and manually. In both cases I encountered this error :
vboxadd.sh: Building Guest Additions kernel modules.
Failed to set up service vboxadd, please check the log file
/var/log/VBoxGuestAdditions.log for details.
cat /var/log/VBoxGuestAdditions.log:
Created symlink /etc/systemd/system/multi-user.target.wants/vboxadd.service → /lib/systemd/system/vboxadd.service.
vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed..
Created symlink /etc/systemd/system/multi-user.target.wants/vboxadd-service.service → /lib/systemd/system/vboxadd-service.service.
Created symlink /etc/systemd/system/multi-user.target.wants/vboxadd-x11.service → /lib/systemd/system/vboxadd-x11.service.
cat /var/log/vboxadd-install.log
grep: /lib/modules/4.9.0-4-amd64/build/include/linux/version.h: No such file or directory
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/4.9.0-4-amd64/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j2 modules
make[1]: warning: -jN forced in submake: disabling jobserver mode.
make -C /usr/src/linux-headers-4.9.0-4-amd64 KBUILD_SRC=/usr/src/linux-headers-4.9.0-4-common \
-f /usr/src/linux-headers-4.9.0-4-common/Makefile modules
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
The following package is installed:
apt-get install build-essential dkms
How to fix that?

Related

permission denied with yapf in ssh script because of make

I have this strange error : i have a makefile with a format target that runs yapf -ir -vv --style pep8 .
When I ssh log as user into my debian 11 server and run make format it works. When i run sudo make format i get the error
yapf -ir -vv --style pep8 .
make: yapf: No such file or directory
make: *** [makefile:5: format] Error 127
When i run a ssh script from my local machine that logs to the server and runs with the line make format, i get the following error :
yapf -ir -vv --style pep8 .
make: yapf: Permission denied
make: *** [makefile:5: format] Error 127
I also get similar output for linting:
/bin/sh: 1: pylint: Permission denied
make: *** [makefile:7: lint] Error 127
I've tried to change the owner with chown to my user, i've tried to make read and write permissions to user, group and other and it's the same...so i suspect it's a sudo thing but i'm not sure.
The user belongs to sudo group but i'm confused why the script doesnt work and it works manually...
The script is like this :
ssh -p 4444 -i /mykey user#ip << 'ENDSSH'
echo 'deploying zabbix'
cd /zabbix && docker-compose up -d
echo 'zabbix deployed'
echo 'copying zabbix module to container'
sudo mkdir -p /var/lib/zabbix/modules/dockermodule
docker cp /zabbix/zabbix_module_docker.so zabbixserver:/var/lib/zabbix/modules/dockermodule
echo 'copied zabbix module to container done'
echo 'extracting tar file'
sudo rm -rf /app/* && sudo tar -xf /tmp/project.tar -C /
sudo chown -R user /app
sudo chmod -R u=rwx /app
echo 'tar file extracted'
echo 'going into app folder'
cd /app
echo 'getting rid of hidden macos files'
sudo find . -type f -name '._*' -delete
echo 'hidden macos files deleted'
echo 'running install'
make install
echo 'install done'
echo 'running format'
make format
echo 'format done'
echo 'running lint'
make lint
echo 'lint done'
echo 'running test'
make test
echo 'test done'
#echo 'running vulnerability check'
#trivy fs --security-checks vuln --severity HIGH,CRITICAL / > security_check.txt
#echo 'vuln check done'
echo 'running docker build & run'
make docker
echo 'docker built and running'
ENDSSH
the make commands are :
make format:
yapf -ir -vv --style pep8 .
make lint:
cd ..; pylint app --verbose --disable=R,C -sy
The commands are not failing when i replave make format or make lint with the commands they run in my script...

Download and move file only if it does not exist on destination directory, otherwise do nothing

I am trying to install an executable command (terraform) by downloading the zip file, then extract it to the ~/bin directory using a Makefile.
I would like to do this only if the terraform file is not already there.
According to the GNU Make docs I think I should use an "order-only prerequisite" with a pipe | (https://www.gnu.org/software/make/manual/make.html#Prerequisite-Types) although I don't completely understand that documentation.
I've written the following target rule with the purpose of running it as make install-tf, when the file ~/bin/terraform being already there, then doing nothing and returning. However this does not work as expected and I keep seeing the body of that target rule being executed no matter the file is already there.
What's wrong with the following target?
How could I install terraform only if the command is not already there using a Makefile?
This is the target:
TERRAFORM_VERSION=0.11.11
install-tf: | ~/bin/terraform
echo "Installing terraform version ${TERRAFORM_VERSION}"
mkdir -p ~/tmp/
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -P ~/tmp/
mkdir -p ~/bin/
unzip ~/tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d ~/bin/
echo "Done installing terraform version ${TERRAFORM_VERSION}"
PATH=~/bin/:$$PATH terraform --version
What's wrong with the following target?
The target is install-tf. make install-tf will always run the recipe to make this
target if no such file as install-tf exists. The recipe never creates
that file. Therefore the recipe will always be run.
You require a recipe to make the file $(HOME)/bin/terraform if and only if it
does not exist. To a first approximation, this will do it:
Makefile (1)
TERRAFORM_VERSION=0.11.11
$(HOME)/bin/terraform:
echo "Installing terraform version ${TERRAFORM_VERSION}"
mkdir -p $(HOME)/tmp/
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -P $(HOME)/tmp/
mkdir -p $(HOME)/bin/
unzip ~/tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d $(HOME)/bin/
echo "Done installing terraform version ${TERRAFORM_VERSION}"
PATH=$(HOME)/bin/:$$PATH terraform --version
which runs first time like:
$ make
echo "Installing terraform version 0.11.11"
Installing terraform version 0.11.11
mkdir -p /home/imk/tmp/
wget https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip -P /home/imk/tmp/
--2019-01-29 11:09:11-- https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.17.183, 2a04:4e42:4::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.17.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20971661 (20M) [application/zip]
Saving to: ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip’
terraform_0.11.11_l 100%[===================>] 20.00M 8.86MB/s in 2.3s
2019-01-29 11:09:14 (8.86 MB/s) - ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip’ saved [20971661/20971661]
mkdir -p /home/imk/bin/
unzip ~/tmp/terraform_0.11.11_linux_amd64.zip -d /home/imk/bin/
Archive: /home/imk/tmp/terraform_0.11.11_linux_amd64.zip
inflating: /home/imk/bin/terraform
echo "Done installing terraform version 0.11.11"
Done installing terraform version 0.11.11
PATH=/home/imk/bin/:$PATH terraform --version
Terraform v0.11.11
and second time like:
$ make
make: '/home/imk/bin/terraform' is up to date.
And with a little improvement:
Makefile (2)
TERRAFORM_VERSION := 0.11.11
.PHONY: all clean
all: $(HOME)/bin/terraform
$(HOME)/bin/terraform: | $(HOME)/tmp/ $(HOME)/bin/
echo "Installing terraform version ${TERRAFORM_VERSION}"
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -P $(HOME)/tmp/
unzip ~/tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d $(HOME)/bin/
echo "Done installing terraform version ${TERRAFORM_VERSION}"
PATH=$(HOME)/bin/:$$PATH terraform --version
$(HOME)/tmp/ $(HOME)/bin/:
mkdir -p $#
clean:
$(RM) $(HOME)/bin/terraform
which runs like:
$ make clean
rm -f /home/imk/bin/terraform
$ make
echo "Installing terraform version 0.11.11"
Installing terraform version 0.11.11
wget https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip -P /home/imk/tmp/
--2019-01-29 11:38:32-- https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.17.183, 2a04:4e42:4::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.17.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20971661 (20M) [application/zip]
Saving to: ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip.1’
terraform_0.11.11_l 100%[===================>] 20.00M 8.88MB/s in 2.3s
2019-01-29 11:38:34 (8.88 MB/s) - ‘/home/imk/tmp/terraform_0.11.11_linux_amd64.zip.1’ saved [20971661/20971661]
unzip ~/tmp/terraform_0.11.11_linux_amd64.zip -d /home/imk/bin/
Archive: /home/imk/tmp/terraform_0.11.11_linux_amd64.zip
inflating: /home/imk/bin/terraform
echo "Done installing terraform version 0.11.11"
Done installing terraform version 0.11.11
PATH=/home/imk/bin/:$PATH terraform --version
Terraform v0.11.11
$ make
make: Nothing to be done for 'all'.
Note the use of order-only prerequisites in:
$(HOME)/bin/terraform: | $(HOME)/tmp/ $(HOME)/bin/
That says: Before considering whether the target $(HOME)/bin/terraform is out of date, make $(HOME)/tmp/ and $(HOME)/bin.
Then consider whether $(HOME)/bin/terraform is out of date but do not count $(HOME)/tmp/ or $(HOME)/bin as prerequisites.
See also 4.6 Phony Targets

Problems with compilation ICU with MinGW-w64 on Windows

I tried to compile ICU 59.1 with MinGW-w64 according to Qt manual (MinGW-64-bit). Unfortunately, I got the following error:
$ make && make install
rebuilding config/icucross.mk
rebuilding config/icucross.inc
cd ./config; \
make -f pkgdataMakefile
make[1]: вход в каталог «/c/Qt-deps/icu-59_1/source/config»
*** ERROR - configure could not detect your platform
*** see the readme.html
*** or, try copying icu/source/config/mh-linux to mh-unknown
*** and editing it.
exit 1
rm -rf pkgdata.inc
make[1]: выход из каталога «/c/Qt-deps/icu-59_1/source/config»
rm -rf config/icu-config
/usr/bin/install -c ./config/icu-config-top config/icu-config
chmod u+w config/icu-config
LC_ALL=C /usr/bin/sed -f ./config/make2sh.sed < ./config/Makefile.inc | grep -v '#M#' | uniq >> config/icu-config
LC_ALL=C /usr/bin/sed -f ./config/make2sh.sed < ./config/mh-unknown | grep -v '#M#' | uniq >> config/icu-config
cat ./config/icu-config-bottom >> config/icu-config
chmod u-w config/icu-config
config/icu-uc.pc updated.
config/icu-i18n.pc updated.
config/icu-io.pc updated.
Note: rebuild with "make VERBOSE=1 " to show all compiler parameters.
/bin/sh ./mkinstalldirs lib
mkdir lib
/bin/sh ./mkinstalldirs bin
mkdir bin
make[0]: Making `all' in `stubdata'
make[1]: вход в каталог «/c/Qt-deps/icu-59_1/source/stubdata»
*** ERROR - configure could not detect your platform
*** see the readme.html
*** or, try copying icu/source/config/mh-linux to mh-unknown
*** and editing it.
exit 1
make[1]: выход из каталога «/c/Qt-deps/icu-59_1/source/stubdata»
make: *** [Makefile:147: all-recursive] Ошибка 2
I have tried to compile it twice on two different computers: the 1st one - Windows 10 Pro, the last one - Windows 7 Ultimate. Results are the same. Used tools: MSYS2 x64 (20161025). So, what am I doing wrong?
The error "configure could not detect your platform" can probably be fixed by passing the arguments --build=$MINGW_CHOST --host=$MINGW_CHOST to the configure script. If you are in the right type of MSYS2 shell, $MINGW_CHOST should be i686-w64-mingw32 or x86_64-w64-mingw32
For more useful tips for building ICU, look at the build script that the MSYS2 developers have crafted:
https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-icu
I have fixed the same issue (except that used ICU 55.1) replacing ../source/config/mh-unknown with the contents of ../source/config/mh-mingw64
I have build icu with same problem.
I have run this script for correct the problem:
del M:\work\code\qt\icu4c-68_2\icu4c\source\config\mh-unknow
copy M:\work\code\qt\icu4c-68_2\icu4c\source\config\mh-msys-msvc M:\work\code\qt\icu4c-68_2\icu4c\source\config\mh-unknow

During cppunit make install error for task install-m4DATA appeared

I've been building freedesktop cppunit with mingw
https://www.freedesktop.org/wiki/Software/cppunit/
I've made some fixes to source files and makefiles and been able to
successfully execute commmands:
./autogen.sh
./configure
make
without any errors.
There was a need to set
m4_DATA = m4
instead of value "cppunit.m4" in Makefile.am(there was no such dir in build and it looks like such dir is "m4" dir).
After successful make execution doing
make --debug install
failed with error:
File install-m4DATA not found
from Makefile.am:
m4dir = $(datadir)/aclocal //what is datadir btw?
automake generated Makefile task:
install-m4DATA: $(m4_DATA)
#$(NORMAL_INSTALL) // fails at this line
test -z "$(m4dir)" || $(MKDIR_P) "$(DESTDIR)$(m4dir)"
#list='$(m4_DATA)'; test -n "$(m4dir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(m4dir)" || exit $$?; \
done
before that task NORMAL_INSTALL is set to:
NORMAL_INSTALL = :
How to fix "make install" execution.
Will it work if i have only mingw envieronment on my PC?
Version is 1.13.2 fresh from git repo.
I also post lines from "make --debug install" output
File 'install-m4DATA' does not exist.
Must remake target 'install-m4DATA'.
test -z "/usr/local/share/aclocal" || /usr/bin/mkdir -p "/usr/local/share/aclocal"
/usr/bin/install -c -m 644 ./m4 '/usr/local/share/aclocal'
Makefile:432: recipe for target 'install-m4DATA' failed
make[2]: Leaving directory 'c:/Users/user/projects/cppunit'
Makefile:799: recipe for target 'install-am' failed
make[1]: Leaving directory 'c:/Users/user/projects/cppunit'
Makefile:479: recipe for target 'install-recursive' failed
It also prints that that script omits directory at line
/usr/bin/install -c -m 644 ./m4 '/usr/local/share/aclocal'
Possibly here must go files from directory but not directory itself.
How to fix it to do that(i'm not familiar with Makefiles and bash)?

Permission denied when trying to install gcc, even if logged as root

I'm trying to install gcc 4.7.0 on ubuntu 10.04 following that tutorial http://www.tellurian.com.au/whitepapers/multiplegcc.php. After some time to install the dependencies, I've been able to run make without errors, but the final step, make install doesn't want to succeed, it end up with permission denied.
Here's what I did :
../gcc-4.7.0/configure --prefix=/usr/local/gcc/4.7.7 --enable-languages=c,c++
make
su -l
cd /groups/gobj
make install
the result for the last command :
make[1]: Entering directory `/groups/gobj'
/bin/bash ../gcc-4.7.0/mkinstalldirs /usr/local/gcc/4.7.7 /usr/local/gcc/4.7.7
make[2]: Entering directory `/groups/gobj/fixincludes'
rm -rf /usr/local/gcc/4.7.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/install-tools
/bin/bash ../../gcc-4.7.0/fixincludes/../mkinstalldirs /usr/local/gcc/4.7.7/libexec
...
rm -f /usr/local/gcc/4.7.7/share/info/gccinstall.info
if [ -f doc/gccinstall.info ]; then \
for f in doc/gccinstall.info*; do \
realfile=`echo $f | sed -e 's|.*/\([^/]*\)$|\1|'`; \
/usr/bin/install -c -m 644 $f /usr/local/gcc/4.7.7/share/info/$realfile; \
chmod a-x /usr/local/gcc/4.7.7/share/info/$realfile; \
done; \
else true; fi
if /bin/bash -c 'install-info --version' >/dev/null 2>&1; then \
if [ -f /usr/local/gcc/4.7.7/share/info/gccinstall.info ]; then \
install-info --dir-file=/usr/local/gcc/4.7.7/share/info/dir /usr/local/gcc/4.7.7/share/info/gccinstall.info; \
else true; fi; \
else true; fi;
build/genhooks -d \
../../gcc-4.7.0/gcc/doc/tm.texi.in > tmp-tm.texi
/bin/bash: tmp-tm.texi: Permission denied
make[2]: *** [s-tm-texi] Error 1
make[2]: Leaving directory `/groups/gobj/gcc'
make[1]: *** [install-gcc] Error 2
make[1]: Leaving directory `/groups/gobj'
make: *** [install] Error 2
I've already tried su root, su -, su without succes. Some files are effectively copied to /usr/local/gcc/4.7.0 but the process stopped and I don't understand why as I'm logged as root. I've checked, the file /groups/gcc-4.7.0/gcc/doc/tm.texi.in exists. Any help ?
As puzzling as it sounds that the superuser "root" cannot create files while a normal user can, a likely scenario is that your build directory (that is, the directory in which you ran "make install") is being served from an NFS server, and it is probably mounted such that the server doesn't trust your build machine's request to write files as root.
As a simple test see if you can write an empty file to the build directory by running touch test as root. If that fails then you've found the source of the problem. Another way to confirm it is to check the output of "mount" at at least confirm that your build directory is being served via NFS.
server:/groups 20G 948M 19G 5% /groups
If you see a line like this in the mount output then you know for certain that your build directory is being NFS mounted. To tell whether or not root is being trusted, however, you'll ultimately have to check the settings on the NFS server.
Fixing the problem
The fastest way to fix this issue is to find a local filesystem on your build machine and move the contents of your build directory there, then re-run "make install".
Did you tried sudo?
sudo make install
Edit:
As root, you can add yourself to sudoers.
If you can't get root via sudo, try either
su - root
or
ssh root#...

Resources