CMake: Fail to install symlink on ssh-mounted filesystem - linux

I am cross-compiling a project on my desktop, and installing it on a device which is mounted via ssh, using sshfs, like so:
sudo sshfs -o allow_other -o follow_symlinks user#192.168.12.100:/ /mnt/remote
The build is successful, but when I try to "sudo make install", I receive the following message:
-- Installing: /mnt/remote/usr/lib/libprop.so.5.1.5
-- Installing: /mnt/remote/usr/lib/libprop.so.5
CMake Error: failed to create symbolic link '/mnt/remote/usr/lib/libprop.so.5': i/o error
CMake Error at cmake_install.cmake:176 (file):file INSTALL cannot duplicate symlink
"/home/ubuntu/libprop/build/lib/libprop.so.5" at
"/mnt/remote/usr/lib/libprop.so.5".
The library and the symlink are copied and created. That is, it seems that the installation actually succeeds, but CMake thinks otherwise.
The filesystem is not ro, as can be seen in mount output:
user#192.168.12.100:/ on /mnt/remote type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
And I can see the entry under /mnt/ (I chown'd and chmod'd it for user access, thinking it might solve the problem):
drwxrwxr-x 1 ubuntu ubuntu 4096 Mar 11 13:43 remote
and I can access it event without root permissions, copying and deleting files without a problem.
This process has been working for me. I have no idea what was changed that it stopped. Could be something in my environment or maybe in the destination platform.
I would be grateful for any assistance.

OK, I have found the problem... I shouldn't be using -o follow_symlinks. I guess this can cause other problems (I used it for a reason), but for the purpose of compiling and installing, it works.

Related

conda.exe: error while loading shared libraries: libz.so.1

Unable to install Anaconda3-2019.10-Linux-x86_64 in my RHEL machine; Getting the error -> conda.exe: error while loading shared libraries: libz.so.1: failed to map segment from shared object: Operation not permitted.
Anaconda or Miniconda version: Anaconda3-2019.10-Linux-x86_64
Operating System:"Red Hat Enterprise Linux Server" VERSION="7.7 (Maipo)"
Steps to Reproduce
wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
bash ./Anaconda3-2019.10-Linux-x86_64.sh
I've followed the resolution steps mentioned in Github #11493, and #11154 by #davidlowryduda, #Pastthesun, but that doesn't fix my issue. Have posted the issue in Github as #11587.
I tried with older version of Anaconda --> Anaconda3-2019.07-Linux-x86_64 and Anaconda3-2019.03-Linux-x86_64. Anaconda3-2019.07-Linux-x86_64 did not give the same issue related to libz.so.1, but gave another error. But I had a smooth installation with Anaconda3-2019.03-Linux-x86_64.
The problem may be your /tmp is set to noexec in /etc/fstab. Verify with grep tmp /etc/fstab.
Run the installer with TMPDIR set to a directory you have write permissions to, on a file system with executable permission. i.e.:
mkdir /users/$USER/tmpconda
TMPDIR=/users/$USER/tmpconda bash Miniconda2-latest-Linux-x86_64.sh
Solution was found at Anaconda Issues 11587
A quick test of executability on a file system:
$ touch foo && chmod +x foo && ./foo
-bash: ./foo: Permission denied
noexec will cause "Permission denied" even if x is set on the file.
I faced similar issue in Debian 10 and fixed the issue by exporting a writeable path to TMP environment variable.
Reference:
https://github.com/ContinuumIO/anaconda-issues/issues/11154
I solved it like this:
-- run the command >>>
mount |grep tmp
check a tmp partition that does not contain the attribute: noexec
and that contains the attribute: rw
in my case:
devtmpfs on /dev type devtmpfs
(rw,nosuid,seclabel,size=3775584k,nr_inodes=943896,mode=755)
run in terminal:
export TMP='path/to/tmp'& export TMPDIR='path/to/tmp'& bash Anaconda_install_file.sh

How can I solve stdarg.h No such file or directory while compiling out-of-tree Linux kernel module?

