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

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#...

Related

GNU make: How to wait "cp" command to finish

my makefile:
make:
# Mount Loader.bin
sudo mount -t vfat -o loop Boot.img mnt
sudo cp Loader.bin mnt
sudo umount mnt
However, the results present an error with "target busy"
$ make make
sudo mount -t vfat -o loop Boot.img mnt
[sudo] password for shore:
sudo cp Loader.bin mnt
sudo umount mnt
umount: /home/shore/MineOS/mnt: target is busy.
makefile:7: recipe for target 'make' failed
make: *** [make] Error 32
It randomly occurs and I guess the main idea is that unmouont are executed while copy is in process.
Thus I would like to ask if there is a way that it will wait the previous command finish then execute the next command
By the way, my platform is Ubuntu 18.4
Thanks very much!!
make only ever runs one line in a recipe at a time and it always waits for the previous line to complete before running the next one. It has to wait, because if the current line fails the recipe must fail without starting the next line.
What is probably happening is that the cp is exiting, but the data has not been fully flushed to the mounted filesystem: the kernel is still writing out the buffered data. So even though the copy command has finished, the partition is still busy.
Perhaps you can force it to sync using something like (here I'm assuming you're using GNU/Linux or something compatible):
make:
# Mount Loader.bin
sudo mount -t vfat -o loop Boot.img mnt
sudo cp Loader.bin mnt
sudo sync -f mnt/Loader.bin
sudo umount mnt
I don't know if that will be sufficient to force it or not.
BTW, it's usually a good idea to use sudo -n when you're using sudo in a makefile or any other non-interactive environment.

What directory should my Apache folders be in to transfer to vagrant box?

I am trying to use a post shell script to copy the directory of an apache website into a vagrant box using packer but Im not sure what directory I should put the directory that contains all the files for apache. I keep running into this error:
ubuntu-vanilla-16011-server: cp -r bootstrap-website/ ~/var/www/html/
ubuntu-vanilla-16011-server: cp: cannot stat 'bootstrap-website/': No such file or directory
==> ubuntu-vanilla-16011-server: Unregistering and deleting virtual machine...
==> ubuntu-vanilla-16011-server: Deleting output directory...
Build 'ubuntu-vanilla-16011-server' errored: Script exited with non-zero exit status: 1
==> Some builds didn't complete successfully and had errors:
--> ubuntu-vanilla-16011-server: Script exited with non-zero exit status: 1
==> Builds finished but no artifacts were created.
Here is my post install script:
#!/bin/bash
set -e
set -v
# http://superuser.com/questions/196848/how-do-i-create-an-administrator-user-on-ubuntu
# http://unix.stackexchange.com/questions/1416/redirecting-stdout-to-a-file-you-dont-have-write-permission-on
# This line assumes the user you created in the preseed directory is vagrant
echo "vagrant ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/init-users
sudo cat /etc/sudoers.d/init-users
# Installing vagrant keys
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub'
sudo mkdir -p /home/vagrant/.ssh
sudo chown -R vagrant:vagrant /home/vagrant/.ssh
cat ./vagrant.pub >> /home/vagrant/.ssh/authorized_keys
apt-get update
apt-get install -y apache2
apt-get install -y php
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /vagrant /var/www
fi
cp -r bootstrap-website/ ~/var/www/html/
Any help would be appreciated.
Thanks
Any file on the host machine doesn't automatically get transfered to the guest. You need to use file provisioner to upload bootstrap-website.

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)?

Can't get shell script to run in Xcode

I'm fairly new to running scripts in Xcode and haven't been able to figure out whats wrong with the script I'm running. The first script I ran was this:
/bin/sh -x
PBXCP=${DEVELOPER_DIR}/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp
${PBXCP} -exclude .svn "${PROJECT_DIR}/../../base"
"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
Which caused me to run into this error:
/Users/newperson/Library/Developer/Xcode/DerivedData/appname-etesgjzdmfzimlgvakidckjecgij
/Build
/Intermediates/appname.build/Debug-iphonesimulator/app.build/Script-
435F41A90F532CA300887552.sh: line 3: /Applications/Xcode.app/Contents/Developer/Library
/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp: No such file or directory
This error was fairly to the point, The file the script is looking for doesn't exist. The newer versions of Xcode have gotten rid of pbxcp. So I started looking for a good alternative script to run that wouldn't use pbxcp, when I found this:
/bin/sh -x
/usr/bin/tar -c -C "${PROJECT_DIR}/myframeworks" --exclude .DS_Store --exclude CVS --exclude
.svn --exclude .git -H `cd "${PROJECT_DIR}/myframeworks" && find DevToolsCore.framework` |
/usr/bin/tar -x -C ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}
This script also caused me to run into a problem, which was this:
tar: could not chdir to '/Users/newperson/Library/Developer/Xcode/DerivedData/appname-
etesgjzdmfzimlgvakidckjecgij/Build/Products/Debug-iphonesimulator/appname.app/Frameworks'
tar: Write error
Command /bin/sh failed with exit code 1
I couldn't find a clear answer to what this error meant, one forum suggest that I use the sudo command in my script to give the script permission to change directory, so I ran this:
/bin/sh -x
/usr/bin/tar -c -C "${PROJECT_DIR}/myframeworks" --exclude .DS_Store --exclude CVS --exclude
.svn --exclude .git -H `cd "${PROJECT_DIR}/myframeworks" && find DevToolsCore.framework`
| sudo /usr/bin/tar -x -C ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}
This script caused me to run into this error though:
tar: Write error
Command /bin/sh failed with exit code 1
++ find DevToolsCore.framework
sudo: no tty present and no askpass program specified
tar: Write error
This is as far as I got so far, I am fairly lost with my limited knowledge of shell script so any help correcting my script or finding a suitable replacement for the Xcode framework that contains pbxcp would be appreciated.
Change the permissions of the directory where your script wants to write files. Do it in an interactive session of Terminal:
$ sudo chmod a+w the_directory
Then you should be able to run your script (without sudoing the tar).

make install generates file exists error

I am trying to compile and create an executable of this tool, did a ./configure and then make and then make install, however during the process I got this error:
test -z "/usr/local/bin" || ./install-sh -c -d "/usr/local/bin"
mkdir: /usr/local/bin: File exists
make[1]: *** [install-binPROGRAMS] Error 1
make: *** [install-am] Error 2
Any idea on how to get around this?
You appear to have a file named /usr/local/bin. Remove it like so:
rm /usr/local/bin

Resources