0

I'm trying to update multiple arch distros over LAN according to arch wiki. In provided solution hard links are created to *.db files to /var/cache/pacman/pkg and this folder is what the web-server serves to LAN machines.

Problem is *.db files get updated but hard links date don't.

ls -alh /var/lib/pacman/sync/

total 39M
drwxr-xr-x 2 root root 4.0K Aug 20 23:12 .
drwxr-xr-x 4 root root 4.0K Aug 20 23:12 ..
-rw-r--r-- 1 root root 5.2M Aug 20 21:53 community.db
-rw-r--r-- 1 root root  22M Aug 16 23:32 community.files
-rw-r--r-- 1 root root 131K Aug 20 09:20 core.db
-rw-r--r-- 1 root root 885K Aug 15 07:20 core.files
-rw-r--r-- 1 root root 1.7M Aug 20 20:03 extra.db
-rw-r--r-- 1 root root 9.1M Aug 16 13:09 extra.files

and here is the served directory by web-server:

ls -alh /var/cache/pacman/pkg/*.db

-rw-r--r-- 1 root root 5.2M Aug 19 11:18 /var/cache/pacman/pkg/community.db
-rw-r--r-- 1 root root 132K Aug 19 11:15 /var/cache/pacman/pkg/core.db
-rw-r--r-- 1 root root 1.7M Aug 19 11:17 /var/cache/pacman/pkg/extra.db

While on Aug 20 pacman databases have been updated, hard links date info refers to yesterday (date of creation of hard links and it is not gonna change) and this causes other machines to see there is no new update. If other machines update their pacman databases online (but don't install them) then they can update over LAN.

One solution is making a script to update date info, but I was curious if there is a way to inherit file date info directly in a link. What are my best options?

UPDATE

inode info:

ls -li /var/lib/pacman/sync/*.db

4718985 -rw-r--r-- 1 root root 5373751 Aug 20 21:53 /var/lib/pacman/sync/community.db
4719401 -rw-r--r-- 1 root root  134110 Aug 20 09:20 /var/lib/pacman/sync/core.db
4720712 -rw-r--r-- 1 root root 1703986 Aug 20 20:03 /var/lib/pacman/sync/extra.db


ls -li /var/cache/pacman/pkg/*.db

4719500 -rw-r--r-- 1 root root 5372789 Aug 19 11:18 /var/cache/pacman/pkg/community.db
4720207 -rw-r--r-- 1 root root  135051 Aug 19 11:15 /var/cache/pacman/pkg/core.db
4718949 -rw-r--r-- 1 root root 1703685 Aug 19 11:17 /var/cache/pacman/pkg/extra.db

How that happened?!

5
  • Hard links get the date from inode table. Can you check the inode number for the two files so that they are the same?
    – unxnut
    Aug 20, 2020 at 19:55
  • 1
    Check the inode of your *.db files before AND after an update, with ls -i *.db or stat --format="%i %n" *.db. If the update regenerates the *.db files, this will break the hsrd link. IDK could you use soft links?
    – waltinator
    Aug 20, 2020 at 20:13
  • inode numbers are all different. These are not hard links. You've simply copied the files. Aug 20, 2020 at 20:23
  • @ArtemS.Tashkinov: I'm sure they were made using ln. According to @waltinator updating db files changed inodes.
    – Xaqron
    Aug 20, 2020 at 20:26
  • I can only think of file rotation as a means of breaking hard links as simply writing to these files wouldn't have unlinked them. Some of your scripts have done that. Aug 20, 2020 at 20:28

1 Answer 1

2

Problem is *.db files get updated but hard links date don't.

Either you don't have hard links or you have some sort of caching. Hard links in Unix OS'es are file names (not even files) which point to the same inode, i.e. they share everything, permissions, times, etc.

Please run

ls -li /var/lib/pacman/sync/*.db /var/cache/pacman/pkg/*.db

and check that the files in question have the same inode numbers.

2
  • You are right. Question updated.
    – Xaqron
    Aug 20, 2020 at 20:14
  • I had make a Clonezilla image and restore it from this partition. I guess that's how inodes are changed.
    – Xaqron
    Aug 20, 2020 at 20:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .