Monday, July 8, 2024

Rsync and the Trailing or Omitted Slash

I learned this recently, and it can be a real headache if one isn't aware of it. Rsync copies source FILES into the destination when a trailing slash is used on source. It copies source FOLDER and FILES into destination when trailing slash is OMITTED.

So...

rsync -avh /home/bobby/Documents/ bobby@192.168.0.10:/mnt/300gb/

results in all the files and subdirectories of /home/bobby/Documents/ being copied to /mnt/300gb/.


But if you omit the trailing slash on the source, like this

rsync -avh /home/bobby/Documents bobby@192.168.0.10:/mnt/300gb/

you get all the files and subdirectories of /home/bobby/Documents being copied to /mnt/300gb/Documents/.

REMEMBER THIS.

HOW TO Install Pkgs in Embedded XigmaNAS (FreeBSD) System

 I found this useful information and wanted to pass it along. I haven't tried it yet, but I may need to in the future. I almost needed to use this to get apcupsd installed on embedded XigmaNAS, but instead opted to write a command script (to be run post-init via System/Advanced/Command Scripts) that copies the necessary apcupsd files from a local mount point to their normal locations (/usr/sbin/ along with the directory with most of the files /usr/local/etc/apcupsd/ at every boot. Embedded installations run from RAM to limit writes to the USB stick, so any pkgs that are installed do not persist beyond reboot.

jamaroney
Advanced User
Advanced User
Posts: 176
Joined: Dec 13th, '20, 02:55
Status: Offline

[HOW TO] Install pkgs in an embedded install

#1

Post by jamaroney »

You can install and run pkgs in an embedded install via unionfs_mount. I have done this for close to 10 years without any problems whatsoever. No jails or VM, and it's quick and easy to set up.

INSTRUCTIONS:
  • Choose one of your data discs (NOT system disc). Mine is /mnt/HDD.
  • Enter the following commands (change the name "extensions" to whatever you choose):

Code: Select all

cd /mnt/HDD
mkdir extensions
mkdir extensions/usr
mkdir extensions/usr/local
mkdir extensions/var
mkdir extensions/var/db
mkdir extensions/var/db/pkg
mkdir extensions/var/cache
mkdir extensions/var/cache/pkg
  • Then go to "Command Scripts" and add the following commands in this order (all PostInit and usually the first commands). They're all important!

Code: Select all

rsync -a /usr/local/ /mnt/HDD/extensions/usr/local/ 
mount_unionfs -o rw /mnt/HDD/extensions/usr/local/ /usr/local/
mount_unionfs -o rw /mnt/HDD/extensions/var/db/pkg /var/db/pkg
mkdir /var/cache && mkdir /var/cache/pkg
mount_unionfs -o rw /mnt/HDD/extensions/var/cache/pkg /var/cache/pkg
  • Of course, you should modify the above commands to reflect the name of your selected data disc and the name you choose for your primary directory (in my case /extensions)
  • Reboot XNAS
You should now be able to add (and later upgrade) all desired pkgs, and they will remain and operate the same as if you did a full install.

>>>>>>>>>>>>>>>>>>>>>

You might hear of the so-called "dangers" of unionfs_mount - THEY DON'T APPLY TO AN EMBEDDED INSTALL, which by its very nature makes it impossible to screw up your system. Should there ever be any problem installing a package(and I've never experienced any), all one has to do is disable the command script items and reboot for a "clean" install.
Last edited by jamaroney on May 10th, '24, 04:05, edited 2 times in total.
gerdpeter
New User
New User
Posts: 1
Joined: Jul 13th, '23, 03:39
Status: Offline

Re: [HOW TO] Install pkgs in an embedded install

#2

Post by gerdpeter »

Hi jamaroney,

thank you for this relay helpful information
I'm new with XigmaNAS.
for example, I will install wireguard and as second part zrep for remote Snapshots (Backups) with your setup.
can I use the default FreeBSD commands for installing package "pkg install <package>" an not the: "pkg_add -r <package>" command?
And can you tell me the path, where the config files are, I have to editing for persistent changes?
Or in other words: where are the used .../etc/ directory in which I can editing
For one more example: where, on which path I can editing the sshd_config file on command line for persistent changes after a reboot?

