[SOLVED] Converting a libvirt container: pct create did not map the UIDs

Sep 13, 2022
69
9
8
EDIT: I did not pass option --unprivileged 1 to pct create and that's why UID mapping did not happen.
@moderator: I did not delete this to keep it searchable in case someone else makes the same mistake, if its better to delete please remove this posting to avoid noise, whatever you think is better.

Hi,

I'm converting a libvirt / VirtManager / virsh VM to Proxmox. I read that I should tar the content and use pct create, so I did:

Code:
root@oldhost: time tar --warning='no-file-ignored' -czf ./node1-2022-12-26-SNAP.tar.gz -C /var/lib/libvirt/filesystems/node1/ .
root@pve: pct create 202 ./node1-2022-12-26-SNAP.tar.gz --description node1 --hostname node1 --memory 1024 --onboot 1 --ignore-unpack-errors 1 --ostype debian --storage local-zfs
pct start 202 --debug

but it did not boot. So I attached a shell lxc-attach -n 202 and noticed I cannot write anywhere.
I noticed on pve:
Code:
ls -dl /rpool/data/subvol-202-disk-0/var/log
drwxr-xr-x 6 root root 74 Dec 25 00:00 /rpool/data/subvol-202-disk-0/var/log
another CT has a UID mapping on the files:
Code:
ls -dl /rpool/data/subvol-100-disk-0/var/log
drwxr-xr-x 6 100000 100000 18 Dec 26 17:49 /rpool/data/subvol-100-disk-0/var/log
Shouldn't pct create perform the UID mapping automatically?

EDIT: Yes, --unprivileged 1 is needed as command line option.


Can I do it manuall afterwards? I cannot use simply chown, because not all files belong to root (it's a Debian as container inside).

EDIT: ps: because I first forgot using -C /var/lib/libvirt/filesystems/ I had this path included in the TAR and got an error in pct create.
 
Last edited:
I did not add --unprivileged 1 and no mapping was done. Then I changed the config /etc/pve/nodes/csdpve/lxc/202.conf to match my test machine config (mostly mountpoints) but also copied option unprivileged: 1 and thus caused the problem.
BTW, I also set features: nesting=1 because I saw the error also described here:
Code:
Dec 26 21:47:32 node1 vi: *** err
Dec 26 21:47:32 node1 vi: unable to open gpm console, check your /dev filesystem!
Dec 26 21:47:32 node1 vi: *** err
Dec 26 21:47:32 node1 vi: Oh, oh, it's an error! possibly I die!
but then found it was caused by using lxc-attach -n 202 which allocates the terminal differently than I do normally when using SSH (when I used SSH, the message went away).
It took me too much time to find, so I state it here in case it helps someone else.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!