# repopulate /dev/disk/by-uuid with device mapper devices?

## tholin

I have a program that needs to read the uuids links from /dev/disk/by-uuid but they don't exists on my system.

The problem is caused by cryptsetup and my initramfs. All disks except for the bootdisk use full disk encryption. I boot into my own initramfs with devtmpfs for /dev and setup the crypto mappings there. Then I mount the real root, unmount /dev and switch_root to the real root. The real init will start udev but at that point the crypto mappings has already been setup and udev will not populate /dev/disk/by-uuid.

If I manually mount an encrypted filesystem after boot it will appear in /dev/disk/by-uuid. That's because cryptsetup will send some signal to udev informing it about the change. I can't figure out how to trigger this manually without remounting all filesystems.

"dmsetup mknodes" will recreate the files in /dev/mapper but not /dev/disk/by-uuid. I've also tried "udevadm trigger" but that doesn't work either.

----------

## tholin

Neither of these commands works even though they should.

udevadm trigger --verbose --subsystem-match=block --sysname-match=dm-* --action=add

udevadm trigger --verbose --subsystem-match=block --sysname-match=dm-* --action=change

Running udevadm info /dev/dm-5 shows that the flag DM_UDEV_DISABLE_DISK_RULES_FLAG is set and that cause udev to skip all rules in /lib/udev/rules.d/13-dm-disk.rules including the one that setup the /dev/disk/by-uuid/ links. So why is DM_UDEV_DISABLE_DISK_RULES_FLAG set? I don't know. It's set in 10-dm.rules but all these udev rule files are nothing but global variables & goto spaghetti code mess.

I feel tempted to just create a script to get the uuids with blkid and create the links myself.

----------

## khayyam

 *tholin wrote:*   

> I feel tempted to just create a script to get the uuids with blkid and create the links myself.

 

tholin ... you might want to look at mdev-like-a-boss, it has a 'storage-device' script which could be adapted for this purpose. 

HTH & best ... khay

----------

