Comment 4 for bug 1060404

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

After talking to cjwatson on irc, there is another option. update-grub is failing because /dev/disk/ is not set up in the container. So we could add an upstart job which runs only in containers, and manually sets up /dev/disk/. This also might help other software which relies on /dev/disk/. However, as grub is not installed in ubuntu containers by default (but is installed in ubuntu-cloud containers) we can't blindly re-use grub-probe. If we use grub-probe only if it is available, then we are helping fewer cases. If we detect the root device by hand, I fear we are duplicating too much fragile code.

Perhaps the best option is simply an upstart job like the below (but smarter and safer):

start on starting mountall
task
script
  type grub-probe > /dev/null 2>&1 || { exit 0; stop; }
  mkdir -p /dev/disk/by-label /dev/disk/by-uuid
  rootdev=`grub-probe -t device /`
  do_mknod /dev/rootdev
  rootlabel=`grub-probe -t fs_label /`
  ln -s ../../$rootdev /dev/disk/by-label/$rootlabel
  rootuuid=`grub-probe -t fs_uuid /`
  ln -s ../../$rootdev /dev/disk/by-uuid/$rootuuid
end script