I have an out-of-tree Linux kernel module that I need to compile. When I execute "make" in the kernel module directory I am getting:
"fatal error: stdarg.h: No such file or directory"
Before starting the build I installed the header file based on my Linux distribution.
$sudo apt-get install kernel-headers-$(uname -r)
How can I solve this compilation error? (my distribution is Ubuntu 16.04 with linux-headers-4.15.0-42-generic)
I ran a search of stdarg.h with the "locate" command to see if I can sport the file on the system.
I got:
/usr/include/c++/5/tr1/stdarg.h
/usr/lib/gcc/i686-linux-gnu/5/include/cross-stdarg.h
/usr/lib/gcc/i686-linux-gnu/5/include/stdarg.h
...
It tells me there is at least one stdarg.h provided by the compiler.
I tried to include the path "/usr/lib/gcc/i686-linux-gnu/5/include" in the kernel module Makefile so stdarg.h can be picked up. It did not work (while building, another reference to stdarg.h in the official kernel header was not being resolved).
I finally created a symlink directly under:
/usr/src/linux-headers-4.15.0-42-generic/include
$sudo ln -s /usr/lib/gcc/i686-linux-gnu/5/include/stdarg.h stdarg.h
This was just enough to solve the compilation issue.
I am wondering if the kernel headers should come with an implementation of stdarg.h by default (that is the first time I encounter this issue). I have also read that the compiler provide one implementation and most of the time it is better to use the compiler version.
Updated note: if the above solution still does not solve the problem:
Before running make again, do a make clean. Do a ls -la in the folder and look for a ".cache.mk" file. If this is still there, remove it and run "make" again. It should solve the problem.
I had the same issue with CentOS 9, and the other answers didn't work for me. Apparently the problem is that in more recent kernels, it shouldn't be <stdarg.h> but <linux/stdarg.h>. With virtualbox guest additions 6.1.34, it correctly checks for kernel with a version of 5.15.0 or more. But my kernel is the 5.14.xx, meaning the include for stdarg.h is wrong.
Solving the issue
Dependencies
Install all the dependencies for the guest edition
gcc make perl kernel-devel kernel-headers bzip2 dkms
Installation
Run the Guest Addition installation like you would normally. It will fail by saying it is unable to compile the kernel modules. That's expected. It will copy all the file we need to the VM disk.
Editing
We now need to edit the erroneous files.
/opt/VBoxGuestAdditions-6.1.34/src/vboxguest-6.1.34/vboxguest/include/iprt/stdarg.h
/opt/VBoxGuestAdditions-6.1.34/src/vboxguest-6.1.34/vboxsf/include/iprt/stdarg.h
On line 48 (may change for different versions), it check for a version of Linux and select the correct header depending on the version. We need to replace if RTLNX_VER_MIN(5,15,0) with if RTLNX_VER_MIN(5,14,0) in both files.
Compile the kernel modules
We can now compile the kernel modules, and the error should be gone.
sudo rcvboxadd quicksetup all
I personally got an error the first time, but then I recompiled without changing anything and it worked.
Remember that it's just a workaround, it may not work with different versions.
If you using Arch Linux with zen-kernel:
sudo CPATH=/usr/src/linux-zen/include/linux vmware-modconfig --console --install-all
I had the same problem with VirtualBox 6.1.0 running archlinux with kernel 6.1.9.
I downloaded VirtualBoxGuestAdditions_7.2.0.iso file from https://download.virtualbox.org/virtualbox/7.0.2/ link(you may select more appropriate to your VirtualBox version) and assigned as an optical drive to virtualbox machine. After start of the system running blkid command on terminal showed the name of CD rom device which was /dev/sr0. then I created iso folder on
/mnt folder
mkdir /mnt/iso
and mounted cd drive to that folder
mount -o loop /dev/sr0 /mnt/iso
after I cd'ed to /mnt/iso
cd /mnt/iso
and manually run VirtualBoxGuestAdditions.run script
sh ./VirtualBoxGuestAdditions.run
which successfully compiled and istalled required virtualbox guest modules.
Now everytime I update kernel version I redo the same procedure. And it work fine.
It also remove old 6.1.0 guest additons folder.

sudo su command not working in OEL 7

