Skip to content

Newbie question #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tdunning opened this issue Apr 3, 2025 · 1 comment
Open

Newbie question #301

tdunning opened this issue Apr 3, 2025 · 1 comment

Comments

@tdunning
Copy link

tdunning commented Apr 3, 2025

I see in the other newbie question issue that cpud -d -init may be necessary when running outside of system startup. That helped me quite a bit to get a server started.

Once that server is started, I get a message cpuns not found which seems to imply that I need an executable called cpuns on either the server or the client side. It makes sense if cpu is trying to do namespacey things.

I don't, however, see anything with that name around.

Running cpu -ssh appears to work well which corroborates the idea that some sort of namespace executable or config is missing.

What is it that I don't know enough to ask?

Here is a transcript from the client side

tdunning@nodec:~/cpu$ cpu -key ~/.ssh/id_rsa  nodea
bash: line 25: cpuns: command not found
2025/04/03 01:31:25 SSH error Process exited with status 127
tdunning@nodec:~/cpu$ cpu -ssh -key ~/.ssh/id_rsa  nodea
2025/04/03 01:31:39 Running basic ssh protocol; no mounts
tdunning@nodea:~$ exit
tdunning@nodec:~/cpu$ 

And here are the outputs from the client and server sides with debug prints on

tdunning@nodec:~/cpu$ cpu -d -key ~/.ssh/id_rsa  nodea
2025/04/03 01:40:41 CPU:Running as client, to host "nodea", args ["/bin/bash"]
2025/04/03 01:40:41 CPU:getKeyFile for "/home/tdunning/.ssh/id_rsa"
2025/04/03 01:40:41 CPU:getKeyFile returns "/home/tdunning/.ssh/id_rsa"
2025/04/03 01:40:41 CPU:getPort("nodea", "")
2025/04/03 01:40:41 CPU:config.Get("nodea",""): "22"
2025/04/03 01:40:41 CPU:returns "22"
2025/04/03 01:40:41 CPU:turning ninep off for ssh usage
2025/04/03 01:40:41 CPU:turning srvnfs on for ssh usage
2025/04/03 01:40:41 CPU:connecting to "nodea" port "22"
2025/04/03 01:40:41 CPU:client:connect: err <nil>
2025/04/03 01:40:41 CPU:client:cpu:ssh.Dial(tcp, nodea:22, {{<nil> 0 [] [] []} tdunning [0x65d9c0] 0x665740 <nil>  [] 0s}): (&{0xc00020c500 {{{} 0} {0 0}} {{0 0} []} {0 0} map[]}, <nil>)
2025/04/03 01:40:41 CPU:client:Create New OSFS @ "/" with relative mount "."
2025/04/03 01:40:41 CPU:put . in 0
2025/04/03 01:40:41 CPU:client:ssh.listener 127.0.0.1:33261
2025/04/03 01:40:41 CPU:client:listener *ssh.tcpListener &{0xc000201bc0 0xc0000c4050 0xc0000ae2a0} addr 127.0.0.1:33261 port 33261
2025/04/03 01:40:41 CPU:client:uuid is "e3495ba4-bd29-4ce8-b533-4f6d532555a8"
2025/04/03 01:40:41 CPU:nfsmount "127.0.0.1:e3495ba4-bd29-4ce8-b533-4f6d532555a8 /tmp/cpu nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,port=33261,timeo=600,retrans=2,sec=sys,mountaddr=127.0.0.1,mountvers=3,mountport=33261,mountproto=tcp,local_lock=all,addr=127.0.0.1 0 0\n" fstab "\n/tmp/cpu/lib /lib none defaults,bind 0 0\n/tmp/cpu/lib64 /lib64 none defaults,bind 0 0\n/tmp/cpu/usr /usr none defaults,bind 0 0\n/tmp/cpu/bin /bin none defaults,bind 0 0\n/tmp/cpu/etc /etc none defaults,bind 0 0\n/tmp/cpu/home /home none defaults,bind 0 0\n" join "127.0.0.1:e3495ba4-bd29-4ce8-b533-4f6d532555a8 /tmp/cpu nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,port=33261,timeo=600,retrans=2,sec=sys,mountaddr=127.0.0.1,mountvers=3,mountport=33261,mountproto=tcp,local_lock=all,addr=127.0.0.1 0 0\n/tmp/cpu/lib /lib none defaults,bind 0 0\n/tmp/cpu/lib64 /lib64 none defaults,bind 0 0\n/tmp/cpu/usr /usr none defaults,bind 0 0\n/tmp/cpu/bin /bin none defaults,bind 0 0\n/tmp/cpu/etc /etc none defaults,bind 0 0\n/tmp/cpu/home /home none defaults,bind 0 0\n" env ["SHELL=/bin/bash" "PWD=/home/tdunning/cpu" "LOGNAME=tdunning" "XDG_SESSION_TYPE=tty" "MOTD_SHOWN=pam" "HOME=/home/tdunning" "LANG=en_US.UTF-8" "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:" "SSH_CONNECTION=192.168.86.39 56532 192.168.86.14 22" "LESSCLOSE=/usr/bin/lesspipe %s %s" "XDG_SESSION_CLASS=user" "TERM=xterm-256color" "LESSOPEN=| /usr/bin/lesspipe %s" "USER=tdunning" "SHLVL=1" "XDG_SESSION_ID=912" "XDG_RUNTIME_DIR=/run/user/1000" "SSH_CLIENT=192.168.86.39 56532 22" "XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop" "PATH=/home/tdunning/julia-1.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/tdunning/go/bin:/usr/local/go/bin" "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus" "SSH_TTY=/dev/pts/0" "_=/home/tdunning/go/bin/cpu" "OLDPWD=/home/tdunning" "TMPDIR=/tmp" "CPU_FSTAB=\n/tmp/cpu/lib /lib none defaults,bind 0 0\n/tmp/cpu/lib64 /lib64 none defaults,bind 0 0\n/tmp/cpu/usr /usr none defaults,bind 0 0\n/tmp/cpu/bin /bin none defaults,bind 0 0\n/tmp/cpu/etc /etc none defaults,bind 0 0\n/tmp/cpu/home /home none defaults,bind 0 0\n" "LC_GLENDA_CPU_FSTAB=\n/tmp/cpu/lib /lib none defaults,bind 0 0\n/tmp/cpu/lib64 /lib64 none defaults,bind 0 0\n/tmp/cpu/usr /usr none defaults,bind 0 0\n/tmp/cpu/bin /bin none defaults,bind 0 0\n/tmp/cpu/etc /etc none defaults,bind 0 0\n/tmp/cpu/home /home none defaults,bind 0 0\n" "CPU_FSTAB=127.0.0.1:e3495ba4-bd29-4ce8-b533-4f6d532555a8 /tmp/cpu nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,port=33261,timeo=600,retrans=2,sec=sys,mountaddr=127.0.0.1,mountvers=3,mountport=33261,mountproto=tcp,local_lock=all,addr=127.0.0.1 0 0\n/tmp/cpu/lib /lib none defaults,bind 0 0\n/tmp/cpu/lib64 /lib64 none defaults,bind 0 0\n/tmp/cpu/usr /usr none defaults,bind 0 0\n/tmp/cpu/bin /bin none defaults,bind 0 0\n/tmp/cpu/etc /etc none defaults,bind 0 0\n/tmp/cpu/home /home none defaults,bind 0 0\n" "LC_GLENDA_CPU_FSTAB=127.0.0.1:e3495ba4-bd29-4ce8-b533-4f6d532555a8 /tmp/cpu nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,port=33261,timeo=600,retrans=2,sec=sys,mountaddr=127.0.0.1,mountvers=3,mountport=33261,mountproto=tcp,local_lock=all,addr=127.0.0.1 0 0\n/tmp/cpu/lib /lib none defaults,bind 0 0\n/tmp/cpu/lib64 /lib64 none defaults,bind 0 0\n/tmp/cpu/usr /usr none defaults,bind 0 0\n/tmp/cpu/bin /bin none defaults,bind 0 0\n/tmp/cpu/etc /etc none defaults,bind 0 0\n/tmp/cpu/home /home none defaults,bind 0 0\n"]
2025/04/03 01:40:41 CPU:start
2025/04/03 01:40:41 CPU:client:c.session.RequestPty("ansi", 51, 200, map[0x35:0x1 0x80:0x3840 0x81:0x3840]
2025/04/03 01:40:41 CPU:client:call session.Start( 'cpuns' '-env=SHELL=/bin/bash
PWD=/home/tdunning/cpu
LOGNAME=tdunning
XDG_SESSION_TYPE=tty
MOTD_SHOWN=pam
HOME=/home/tdunning
LANG=en_US.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
SSH_CONNECTION=192.168.86.39 56532 192.168.86.14 22
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_SESSION_CLASS=user
TERM=xterm-256color
LESSOPEN=| /usr/bin/lesspipe %s
USER=tdunning
SHLVL=1
XDG_SESSION_ID=912
XDG_RUNTIME_DIR=/run/user/1000
SSH_CLIENT=192.168.86.39 56532 22
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/home/tdunning/julia-1.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/tdunning/go/bin:/usr/local/go/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
SSH_TTY=/dev/pts/0
_=/home/tdunning/go/bin/cpu
OLDPWD=/home/tdunning
TMPDIR=/tmp
CPU_PWD=/home/tdunning/cpu' '/bin/bash')
2025/04/03 01:40:41 CPU:client:Setup interactive input
2025/04/03 01:40:41 CPU:wait
bash: line 25: cpuns: command not found
2025/04/03 01:40:41 CPU:close
2025/04/03 01:40:41 CPU:close done
2025/04/03 01:40:41 SSH error Process exited with status 127
 sudo PATH=$PATH /home/tdunning/cpu/bin/cpud -d -init
2025/04/03 01:39:10 CPUD:Args [/home/tdunning/cpu/bin/cpud -d -init] pid 373458 *runasinit true *remote false env [LANG=C.UTF-8 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: TERM=xterm-256color PATH=/home/tdunning/.local/bin:/home/tdunning/.juliaup/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/tdunning/cpu/bin MAIL=/var/mail/root LOGNAME=root USER=root HOME=/root SHELL=/bin/bash SUDO_COMMAND=/home/tdunning/cpu/bin/cpud -d -init SUDO_USER=tdunning SUDO_UID=1001 SUDO_GID=1001]
2025/04/03 01:39:10 CPUD:PID(373458):running as a server (a.k.a. starter of cpud's for sessions)
2025/04/03 01:39:10 CPUD:also running as init
2025/04/03 01:39:10 

  ####   #####   #    #   ##
 #    #  #    #  #    #   ##
 #       #    #  #    #   ##
 #       #####   #    #   ##
 #    #  #       #    #
  ####   #        ####    ##
2025/04/03 01:39:11 CPUD:Try to run [[/bin/sh] [/bbin/dhclient -v --retry 1000]]
2025/04/03 01:39:11 CPUD:Let's try to run [/bin/sh]
2025/04/03 01:39:11 CPUD:Run /bin/sh
2025/04/03 01:39:11 CPUD:Let's try to run [/bbin/dhclient -v --retry 1000]
2025/04/03 01:39:11 CPUD:it's not there
2025/04/03 01:39:11 CPUD:Kicked off startup jobs, now serve cpu sessions
2025/04/03 01:39:11 CPUD:server:configure SSH server
2025/04/03 01:39:11 CPUD:Server is &{:17010 0x1b85b0 [] linux arm64 <nil> <nil> 0x1b84b0 <nil> <nil> 0x1b86a0 0x1b87f0 <nil> <nil> <nil> 0s 0s map[] map[cancel-tcpip-forward:0x1b8910 tcpip-forward:0x1b8910] map[] {{} {{} {} 0} 0} {{{} {0 0}} 0 0 {{} 0} {{} 0}} map[] map[] {{} {{} {} 0} 0} <nil>}
2025/04/03 01:39:11 Listening on [::]:17010
# ls
Dockerfile  LICENSE  Makefile  README.md  TESTCPU  TESTDOCKERCPU  bin  client  cmds  configs  doc  ds  go.mod  go.sum  mount  p9cpu  server  session  sysvinit
# 
@rminnich
Copy link
Member

rminnich commented Apr 3, 2025

First, welcome!

Second, you should not need to run cpud with -init unless you are really init. If I have a board with a shell prompt, meaning it ran init, I only run cpud or cpud -d.

cpud needs to be in $PATH, and a file named key.pub has to somewhere it will find it, or you can name it something else and use the -pk switch.

the cpu command (not cpud, cpu) checks to see if it is on port 22. If so, it will try to just run a cpuns command. If you have a working ssh on the target system, it's frequently easier to install cpuns in some standard place, so:
cd u-root/cpu/cmds/cpuns
CGO_ENABLED=0 GOARCH=arm5 go build . # or other arm stuff here
scp cpuns rpi:/usr/bin # or whatever your rpi is named

My test for whether to use cpud or cpuns: If I have to run the cpud by hand, by ssh'ing in to a system, cpuns makes more sense to use. If I want to build an initramfs from scratch, with u-root, then I'll use cpud. If I have something like a milk duo s, which uses sysv-like scripts, then install the script from the cpu repo, reboot, and you have cpud and sshd.

here's an example .ssh/config for milkv galaxy or whatever they call it:
host milkv
HostName 192.168.42.1
IdentityFile ~/.ssh/cpu_rsa
User root
Port 17010

here is for an ip6 host, running cpud
Host k10
User root
HostName fe80::fcfe:feff:fe1e:319b%enx00e04c6800ee
IdentityFile ~/.ssh/cpu_rsa
Port 17010

note that 17010 is known to IANA.

sorry the help is not clearer ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants