警告:沒有可用的 inet 套接字:沒有這樣的檔案或目錄

警告:沒有可用的 inet 套接字:沒有這樣的檔案或目錄

所以我使用 chroot chroot 進入 debian bootstrap 一切都在 root 帳戶上正常工作,直到我添加了一個新用戶,發現我無法更新或訪問 xdisplay 或 localhost ip,這很奇怪,我不知道該怎麼做,所以我正在尋求幫助,這是我正在使用的chroot 腳本

~ $ cat chroot.sh
sudo mount -t proc /proc chroot-ubuntu/proc
sudo mount --rbind /sys chroot-ubuntu/sys
sudo mount --rbind /dev chroot-ubuntu/dev
sudo mount /system/ chroot-ubuntu/system/
unset LD_PRELOAD
env -i HOME=/root \
PATH="/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games:/opt/wine-5.3/bin/:/opt/wine-staging/bin/" \
TERM="xterm" \
BASH="/usr/bin/bash" \
SHELL="/usr/bin/bash" \
PREFIX="/usr" \
MDIR="/tmp" \
LD_LIBRARY_PATH="/lib:/usr/lib:/usr/lib/i386-linux-gnu/:/var/lib:/var/lib/dpkg/:/lib/i386-linux-gnu:/usr/local/lib:/opt/wine-stable/lib:/opt/wine-stable/lib/wine:/opt/wine-5.3/lib:/lib:/lib/wine:/lib/wine/fakedlls:/opt/wine-staging/lib" \
chroot  chroot-ubuntu/   /bin/bash

我使用 sudo 執行 chroot.sh 所以 iam 總是進入 root 帳戶讓添加一個新用戶我得到這個奇怪的輸出

root@localhost:~# adduser  g
Adding user `g' ...
Adding new group `g' (1000) ...
Adding new user `g' (1000) with group `g' ...
Creating home directory `/home/g' ...
Copying files from `/etc/skel' ...
passwd: user 'g' does not exist
Permission denied
Try again? [y/N]

如果我嘗試為新用戶添加密碼,我會得到

root@localhost:~# passwd  g
passwd: user 'g' does not exist

所以我必須手動添加用戶(我不記得如何添加)

這是 root 和使用者的 ifconfig 輸出

root@localhost:~# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>

請注意,當對使用者執行 ifcnfig 時,inet 127.0.0.1 不存在

spiral@localhost:~$ /sbin/ifconfig
warning: no inet socket available: No such file or directory`
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet6 ::1  prefixlen 128  scopeid 0x10<host>

相反有warning: no inet socket available: No such file or directory錯誤

答案1

這是輸出

spiral@localhost:~$ strace ifconfig  2>&1 |grep ENOENT
proot warning: ptrace request 'PTRACE_???' not supported yet
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ax25", R_OK) = -1 ENOENT (No such file or directory)                                                           faccessat(AT_FDCWD, "/proc/net/nr", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/rose", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ipx", R_OK) = -1 ENOENT (No such file or directory)                                                            faccessat(AT_FDCWD, "/proc/net/appletalk", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/econet", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/ash", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/x25", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ax25", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/nr", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/rose", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/ipx", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/appletalk", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/econet", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/sys/net/ash", R_OK) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/proc/net/x25", R_OK) = -1 ENOENT (No such file or directory)
spiral@localhost:~$

相關內容