% Error: Port is in Layer-2 mode Gi 0/xx
To prevent this issue the command
# no switchport
If the no switchport command gives the error below:
% Error: Port has Layer-2 config on it Gi 0/xx
You will need to remove the spanning tree configuration for that port with this command.
#no spanning-tree rstp edge-port
Don't forget to save the running config ;)