This question is related to this: apt-mirror: can't create /dir:/mirror directory at /usr/bin/apt-mirror line 342 But the answer there did not help, because the setup is a bit different.
I need to run apt-mirror to store onto an external USB HDD, NTFS formatted. Running apt-mirror runs into the same error as user Miphix in his post.
As given in the man page I am used
su - apt-mirror -c apt-mirror
and get this error
apt-mirror: can't create /media/usb/apt-mirror/mirror directory at /usr/bin/apt-mirror line 342
which is cause by trying to create a directory where there is a directory already.
The answer to run apt mirror as user apt-mirror does not work on an USB HDD with NFTS, because after mounting the drive chown apt-mirror:apt-mirror {dir}
does nothing. This is according to Cannot chmode and chown on a ntfs usb drive, because on external USB drives with NTFS there is only a default ownership.I tried changing the mount directory, but it was converted to root:root after the mount.
Since a new download would be 130GB and would take several days, I need to use the existing repostory and just do an update. Also I can not copy it to the local hard drive, because not enough space.
Any ideas?
Hopefully not the best and final one, but I found a way to get it working.
I added the NTFS USB drive via /etc/fstab, recycling the options from a smb mount. The line looked like this
With this, apt-mirror did start without complaining. Maybe all the options are not really required (I did not further testing) but it did work.
It looks things can turn out to be rather trivial. I now seems to work.
The answer is very close to the linked post above apt-mirror: can't create /dir:/mirror directory at /usr/bin/apt-mirror line 342, but not exactly the same.
In case of an NTFS drive, the permission system does not work. (I guess) Linux sets some workaround that allows the local user to access the drive, despite most files there being owned by root (this is quite interesting, but another story. Should someone have background on this, please put a link into the comments). Thus the solution is most trivial: run apt-mirror without anything.
To copy paste here is a full example procedure to use an external USB HDD at /dev/sdb with apt-mirrror (do not type the comments after (an including) '//'):
The '$' is the prompt. It marks the lines with commands, other lines are screen output
The important change from the other post above is
Which runs apt-mirror as the normal unprivileged user. I think the statements both in the apt-mirror help file and the wiki are misleading. At least in my case they did not work. Done.