I want to install glibc-2.17-105.el7.i686
But I'm not able to do sudo yum install.
sudo yum install glibc-2.17-105.el7.i686 , gives error
-bash: /usr/local/bin/sudo: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
bash: /usr/local/bin/sudo: /lib/ld-linux.so.2: bad ELF interpreter
This means:
You have a 32-bit /usr/local/bin/sudo binary and
You do not have 32-bit runtime libraries installed.
If you are lucky, you have a 64-bit /usr/bin/sudo (/usr/local/bin is not the default location for sudo). If so, you should be able to do this:
/usr/bin/sudo rm /usr/local/bin/sudo
after which "normal" 64-bit sudo (which would now be /usr/bin/sudo) will just work.
If you are unlucky, but your system allows root login (and you know root password), then simply login as root, and:
# should make 32-bit /usr/local/bin/sudo work
root#host# yum install glibc-2.17-105.el7.i686
If you have no root password, and no working sudo, not all is lost: with physical access to the system, you could boot off the recovery disk, mount your root filesystem, and fix root password. You may as well copy a working sudo to /usr/bin at the same time.
From my experience you are in a bad situation. It's very bad that you have lib errors, I believe because of this error you will have problems running most of your executables on your system and that makes debugging and fixing much harder.
It's most likely a filesystem corruption but I'm not sure if it can be fixed.
I would try to go to single user mode, remount / as read only, then do a fsck on it(depending on your filesystem it may be e2fsck or other).
If it doesn't work, another path would be to boot from a rescue disk and do fsck or try other methods of fixing.
You may have to backup any data and reinstall. Please backup ASAP!
Good luck!

Update error für OpenSuse 12.3 for "libsolv-tools-0.3.2-2.14.1"

I seem to have broken my update system on OpenSuSe 12.3. Whenever I try to update I get this message:
( 1/23) Installing: libsolv-tools-0.3.2-2.14.1 .....................................[error]
Installation of libsolv-tools-0.3.2-2.14.1 failed:
(with --nodeps --force) Error: Subprocess failed. Error: RPM failed: error: unpacking of archive failed on file /usr/bin/dumpsolv: cpio: rename failed - Input/output error
error: libsolv-tools-0.3.2-2.14.1.x86_64: install failed
error: libsolv-tools-0.3.2-2.10.1.x86_64: erase skipped
Abort, retry, ignore? [a/r/i] (a):
When looking at for program dumpsolv in /usr/bin, I get this:
# ls | grep "dumpsolv"
dumpsolv
dumpsolv;528134c9
dumpsolv;528134d2
dumpsolv;528134da
dumpsolv;528134ec
dumpsolv;5281350e
dumpsolv;52813523
dumpsolv;52828c89
dumpsolv;52880d1a
dumpsolv;52880d44...
followed by many more lines like this. One for every failed installation of libsolv-tools-0.3.2-2.14.1
When looking at dumpsolv I get these errors:
# stat /usr/bin/dumpsolv
stat: cannot stat ‘/usr/bin/dumpsolv’: Input/output error
and (of cause)
# lsattr /usr/bin/dumpsolv
lsattr: Input/output error while trying to stat /usr/bin/dumpsolv
I already tried out the following commands:
zypper ve
rpm --rebuilddb
And this:
https://joshua.hoblitt.com/rtfm/2013/05/dealing_with_rpm_cpio_rename_package_installupdate_errors/
Here is the tool that is causing the update issue:
http://rpmfind.net//linux/RPM/opensuse/updates/12.3/x86_64/libsolv-tools-0.3.2-2.14.1.x86_64.html
And my uname
# uname -a
Linux linux-3hbw.site 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64 x86_64 GNU/Linux
I am really at a loss here. I already posted in there forums, but without any luck, they seem to be as puzzled as I am:
http://www.opensuse-forum.de/update-error-f%C3%BCr-opensuse-12-3-f%C3%BCr-libsolv-tools-0-3-2-2-14-1-software-installieren-aktualisieren/allgemeines-f17/t9540-f55/
http://www.unixboard.de/vb3/showthread.php?54758-Update-error-f%FCr-OpenSuse-12-3-f%FCr-quot-libsolv-tools-0-3-2-2-14-1-quot
Also, I cannot reinstall the currently installed libsolv-tools, as I get the same error that I get when trying to upgrade.
Ok, I fixed it, It was a problem with my file-system. Here is what I did:
First I saw that stat returned an input/output error. That seemed strange to me, so I checked the whole directory:
# stat /usr/bin/* | grep "Input/output error"
And got a whole list of errors. Thus I knew that it was not a problem with dumpsolv, but rather something with a bit more impact. This lead me to search the web and I found out that it could in fact be an error in the file-system.
To repair the root file-system in OpenSuse they offer some really great advice:
http://www.novell.com/documentation/suse91/suselinux-adminguide/html/ch12s05.html
Thus I booted up the installation-DVD, canceled the installation to get my command-prompt as root and used e2fsck on my root partition, which is /dev/sdb1 like so:
# e2fsck /dev/sdb1
After this I got a really long list of different inode errors, which I read carefully and fixed whatever could be fixed (which was everything, I guess). After this I rebooted my system from harddrive and the problem was solved. I can install my updates and everything is running fine now.
But if you try this: be extremely careful! You are messing with your root partition here and you should read everything it tells you and verify it. Best have a second computer running to check in case you are not sure about something. If you get a bad superblock (which I did not have) you can use dumpe2fs <partition> in order to see which block it is and then use e2fsck -b <block> <partition> to restore the file-system from backup.
Everything is explained well in the link I posted above plus there are a lot of websites on the internet containing information about the use of e2fsck and dumpe2fs, you should consult these first if you have any doubts.
I do hope that this can help someone else.

