My intention is to describe a problem and its solution, since it took me a while to fix it and I didn’t find this specific problem reported anywhere.
I was in the process of upgrading my server to OpenNebula 6.8 and Debian (from 11 to 12) and had a hard time because the Sunstone server would not start and no error message was shown. The command /usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb
would just print the settings and exit with code 255.
I manually ran the command with the --debug
flag as the oneadmin
user (sudo -u oneadmin -s
and then /usr/bin/ruby --debug /usr/lib/one/sunstone/sunstone-server.rb
), and among MANY MANY lines of indentation warnings, I got this exception:
Exception `Psych::BadAlias` at /usr/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:430 - Unknown alias: provisionactions
I know nothing about Ruby, but I found this answer, which explains an incompatibility between Psych and newer Ruby versions (Ruby was upgraded to 3.1 on this server). So, I started searching the Sunstone code for YAML.xxx
calls to add , aliases: true
.
To fix the problem, I had to manually edit the file /usr/lib/one/sunstone/models/SunstoneViews.rb
and add , aliases: true
to the following YAML.load_file
call. I also wrapped it in a begin/rescue
block, so the script will print an error message if something goes wrong:
Dir[VIEWS_CONFIGURATION_DIR + mode + '/*.yaml'].each do |p_path|
reg = VIEWS_CONFIGURATION_DIR + mode + '/'
m = p_path.match(/^#{reg}(.*).yaml$/)
if m && m[1]
begin
@views[m[1]] = YAML.load_file(p_path, aliases: true)
rescue Exception => e
STDERR.puts "Error parsing config file #{p_path}: #{e.message}"
exit 1
end
end
end
This was a very frustrating experience. The Sunstone start script could simply PRINT the exceptions when they occur, and it would have saved me a lot of time trying to figure out what happened. I also checked the logs and found NOTHING. This is not a good development practice at all and I’m seriously considering replacing OpenNebula with a more stable solution.