Fixed.
Commented out /usr/share/foreman/app/models/role.rb:335
def permission_records(permissions)
perms = permissions.flatten
collection = Permission.where(:name => perms).all
#if collection.size != perms.size
# raise ::Foreman::PermissionMissingException.new(N_("some permissions were not found: %s"),
# not_found_permissions(collection.pluck(:name), perms))
#end
collection
end
after ran foreman-installer and it was successful
and then upgraded to version 3.1.0 without errors