Accidentally deleted symlink libc.so.6 in CentOS 6.4. How to get sudo privilege to re-create it?

I accidentally deleted the symbol link /lib64/libc.so.6 -> /lib64/libc-2.12.so with
$ sudo rm libc.so.6
Then I can not use anything including ls command. The error appears for any command I type
ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I've tried
$ export LD_PRELOAD=/lib64/libc-2.12.so
After this I can use ls and ln ..., but still can not use sudo ln ... or sudo -E ln .... I always get this err
sudo: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
It's a remote server so I can not use a live CD. I now have a ssh bash session alive but can not establish new ones. I have sudo privilege, but don't have root password.
So currently my problem is I need to run sudo sln -s libc-2.12.so libc.so.6 to re-create the symlink libc.so.6, but I can not run sudo without libc.so.6.
How can I fix it? Thanks~
I resolved the issue by using a statically linked version of "ln" that was already in the server's /sbin.
E.g., this restored it for my configuration:
/sbin/sln /lib64/libc-2.5.so /lib64/libc.so.6
A bit embarrassing :) but it happened to me as well on Ubuntu 12.04.3 (which is not CentOS 6.4 but I thought this could still help maybe).
Because my Ubuntu wouldn't start I used a liveUSB to boot up and then mounted my hard drive and created the symlink (I did have the file itself libc-2.15.so) and that did it.
Just a few specific details:
I asked a good friend to use his computer for half an hour
I Downloaded my exact Ubuntu iso (12.04.3, if you're on;y missing the symlink, it could be any version so much that it can mount drives) from here: link
I made sure his Ubuntu has usb-creator-gtk ($ sudo apt-get install usb-gtk-creator, I'm sure Windows has an equivalent usb boot creator)
Created the liveUSB using usb-creator-gtk
Booted my computer with it (you'll probably need to change your BIOS settings to allow external USB to be booted first)
Once I booted from the live USB I figured where my hard drive partition by running the Ubuntu partition tool (the live USB has one) - mine was of type ext4 and in /dev/sdb1
I mounted it by doing $ mkdir /home/ubuntu/mnt and then $ sudo mount-t ext4 /dev/sdb1 /home/ubuntu/mnt
I then proceeded to that folder $ cd /home/ubuntu/mnt
From that location I then created the symlink by $ sudo ln -s lib/x86_64-linux-gnu/libc-2.15.so lib/x86_64-linux-gnu/libc.so.6
After a reboot I was good.
Hope it helps you (or someone..)
I would add some thing more to #wilfo answer as same also happened with me [accidentally deleting lib.so.6 and was getting /sbin/init missing libc.so.6 on boot up] .
After creating liveUSB in windows (using UNetbootin etc [http://unetbootin.sourceforge.net/]) or in ubuntu as #wilfo suggested.
Booting from liveUSB, I selected "experience ubuntu without installing it" and was happy applying wilfo's method until step 6 and then i couldn't find my hard drive partition of type ext3/4. All were nftf/fat/extended stuff.
So i recovered previous ubuntu (the one with missing libc.so...) by following this link
https://help.ubuntu.com/community/Boot-Repair
make sure to follow all necessary steps and take a backup of your ubuntu partition.
you can see your previous ubuntu files inside /mnt/boot-sav/wubi1/home
take a backup from here to your windows partations /mnt/boot-sav/sda...
and follow remaining procedure here https://help.ubuntu.com/community/Boot-Repair

Resources