Hello world :-) I did setup Debian Linux with deboostrap on 14.1-RELEASE-p4 AMD64 to work with Linux binary packages used for embedded / RTOS development on a FreeBSD box with Linuxlator. apt under Debian provides me all of the basic utilities that I need. I works like a charm, thank you :-) I just observed some kernel messages (dmesg) when using mc and tmux: 1. unsupported ioctl TIOCGPTPERR. 2. linux_ioctl_fallback fd=8, cmd=0x5441 ('T',65) is not implemented. 3. linux_ioctl_fallback fd=0, cmd=0x541c ('T',28) is not implemented. These does not seem critical as eveything seems to work fine, but may be worth considering implementation? :-)
Not sure what the issue is, but the script I used previously no longer works. Arch Linux cannot be chrooted on FreeBSD. Currently, after building the Arch Linux compatibility layer, chroot appears to hang, but in reality, the Bash line is completely invisible, though normal input still works. It seems impossible to install `fakeroot-tcp` via pacman anymore, so I switched to AUR. I am now caught in a chicken-and-egg paradox, but this issue is not high priority; the problem above needs to be resolved first. My `dmesg` is full of errors like: `linux_ioctl_fallback fd=0, cmd=0x802c542a ('T',42) is not implemented`. Both in 14.3-RELEASE and 15.0-RELEASE. ```sh #/bin/sh rootdir=/compat/arch url="https://ftp.sjtu.edu.cn/archlinux/iso/latest/archlinux-bootstrap-x86_64.tar.zst" echo "begin to install archlinux ..." echo "check modules ..." # check linux module if [ "$(sysrc -n linux_enable)" = "NO" ]; then echo "linux module should be loaded. Continue?(Y|n)" read answer case $answer in [Nn][Oo]|[Nn]) echo "linux module not loaded" exit 1 ;; [Yy][Ee][Ss]|[Yy]|"") sysrc linux_enable=YES ;; esac fi echo "start linux" service linux start # check dbus if ! /usr/bin/which -s dbus-daemon;then echo "dbus-daemon not found. install it [Y|n]" read answer case $answer in [Nn][Oo]|[Nn]) echo "dbus not installed" exit 2 ;; [Yy][Ee][Ss]|[Yy]|"") pkg install -y dbus ;; esac fi if [ "$(sysrc -n dbus_enable)" != "YES" ]; then echo "dbus should be enable. Continue?(Y|n)" read answer case $answer in [Nn][Oo]|[Nn]) echo "dbus not running" exit 2 ;; [Yy][Ee][Ss]|[Yy]|"") sysrc dbus_enable=YES ;; esac fi echo "start dbus" service dbus start echo "now we will bootstrap archlinux" fetch ${url} mkdir /compat tar --use-compress-program=unzstd -xpvf archlinux-bootstrap-x86_64.tar.zst -C /compat --numeric-owner rm archlinux-bootstrap-x86_64.tar.zst mv /compat/root.x86_64 ${rootdir} if [ ! "$(sysrc -f /boot/loader.conf -qn nullfs_load)" = "YES" ]; then echo "nullfs_load should load. continue? (Y|n)" read answer case $answer in [Nn][Oo]|[Nn]) echo "nullfs not load" exit 3 ;; [Yy][Ee][Ss]|[Yy]|"") sysrc -f /boot/loader.conf nullfs_load=yes ;; esac fi if ! kldstat -n nullfs >/dev/null 2>&1;then echo "load nullfs module" kldload -v nullfs fi echo "mount some fs for linux" echo "devfs ${rootdir}/dev devfs rw,late 0 0" >> /etc/fstab echo "tmpfs ${rootdir}/dev/shm tmpfs rw,late,size=1g,mode=1777 0 0" >> /etc/fstab echo "fdescfs ${rootdir}/dev/fd fdescfs rw,late,linrdlnk 0 0" >> /etc/fstab echo "linprocfs ${rootdir}/proc linprocfs rw,late 0 0" >> /etc/fstab echo "linsysfs ${rootdir}/sys linsysfs rw,late 0 0" >> /etc/fstab echo "/tmp ${rootdir}/tmp nullfs rw,late 0 0" >> /etc/fstab #echo "/home ${rootdir}/home nullfs rw,late 0 0" >> /etc/fstab mount -al echo "For archlinux, we should change 'compat.linux.osrelease'. continue? (Y|n)" read answer case $answer in [Nn][Oo]|[Nn]) echo "close to success" exit 4 ;; [Yy][Ee][Ss]|[Yy]|"") echo "compat.linux.osrelease=6.12.20" >> /etc/sysctl.conf sysctl compat.linux.osrelease=6.12.20 ;; esac echo "complete!" echo "to use: chroot ${rootdir} /bin/bash" echo "" echo "but for easy use ,i can do some init config" echo "if agree:" echo " I set resolv.conf to ali dns" echo " init pacman keyring" echo " use tsinghua mirror" echo "continue?[Y|n]" read answer case $answer in [Nn][Oo]|[Nn]) echo "set your archlinux by yourself.bye!" exit 0 ;; [Yy][Ee][Ss]|[Yy]|"") echo "nameserver 223.5.5.5" >> ${rootdir}/etc/resolv.conf chroot ${rootdir} /bin/bash -c "pacman-key --init" chroot ${rootdir} /bin/bash -c "pacman-key --populate archlinux" cat ${rootdir}/etc/pacman.d/mirrorlist > mlst.tmp echo 'Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch' > ${rootdir}/etc/pacman.d/mirrorlist cat mlst.tmp >> ${rootdir}/etc/pacman.d/mirrorlist rm mlst.tmp echo '[archlinuxcn]' >> ${rootdir}/etc/pacman.conf echo 'Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch' >> ${rootdir}/etc/pacman.conf echo "Refresh sources and systems" echo "Now we will enable DisableSandbox for pacman or you will get error: restricting filesystem access failed because landlock is not supported by the kernel!" sed -E -i '' 's/^[[:space:]]*#[[:space:]]*DisableSandbox/DisableSandbox/' ${rootdir}/etc/pacman.conf grep -n 'DisableSandbox' ${rootdir}/etc/pacman.conf chroot ${rootdir} /bin/bash -c "pacman -Syyu --noconfirm" echo "Refresh key" chroot ${rootdir} /bin/bash -c "pacman -S --noconfirm archlinuxcn-keyring" echo "Install yay" chroot ${rootdir} /bin/bash -c "pacman -S --noconfirm yay base base-devel nano yay wqy-zenhei" echo "Create user" chroot ${rootdir} /bin/bash -c "useradd -G wheel -m test" echo "Now modify the sudo configuration" echo '%wheel ALL=(ALL) ALL' >> ${rootdir}/etc/sudoers echo '%sudo ALL=(ALL:ALL) ALL' >> ${rootdir}/etc/sudoers echo "change fakeroot" chroot ${rootdir} /bin/bash -c "pacman -S --noconfirm fakeroot-tcp" echo "Make localised settings" echo 'zh_CN.UTF-8 UTF-8' >> ${rootdir}/etc/locale.gen chroot ${rootdir} /bin/bash -c "locale-gen" echo "all done." ;; esac echo "Now you can run '#chroot /compat/arch/ /bin/bash' Into ArchLinux" ```
root@ykla:/home/ykla # truss -f chroot /compat/arch /bin/bash 3371: mmap(0x0,135168,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 56625092100096 (0x33800e800000) 3371: mprotect(0x52694101d000,8192,PROT_READ) = 0 (0x0) 3371: issetugid() = 0 (0x0) 3371: sigfastblock(0x1,0x526941020640) = 0 (0x0) 3371: open("/etc/libmap.conf",O_RDONLY|O_CLOEXEC,01640030030) = 3 (0x3) 3371: fstat(3,{ mode=-rw-r--r-- ,inode=17954,size=35,blksize=4096 }) = 0 (0x0) 3371: read(3,"includedir /usr/local/etc/libmap"...,35) = 35 (0x23) 3371: close(3) = 0 (0x0) 3371: open("/usr/local/etc/libmap.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,0165) = 3 (0x3) 3371: fcntl(3,F_ISUNIONSTACK,0x0) = 0 (0x0) 3371: getdirentries(3,"\M^@\M-y^B\0\0\0\0\0^A\0\0\0\0"...,4096,{ 0x0 }) = 104 (0x68) 3371: open("/usr/local/etc/libmap.d/mesa.conf",O_RDONLY|O_CLOEXEC,0165) = 4 (0x4) 3371: fstat(4,{ mode=-rw-r--r-- ,inode=194945,size=38,blksize=4096 }) = 0 (0x0) 3371: read(4,"libGLX_indirect.so.0 libGLX_mesa"...,38) = 38 (0x26) 3371: close(4) = 0 (0x0) 3371: getdirentries(3,0x33800e805008,4096,{ 0x171dc51c }) = 0 (0x0) 3371: close(3) = 0 (0x0) 3371: open("/var/run/ld-elf.so.hints",O_RDONLY|O_CLOEXEC,036710554401) = 3 (0x3) 3371: read(3,"Ehnt^A\0\0\0\M^@\0\0\0G^A\0\0"...,128) = 128 (0x80) 3371: fstat(3,{ mode=-r--r--r-- ,inode=360832,size=455,blksize=4096 }) = 0 (0x0) 3371: pread(3,"/lib:/usr/lib:/usr/lib/compat:/u"...,327,0x80) = 327 (0x147) 3371: close(3) = 0 (0x0) 3371: open("/lib/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3) 3371: fstat(3,{ mode=-r--r--r-- ,inode=132102,size=1957616,blksize=131072 }) = 0 (0x0) 3371: mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 47047505272832 (0x2aca19d6e000) 3371: mmap(0x0,3158016,PROT_NONE,MAP_GUARD,-1,0x0) = 47047514763264 (0x2aca1a67b000) 3371: mmap(0x2aca1a67b000,544768,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 47047514763264 (0x2aca1a67b000) 3371: mmap(0x2aca1a700000,1355776,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x84000) = 47047515308032 (0x2aca1a700000) 3371: mmap(0x2aca1a84b000,40960,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1ce000) = 47047516663808 (0x2aca1a84b000) 3371: mmap(0x2aca1a855000,28672,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1d7000) = 47047516704768 (0x2aca1a855000) 3371: mmap(0x2aca1a85c000,1187840,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 47047516733440 (0x2aca1a85c000) 3371: munmap(0x2aca19d6e000,4096) = 0 (0x0) 3371: close(3) = 0 (0x0) 3371: mprotect(0x2aca1a84b000,40960,PROT_READ) = 0 (0x0) 3371: mprotect(0x2aca1a84b000,40960,PROT_READ|PROT_WRITE) = 0 (0x0) 3371: mprotect(0x2aca1a84b000,40960,PROT_READ) = 0 (0x0) 3371: readlink("/etc/malloc.conf",0x2aca17ed8540,1024) ERR#2 'No such file or directory' 3371: issetugid() = 0 (0x0) 3371: mmap(0x0,2097152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(21),-1,0x0) = 56625094197248 (0x33800ea00000) 3371: mmap(0x0,2097152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 56625096294400 (0x33800ec00000) 3371: mmap(0x0,6291456,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(21),-1,0x0) = 56625098391552 (0x33800ee00000) 3371: mprotect(0x2ac1f7230000,4096,PROT_READ) = 0 (0x0) 3371: __sysctl("kern.ngroups",2,0x2aca17ed98d4,0x2aca17ed98d8,0x0,0) = 0 (0x0) 3371: chdir("/compat/arch") = 0 (0x0) 3371: chroot(".") = 0 (0x0) 3371: execve("/bin/bash",0x2aca17ed9a30,0x2aca17ed9a40) EJUSTRETURN 3371: linux_brk(0x0) = 18141184 (0x114d000) 3371: linux_access("/etc/ld.so.preload",R_OK) ERR#-2 'No such file or directory' 3371: linux_openat(0xffffff9c,0x8011641ca,0x80000,0x0) = 3 (0x3) 3371: linux_newfstat(3,0x7fffffffb670) = 0 (0x0) 3371: linux_mmap2(0x0,0x53cf,0x1,0x2,0x3,0x0) = 34378039296 (0x801174000) 3371: close(3) = 0 (0x0) 3371: linux_openat(0xffffff9c,0x801173f90,0x80000,0x0) = 3 (0x3) 3371: read(0,0x0,0) = 832 (0x340) 3371: linux_newfstat(3,0x7fffffffb660) = 0 (0x0) 3371: linux_mmap2(0x0,0x2000,0x3,0x22,0xffffffff,0x0) = 34378063872 (0x80117a000) 3371: linux_mmap2(0x0,0x5ac68,0x1,0x802,0x3,0x0) = 34378072064 (0x80117c000) 3371: linux_mmap2(0x801192000,0x32000,0x5,0x812,0x3,0x16000) = 34378162176 (0x801192000) 3371: linux_mmap2(0x8011c4000,0x9000,0x1,0x812,0x3,0x48000) = 34378366976 (0x8011c4000) 3371: linux_mmap2(0x8011cd000,0x9000,0x3,0x812,0x3,0x51000) = 34378403840 (0x8011cd000) 3371: linux_mmap2(0x8011d6000,0xc68,0x3,0x32,0xffffffff,0x0) = 34378440704 (0x8011d6000) 3371: close(3) = 0 (0x0) 3371: linux_openat(0xffffff9c,0x80117a510,0x80000,0x0) = 3 (0x3) 3371: read(0,0x0,0) = 832 (0x340) 3371: linux_pread(0x3,0x7fffffffb330,0x380,0x40) = 896 (0x380) 3371: linux_newfstat(3,0x7fffffffb640) = 0 (0x0) 3371: linux_pread(0x3,0x7fffffffb210,0x380,0x40) = 896 (0x380) 3371: linux_mmap2(0x0,0x211c30,0x1,0x802,0x3,0x0) = 34378612736 (0x801200000) 3371: linux_mmap2(0x801224000,0x171000,0x5,0x812,0x3,0x24000) = 34378760192 (0x801224000) 3371: linux_mmap2(0x801395000,0x6f000,0x1,0x812,0x3,0x195000) = 34380271616 (0x801395000) 3371: linux_mmap2(0x801404000,0x6000,0x3,0x812,0x3,0x203000) = 34380726272 (0x801404000) 3371: linux_mmap2(0x80140a000,0x7c30,0x3,0x32,0xffffffff,0x0) = 34380750848 (0x80140a000) 3371: close(3) = 0 (0x0) 3371: linux_openat(0xffffff9c,0x80117aa40,0x80000,0x0) = 3 (0x3) 3371: read(0,0x0,0) = 832 (0x340) 3371: linux_newfstat(3,0x7fffffffb620) = 0 (0x0) 3371: linux_mmap2(0x0,0x6ece0,0x1,0x802,0x3,0x0) = 34380783616 (0x801412000) 3371: linux_mmap2(0x80141f000,0x47000,0x5,0x812,0x3,0xd000) = 34380836864 (0x80141f000) 3371: linux_mmap2(0x801466000,0x16000,0x1,0x812,0x3,0x54000) = 34381127680 (0x801466000) 3371: linux_mmap2(0x80147c000,0x5000,0x3,0x812,0x3,0x6a000) = 34381217792 (0x80147c000) 3371: close(3) = 0 (0x0) 3371: linux_mmap2(0x0,0x2000,0x3,0x22,0xffffffff,0x0) = 34378444800 (0x8011d7000) 3371: linux_arch_prctl(0x1002,0x8011d7b80) = 0 (0x0) 3371: linux_set_tid_address(0x8011d7e50) = 3371 (0xd2b) 3371: linux_set_robust_list(0x8011d7e60,0x18) = 0 (0x0) 3371: linux_rseq(0x8011d7ac0,0x20,0x0,0x53053053) ERR#-38 'Function not implemented' 3371: linux_mprotect(0x801404000,0x4000,0x1) = 0 (0x0) 3371: linux_mprotect(0x80147c000,0x4000,0x1) = 0 (0x0) 3371: linux_mprotect(0x8011cd000,0x3000,0x1) = 0 (0x0) 3371: linux_mprotect(0x1137000,0x3000,0x1) = 0 (0x0) 3371: linux_mprotect(0x801170000,0x2000,0x1) = 0 (0x0) 3371: linux_prlimit64(0x0,0x3,0x0,0x7fffffffc1d0) = 0 (0x0) 3371: linux_getrandom(0x80140f200,0x8,0x1) = 8 (0x8) 3371: munmap(0x801174000,21455) = 0 (0x0) 3371: linux_openat(0xffffffffffffff9c,0x1108a00,0x802,0x0) = 3 (0x3) 3371: close(3) = 0 (0x0) 3371: linux_brk(0x0) = 18141184 (0x114d000) 3371: linux_brk(0x116e000) = 18276352 (0x116e000) 3371: linux_openat(0xffffff9c,0x8013b92d0,0x80000,0x0) = 3 (0x3) 3371: linux_newfstat(3,0x801409800) = 0 (0x0) 3371: linux_mmap2(0x0,0x320580,0x1,0x2,0x3,0x0) = 34382807040 (0x801600000) 3371: close(3) = 0 (0x0) 3371: linux_openat(0xffffff9c,0x8013b49f0,0x80000,0x0) = 3 (0x3) 3371: linux_newfstat(3,0x7fffffffbf70) = 0 (0x0) 3371: linux_mmap2(0x0,0x6982,0x1,0x1,0x3,0x0) = 34378452992 (0x8011d9000) 3371: close(3) = 0 (0x0) 3371: linux_sys_futex(0x80140972c,0x81,0x7fffffff,0x0,0x80140972c,0x0) = 0 (0x0) 3371: getresuid(0x113a4a0,0x113a4a4,0x113a4a8) = 0 (0x0) 3371: getresgid(0x113a4ac,0x113a4b0,0x113a4b4) = 0 (0x0) 3371: linux_rt_sigprocmask(0x0,0x0,0x1143b08,0x8) = 0 (0x0) 3371: linux_ioctl(0x0,0x802c542a,0x7fffffffc290) ERR#-22 'Invalid argument' 3371: linux_rt_sigaction(0x11,0x7fffffffbee0,0x7fffffffbf80,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x11,0x7fffffffbee0,0x7fffffffbf80,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x2,0x7fffffffbee0,0x7fffffffbf80,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x2,0x7fffffffbee0,0x7fffffffbf80,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x3,0x7fffffffbee0,0x7fffffffbf80,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x3,0x7fffffffbee0,0x7fffffffbf80,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x14,0x7fffffffbec0,0x7fffffffbf60,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x14,0x7fffffffbec0,0x7fffffffbf60,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x15,0x7fffffffbec0,0x7fffffffbf60,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x15,0x7fffffffbec0,0x7fffffffbf60,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x16,0x7fffffffbec0,0x7fffffffbf60,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x16,0x7fffffffbec0,0x7fffffffbf60,0x8) = 0 (0x0) 3371: linux_rt_sigprocmask(0x0,0x0,0x11436e0,0x8) = 0 (0x0) 3371: linux_rt_sigaction(0x3,0x7fffffffbee0,0x7fffffffbf80,0x8) = 0 (0x0) 3371: linux_newuname(0x7fffffffbff0) = 0 (0x0) 3371: linux_newfstatat(0xffffff9c,0x1154b00,0x7fffffffbf10,0x0) ERR#-2 'No such file or directory' 3371: linux_getcwd(0x11562a0,0x1000) = 2 (0x2) 3371: linux_getpid() = 3371 (0xd2b) 3371: linux_getppid() = 3370 (0xd2a) 3371: linux_getpid() = 3371 (0xd2b) 3371: linux_getppid() = 3370 (0xd2a) 3371: linux_getpid() = 3371 (0xd2b) 3371: linux_getppid() = 3370 (0xd2a) 3371: getpgrp() = 3370 (0xd2a) 3371: linux_ioctl(0x2,0x540f,0x7fffffffc164) = 0 (0x0) 3371: linux_rt_sigaction(0x11,0x7fffffffbec0,0x7fffffffbf60,0x8) = 0 (0x0) 3371: linux_prlimit64(0x0,0x6,0x0,0x7fffffffc130) = 0 (0x0) 3371: linux_openat(0xffffff9c,0x7fffffffbe90,0x80000,0x0) = 3 (0x3) 3371: linux_newfstat(3,0x7fffffffbca0) = 0 (0x0) 3371: read(0,0x0,0) = 2998 (0xbb6) 3371: read(0,0x0,0) = 0 (0x0) 3371: close(3) = 0 (0x0) 3371: linux_openat(0xffffff9c,0x115dc10,0x0,0x0) = 3 (0x3) 3371: linux_newfstat(3,0x7fffffffc050) = 0 (0x0) 3371: linux_mmap2(0x0,0x2b192,0x1,0x2,0x3,0x0) = 34381238272 (0x801481000) 3371: close(3) = 0 (0x0) 3371: linux_rt_sigprocmask(0x0,0x0,0x1143be8,0x8) = 0 (0x0) 3371: linux_fcntl(0x0,0x3,0x0) = 2 (0x2) 3371: linux_newfstat(0,0x7fffffffc1f0) = 0 (0x0) 3371: linux_lseek(0,0,SEEK_CUR) = 1956117 (0x1dd915)
I found that even when it seems stuck, it is actually possible to enter some non-interactive commands. However, any interactive command reports a tty problem. I also tried zsh, and it behaves the same way. The `dmesg` error is still: ``` linux: jid 0 pid 5091 (nano): linux_ioctl_fallback fd=2, cmd=0x802c542a ('T',42) is not implemented ``` I also tried Gentoo Linux on FreeBSD; currently, the rolling-release Gentoo still works fine. However, considering that Arch Linux’s aggressive approach often represents the trend of all Linux distributions, gradually all distributions may become unusable. ```````` root@ykla:~ # chroot /compat/arch/ /bin/bash nano Standard input is not a terminal ```` ``` root@ykla:~ # chroot /compat/arch/ sh-5.3# ls ls bin boot dev etc home lib lib64 mnt opt proc root run sbin srv sys tmp usr var sh-5.3# top top top: failed tty get sh-5.3# uname uname Linux sh-5.3# bash bash uname Linux ```
It seems fixed by https://github.com/freebsd/freebsd-src/pull/1949 AKA https://github.com/freebsd/freebsd-src/commit/85bf328868c8f6d8fede9d8d4b4ff8a589636990
There's no TIOCGPTPERR ioctl in the Linux kernel. Can you please get the right name?