arch-ppa
arch-ppa copied to clipboard
Can't clean directory
Building one of the AUR packages failed. I tried to arch-ppa clean which then gave error removing chroot folder with "Operation not permitted." Manually trying rm -rf as root fails to remove the folder with "Operation not permitted" error. lsattr doesn't show any attributes.
Tried rebooting, same thing.
I can't delete this folder. What sort of attributes were set?
I'm not setting any thing weird myself, but since it's building inside a container, it does require root access to delete the folder. arch-ppa does the clean with sudo. Perhaps it's an issue with your package list.
What list of packages are you using? I'll test that and see if I can reproduce. Thanks for testing!
I believe it's obnam package (one of its dependencies PKGBUILD has a bug and fails to build), but here's my complete command history that reproduces the error of not being able to cleanup
git clone https://github.com/EnigmaCurry/arch-ppa.git
cd ./arch-ppa/
./arch-ppa add obnam lxd
./arch-ppa add oxipng
./arch-ppa add chromium-pepper-flash
./arch-ppa add zabbix-agent
./arch-ppa clean myrepo
./arch-ppa build myrepo
The build fails on this package
==> Making package: python2-cliapp
<snip> some download stuff </snip>
==> Starting build()...
Traceback (most recent call last):
File "setup.py", line 21, in <module>
import cliapp
File "/build/python2-cliapp/src/python-cliapp-1.20160109/cliapp/__init__.py", line 36, in <module>
from .settings import (Settings, log_group_name, config_group_name,
File "/build/python2-cliapp/src/python-cliapp-1.20160109/cliapp/settings.py", line 24, in <module>
import yaml
ImportError: No module named yaml
Now
./arch-ppa clean myrepo
$ sudo rm -rf /home/budric/temp/arch-ppa/chroot/myrepo /home/budric/temp/arch-ppa/chroot/myrepo.lock
rm: cannot remove '/home/budric/temp/arch-ppa/chroot/myrepo': Operation not permitted
I figured it out. I'm running this on top of btrfs and some part of the process above (I don't know if it's part of the script or some other part of Arch) created subvolumes under arch-ppa/chroot. These can't be removed with rm -rf and have to be deleted with btrfs subvolume delete first.
If subvolumes were created by arch-ppa script then it's a bug. If not perhaps you can consider this as enhancement request to check for btrfs and delete chroot subvolumes before issuing rm -rf.
Interesting. Pretty sure arch-nspawn does btrfs volumes as part of its implementation, so there may have been some incompatibility with btrfs on top of btrfs.
I'm running into this issue as well. The chroots are created as BTRFS subvolumes, and 'rm -rf'ing the directory will fail since it's a mount-point that is in use, instead you need to use btrfs subvol delete. I'm by no means an expert on scripting, but I'll take a look at this tomorrow and see if I can come up with something that works, if you'd like.
On btrfs disks, the chroot is created as a subvolume, so you have to remove it by removing the subvolume with # btrfs subvolume delete $CHROOT/root
https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot#Setting_Up_A_Chroot
arch-ppa should check if this folder is also a btrfs subvolume. Something like this:
if [ $(sudo btrfs subvolume list 2>/dev/null | grep $repo) ];
then
sudo btrfs subvolume delete $basedir/chroot/$repo
else
echo "Do something else..."
fi