matthewbauer / nix-bundle

Bundle Nix derivations to run anywhere!
MIT License
633 stars 46 forks source link

Not working on Centos 6.5 #50

Open rakesh8081 opened 5 years ago

rakesh8081 commented 5 years ago

I am trying to build latest possible curl version using nix-bundle for centos 6.5. The build was done on a Ubuntu 18.0 VM running on Windows. It works pretty fine where it was build, here are the outputs

rakesh@rakesh-VirtualBox:~/src/github.com/nix-bundle$ md5sum ./curl 
4eb3f636f1617114f9df298f761c7bc6  ./curl
rakesh@rakesh-VirtualBox:~/src/github.com/nix-bundle$ ./curl --version
curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.0.2r zlib/1.2.11 libssh2/1.8.0 nghttp2/1.36.0
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy 
rakesh@rakesh-VirtualBox:~/src/github.com/nix-bundle$ 
rakesh@rakesh-VirtualBox:~/src/github.com/nix-bundle$ ldd ./curl
    not a dynamic executable
rakesh@rakesh-VirtualBox:~/src/github.com/nix-bundle$

however when I use the same binary in a Centos machine running on aws, it doesn't work. The outputs on Centos is as below:

root@ip-10-xxx-8-xxx tmp]# md5sum ./curl
4eb3f636f1617114f9df298f761c7bc6  ./curl
[root@ip-10-xxx-8-xxx tmp]# ./curl --version
unshare(): Invalid argument
[root@ip-10-xxx-8-xxx tmp]# 
[root@ip-10-xxx-8-xxx tmp]# ldd ./curl
    not a dynamic executable
[root@ip-10-xxx-8-xxx tmp]#

so the question is what exactly went wrong. Please let me know for any additional logs.

Thra11 commented 5 years ago

Does the centos machine support user namespaces? Is this possibly the same issue: https://github.com/lethalman/nix-user-chroot/issues/9 (nix-bundle uses nix-user-chroot)

rakesh8081 commented 5 years ago

I believe it does. But clearly the kernel version is not >3.x. Some outputs for more reference.

[root@ip-172-30-14-129 ~]# 
[root@ip-172-30-14-129 ~]# 
[root@ip-172-30-14-129 ~]# uname -a
Linux ip-172-30-14-129 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@ip-172-30-14-129 ~]# grep CONFIG_USER_NS /boot/config-$(uname -r)
CONFIG_USER_NS=y
[root@ip-172-30-14-129 ~]# echo $0
-bash
[root@ip-172-30-14-129 ~]# if [[ `sudo cat /boot/config-$(uname -a | awk '{print $3}') |grep '^CONFIG_USER_NS'` == "CONFIG_USER_NS=y" ]]; then echo "You have support for User Namespaces"; else echo "Sorry, you don't have support for User Namespaces"; fi
You have support for User Namespaces
[root@ip-172-30-14-129 ~]# 
[root@ip-172-30-14-129 ~]# unshare
Usage: unshare [options] <program> [args...]
Run program with some namespaces unshared from parent

  -h, --help        usage information (this)
  -m, --mount       unshare mounts namespace
  -u, --uts         unshare UTS namespace (hostname etc)
  -i, --ipc         unshare System V IPC namespace
  -n, --net         unshare network namespace

For more information see unshare(1).
[root@ip-172-30-14-129 ~]# 
Thra11 commented 5 years ago

Can you check what the other setting mentioned in that bug is (assuming it exists on your system)

cat /proc/sys/user/max_user_namespaces
rakesh8081 commented 5 years ago

The file don’t exist in system.

[root@ip-172-30-14-129 ~]# cat /proc/sys/user/max_user_namespaces

cat: /proc/sys/user/max_user_namespaces: No such file or directory

[root@ip-172-30-14-129 ~]#

[root@ip-172-30-14-129 ~]# locate max_user_namespace

[root@ip-172-30-14-129 ~]#

viogq commented 4 years ago

I bundled firefox which started up in Manjaro/Arch but cannot display any online page. internal stuff like browsing history works tho.