Skip to content
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

could not find kernel #87

Closed
dezren39 opened this issue Sep 23, 2024 · 4 comments
Closed

could not find kernel #87

dezren39 opened this issue Sep 23, 2024 · 4 comments
Labels
question Further information is requested

Comments

@dezren39
Copy link

[nix-shell:~/gokrazy/router7]$ rtr7-recover     --boot /tmp/recovery/boot.img     --mbr /tmp/recovery/mbr.img     --root /tmp/recovery/root.img --hostname router7
2024/09/22 10:01:27 client will use IP address 192.168.68.1 during recovery
2024/09/22 10:01:27 could not find kernel: [go list -f {{ .Dir }} github.com/rtr7/kernel]: exit status 1

hi! i'll start by saying that i'm using nixos so my problem is probably related to that.

getting libusb working took a little bit, but i overcame that and hit a problem i'm unsure how to solve --

could not find kernel: [go list -f {{ .Dir }} github.com/rtr7/kernel]

i also had to add --hostname and tried both the router7 name and my own hostname, unsure exactly what that flag is for, but it seems it's required. i'd update the documentation but would like to get it working and understand better how to use it. :-)

@stapelberg
Copy link
Contributor

Can you share what you have done previously? Have you built your ~/gokrazy/router7 instance successfully (using gok overwrite --root /tmp/root.squashfs for example)? I’m asking because that should ensure the github.com/rtr7/kernel package was downloaded into your Go module cache and should be discoverable with go list.

i also had to add --hostname and tried both the router7 name and my own hostname, unsure exactly what that flag is for, but it seems it's required.

The partition UUID is derived from the hostname, so if you have multiple tools related to the gokrazy build process, they all must use the same hostname. The description of the hostname flag tries to explain that:

hostname = flag.String("hostname", "", "hostname for the device, required for deriving the partition UUID")

Ideally, we’d update the rtr7-recover tool to understand the gokrazy instance config, which was introduced after router7 was built. But, for now, we don’t have a flag for the instance, just one for the hostname directly.

Anyway, to make things short: the -hostname flag needs to match the Hostname: field in your config.json. Based on your directory path, likely -hostname=router7 is what you need.

@stapelberg stapelberg added the question Further information is requested label Sep 23, 2024
@dezren39
Copy link
Author

thank you so much! I will look into this. i thought the hostname thing might be related to instance config but i wasn't sure. i don't have that session open anymore but i can confirm i had successfully run

GOARCH=amd64 gok -i router7 overwrite \
    --boot /tmp/recovery/boot.img \
	--mbr /tmp/recovery/mbr.img \
	--root /tmp/recovery/root.img

and the .img files landed in the /tmp/recovery folder

@dezren39
Copy link
Author

ok so i'm not sure the reason why but rerunning all the steps using root user and manually going to the kernel directory with the mod file fixed my issues

2024/09/23 16:15:15 client will use IP address 192.168.1.1 during recovery
2024/09/23 16:15:15 building github.com/rtr7/tools/cmd/rtr7-recovery-init in /root/go/pkg/mod/github.com/rtr7/[email protected]/cmd/rtr7-recover
2024/09/23 16:15:17 not resetting, no Teensy rebootor found
2024/09/23 16:15:17 serving TFTP, HTTP, DHCP (for PXE clients) on 192.168.1.116 (wlp166s0)

lightly cleaned up script of basically what worked for me

sudo su
nix-shell -p libusb1 go pkg-config
go install github.com/gokrazy/tools/cmd/gok@main
go install github.com/rtr7/tools/cmd/...@latest
mkdir -p /tmp/recovery
home=$HOME
alias gok=$home/go/bin/gok
alias rtr7-recover=$home/go/bin/rtr7-recover
alias rtr7-recovery-init=$home/go/bin/rtr7-recovery-init
alias rtr7-safe-update=$home/go/bin/rtr7-safe-update
gok -i router7 new
gok -i router7 edit
read -n 1 -s # do editing stuff
GOARCH=amd64 gok -i router7 overwrite --boot /tmp/recovery/boot.img --mbr /tmp/recovery/mbr.img --root /tmp/recovery/root.img
cd ~/gokrazy/router7/builddir/github.com/rtr7/kernel/
rtr7-recover --boot /tmp/recovery/boot.img --mbr /tmp/recovery/mbr.img --root /tmp/recovery/root.img --hostname router7

@stapelberg
Copy link
Contributor

ok so i'm not sure the reason why but rerunning all the steps using root user and manually going to the kernel directory with the mod file fixed my issues

Weird! But thanks for reporting back. If you run into this again, feel free to reopen. I’ll close this issue for now, but as I mentioned, we should eventually move from --hostname to --instance for consistency with other gokrazy tools.

@stapelberg stapelberg closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants