Fixing “No active dataset” on zone attach

0 Flares 0 Flares ×

When moving zones between OpenIndiana (and OpenSolaris) hosts, you can often end up with the following dreaded error:

1
2
3
4
# zoneadm -z zonename attach -U
Log File: /var/tmp/zonename.attach_log.B8aWed
ERROR: no active dataset.
                    Result: Attach Failed.

This can happen for a variety of reasons, such as not detaching the zone before moving it, and not transferring the ZFS properties with the zone. But personally I blame the half-arsed zone attach scripts that could do with some work.

To get around it, here is a super-quick/dirty script that should allow the zone to attach:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
 
zfsfs=$1
root=${zfsfs}/ROOT
zbe=${root}/zbe
 
for i in $zbe $root $zfsfs ; do
  for j in zoned mountpoint ; do
    zfs inherit $j $i
  done
done
 
zfs set mountpoint=legacy $root
zfs set zoned=on $root
zfs set canmount=noauto $zbe
zfs set org.opensolaris.libbe:active=on $zbe
 
rbe=`zfs list -H -o name /`
uuid=`zfs get -H -o value org.opensolaris.libbe:uuid $rbe`
 
zfs set org.opensolaris.libbe:parentbe=$uuid $zbe

The script takes one argument, the zfs filesystem the zone lives in (the parent of “ROOT” for the zone). Ignore any errors about "dataset is used in a non-global zone", and once it has run, manually mount the dataset and attach it with:

1
2
mount -F zfs dataset/ROOT/zbe /zones/zonename/root
zoneadm -z zonename attach

This guide is pretty rough but should hopefully set people in roughly the right direction.

0 Flares Twitter 0 Facebook 0 Google+ 0 Reddit 0 LinkedIn 0 StumbleUpon 0 Email -- 0 Flares ×

Tags: , , , , , , , ,

4 Responses to “Fixing “No active dataset” on zone attach”

  1. Jens says:

    Thank you very much! This saved my day

  2. estibi says:

    In my case this one was missing:

    # zfs set org.opensolaris.libbe:active=on ${ZONE_BE_ZFS}

  3. Ron says:

    Thanks Alasdair. You just saved my butt. I copied a zone from my home machine to my work machine this morning. Got into the office and couldn’t attach it.

  4. Richard says:

    Hi

    you saved my life !!!
    this is a great script.
    Better in depth knowledge than I and our supporter could find on Oracles pages.

    This is such a simple but EFFECTIVE Script.

    Thank you !!!

    Richard G.

Leave a Reply

Back to top