RPi NFS mount rsync errors

Hi guys, I’ve been pulling my hair out all night over this so I think I need help. I’m trying to network boot a raspberry pi whose SD card just died. Following Wendell’s guide as well as using some of the resources linked in that.

I’m running Ubuntu Server 21.10 on the pi and TrueNAS SCALE is handling the NFS and TFTP servers.

I’m having some permission issues though when I try to rsync my root directory to /nfs/root. I’m able to rsync my TFTP boot folder just fine though. I’ve put a few examples below.

rsync: [generator] recv_generator: mkdir "/nfs/root/var/tmp" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***

rsync: [generator] symlink "/nfs/root/var/run" -> "/run" failed: Permission denied (13)

rsync: [generator] failed to set times on "/nfs/root/var": Operation not permitted (1)

rsync: [receiver] mkstemp "/nfs/root/tmp/.tmp.faHNAoNyHa.3BXfdN" failed: Permission denied (13)

When mounting my NFS shares I’m using the following (UID and GID changed to match the Pi):

sudo mount -t nfs -O proto=tcp,port=2049,rw,all_squash,anonuid=1000,anongid=1003 192.168.1.181:/mnt/Storage/nfs/rpi-pxe/rpi2 /nfs/root -vvv

And for rsync, I’m using:

sudo rsync -xav --progress --exclude /nfs / /nfs/root

I’ve also tried dropping the sudo as I’ve read that might cause ID issues, but I get the same or very similar errors. It seems to handle all the /* directories just fine, but it can’t then go and create anything else inside them (either directories or files). I suspect this has something to do with recursive permissions, but I’d rather not set everything to 777 to fix it.

Does anyone have any ideas as to what’s going on here? What have I done wrong?

Cheers!

I’m not exactly sure how the RPi NFS mount goes in Wendell’s wiki, but have you tried mounting the nfs without giving it a uid and gid? That’s the only thing that I can think of that may prevent you from properly writing stuff to it.

Yeah, that was my initial tactic thinking that it wasn’t too important to specify. I actually added the uid and gid in an attempt to fix this problem. It doesn’t seem to have changed anything though.

Actually, I should probably link that wiki of Wendell’s.

Ok, I’ve seen the step. Maybe just try to not use the nfs mount and rsync via ssh instead. Something like:

rsync -xas --progress --exclude /nfs / [email protected]:/mnt/Storage/nfs/rpi-pxe/rpi2/

I don’t get why rsyncing to the nfs mount point doesn’t work, but you only want the end result, so just do this instead.

Didn’t even know you could rsync via ssh. That’s awesome! This is the sort of stuff that makes me wish I could get away from Windows on my desktop.
Anyway, seems to work better. Though I just did a diff and there are quite a few files that didn’t copy like the entirety of /dev. Just had to copy those missing directories separately for some reason. Thanks for the help though! Hopefully that’s the last roadblock to deal with.

Do not copy /dev, /proc and /sys. You may create those directories at the target, but ignore those folders. Those only show up once the system boots up, those do not need to be backed up.