└» systemd-cgls
That's the point : I do not see any machine.slice in the tree :-( gabx@hortensia ➤➤ ~aur/libvirt-git % systemctl status libvirt-guests.service libvirt-guests.service - Suspend Active Libvirt Guests Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service; enabled) Active: active (exited) since Sat 2014-02-15 23:40:12 CET; 1h 22min ago Docs: man:libvirtd(8) http://libvirt.org Process: 748 ExecStart=/usr/lib/libvirt/libvirt-guests.sh start (code=exited, status=0/SUCCESS) Main PID: 748 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/libvirt-guests.service<<<<<< WHERE ARE THEY ?
gabx@hortensia ➤➤ ~aur/libvirt-git % ls -al /sys/fs/cgroup total 0 drwxr-xr-x 10 root root 240 Feb 15 23:39 ./ drwxr-xr-x 7 root root 0 Feb 15 23:39 ../ drwxr-xr-x 3 root root 0 Feb 15 23:39 blkio/ drwxr-xr-x 3 root root 0 Feb 15 23:39 cpu,cpuacct/ drwxr-xr-x 3 root root 0 Feb 15 23:39 cpuset/ drwxr-xr-x 3 root root 0 Feb 15 23:39 devices/ drwxr-xr-x 3 root root 0 Feb 15 23:39 freezer/ drwxr-xr-x 3 root root 0 Feb 15 23:39 memory/ drwxr-xr-x 3 root root 0 Feb 15 23:39 net_cls/ drwxr-xr-x 4 root root 0 Feb 15 23:39 systemd/ lrwxrwxrwx 1 root root 11 Feb 15 23:39 cpu -> cpu,cpuacct/ lrwxrwxrwx 1 root root 11 Feb 15 23:39 cpuacct -> cpu,cpuacct/ Do you have anything more inside this dir ? I can not find machine.slice I think I must have a closer look at my systemd setup. Can you tell em yours ?
-----snip---- #!/bin/bash LXC_VM=$1 ID_OFFSET=$2 LXC_BASEDIR=/var/lib/lxc
if [[ ! -d "${LXC_BASEDIR}/${LXC_VM}/rootfs" ]]; then echo "ERROR: ${LXC_BASEDIR}/${LXC_VM}/rootfs does not exist" exit 1 fi
cd ${LXC_BASEDIR}/${LXC_VM}
echo "Changing directories" for dir in `find rootfs -type d`; do old_uid=`ls -nd ${dir}|awk '{print $3}'` old_gid=`ls -nd ${dir}|awk '{print $4}'` new_uid=$[${old_uid} + ${ID_OFFSET}] new_gid=$[${old_gid} + ${ID_OFFSET}] chown ${new_uid}:${new_gid} ${dir} done echo "Changing files" for file in `find rootfs -type f`; do old_uid=`ls -nd ${file}|awk '{print $3}'` old_gid=`ls -nd ${file}|awk '{print $4}'` new_uid=$[${old_uid} + ${ID_OFFSET}] new_gid=$[${old_gid} + ${ID_OFFSET}] chown ${new_uid}:${new_gid} ${file} done ----snap----
Disclaimer: separating dirs and files has no real reason here. Needs to run as root. May kill your cat etc..
TY for the script. I understand the UID and GID principles, but I had no idea how to map all this.