regards,
gerdpeter
User avatar
raulfg3
Site Admin
Site Admin
Posts: 917
Joined: Dec 13th, '20, 00:15
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: [HOW TO] Install pkgs in an embedded install

#3

Post by raulfg3 »

gerdpeter wrote: Jul 13th, '23, 03:53 Hi jamaroney,

thank you for this relay helpful information
I'm new with XigmaNAS.
for example, I will install wireguard and as second part zrep for remote Snapshots (Backups) with your setup.
can I use the default FreeBSD commands for installing package "pkg install <package>" an not the: "pkg_add -r <package>" command?
And can you tell me the path, where the config files are, I have to editing for persistent changes?
Or in other words: where are the used .../etc/ directory in which I can editing
For one more example: where, on which path I can editing the sshd_config file on command line for persistent changes after a reboot?

regards,
gerdpeter
please do a full install instead, and you have no problem to install packages .

And remember, some packages can broke your XigmaNAS install, so prefeed way is to install on a jail.
XigmaNAS 12.3.0.4.8919 (ZFSonRoot) on Intel(R) Xeon(R) CPU L5640 @ 2.27GHz 36GB of ECC RAM, 12x3TB disk in 1 vdev = Vpool = 36TB Raw size , so 29TB usable size (I Have other NAS as Backup)

Wiki
Last changes
HP T510
jamaroney
Advanced User
Advanced User
Posts: 176
Joined: Dec 13th, '20, 02:55
Status: Offline

Re: [HOW TO] Install pkgs in an embedded install

#4

Post by jamaroney »

I'll repeat myself yet again for the disbelievers and others who simply WANT me to be wrong:

I HAVE DONE THIS FOR CLOSE TO 10 YEARS WITHOUT ANY PROBLEMS WHATSOEVER.

and

Should there ever be any problems (and I've never experienced ANY), all one has to do is disable the command script items and reboot for a "clean" install.
All packages previously installed will remain intact on the data drive, but simply not started, so no data or configs are lost.
Last edited by jamaroney on Jul 14th, '23, 06:43, edited 7 times in total.
jamaroney
Advanced User
Advanced User
Posts: 176
Joined: Dec 13th, '20, 02:55
Status: Offline

Re: [HOW TO] Install pkgs in an embedded install

#5

Post by jamaroney »

Can I use the default FreeBSD commands for installing package "pkg install <package>" an not the: "pkg_add -r <package>" command?
YES - do the install exactly as in a full install.

And can you tell me the path, where the config files are, I have to editing for persistent changes?
Your config files are in the same place as a full install. But in an embedded install, the unionfs_mount to another drive keeps them persistent.
benoliver999
New User
New User
Posts: 1
Joined: Sep 15th, '23, 03:06
Status: Offline

Re: [HOW TO] Install pkgs in an embedded install

#6

Post by benoliver999 »

I am using this method with some success, thanks for the guide! I'm pretty hands-off with the server and was going round in circles trying to set up jails.

One thing: I'm trying to install mkvtoolnix to remux some discs I've ripped. It works fine, but doesn't survive a reboot. I get

Code: Select all

Shared object "libQt5Core.so.5" not found, required by "mkvmerge"
Do you have any idea what could be causing this?
jamaroney
Advanced User
Advanced User
Posts: 176
Joined: Dec 13th, '20, 02:55
Status: Offline

Re: [HOW TO] Install pkgs in an embedded install

#7

Post by jamaroney »

My guess is that the pkg install is creating the file somewhere other than /usr/local/, which is why it isn't surviving reboot. But I've installed many packages, and have never encountered this before.

If you're able to get mkvtoolnix running again, do a search for "libQt5Core.so.5" to find where it's located.
jamaroney
Advanced User
Advanced User
Posts: 176
Joined: Dec 13th, '20, 02:55
Status: Offline

Re: [HOW TO] Install pkgs in an embedded install

#8

Post by jamaroney »

To test things, I installed the pkg mkvtoolnix (and its many dependencies), and "libQt5Core.so.5" is right where it should be, in folder /usr/local/lib/Qt5/, so unless there's a script within mkvtoolnix telling it to do funky things to such files, there's no reason it wouldn't survive a reboot.

Please verify that the file is there - if so, then your problem lies elsewhere, and not in the fact that it's an embedded install.