xo-server start on Ubuntu 20.04.2 LTS
-
Attempting to execute yarn start as a non-root user on Ubuntu 20.04 I'm seeing an issue with the losetup -D command.
yarn run v1.22.10 $ node dist/cli.mjs 2021-07-31T13:55:23.259Z xo:main INFO Configuration loaded. 2021-07-31T13:55:23.263Z xo:main INFO Web server listening on http://[::]:1024 2021-07-31T13:55:23.356Z xo:mixins:hooks WARN start failure { error: Error: Command failed with exit code 1: losetup -D losetup: /dev/loop1: detach failed: Permission denied losetup: /dev/loop4: detach failed: Permission denied losetup: /dev/loop2: detach failed: Permission denied losetup: /dev/loop0: detach failed: Permission denied losetup: /dev/loop5: detach failed: Permission denied losetup: /dev/loop3: detach failed: Permission denied at makeError (/home/kevin/xen-orchestra/node_modules/execa/lib/error.js:60:11) at handlePromise (/home/kevin/xen-orchestra/node_modules/execa/index.js:118:26) { shortMessage: 'Command failed with exit code 1: losetup -D', command: 'losetup -D', escapedCommand: 'losetup -D', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: '', stderr: 'losetup: /dev/loop1: detach failed: Permission denied\n' + 'losetup: /dev/loop4: detach failed: Permission denied\n' + 'losetup: /dev/loop2: detach failed: Permission denied\n' + 'losetup: /dev/loop0: detach failed: Permission denied\n' + 'losetup: /dev/loop5: detach failed: Permission denied\n' + 'losetup: /dev/loop3: detach failed: Permission denied', failed: true, timedOut: false, isCanceled: false, killed: false } }
And running as root (sudo from my user) starts the server, with a different warning, but I can pull up the web page.
yarn run v1.22.10 $ node dist/cli.mjs 2021-07-31T14:10:25.783Z xo:main INFO Configuration loaded. 2021-07-31T14:10:25.790Z xo:main INFO Web server listening on http://[::]:1024 2021-07-31T14:10:25.920Z xo:mixins:hooks WARN start failure { error: Error: Command failed with exit code 5: vgchange -an Logical volume ubuntu-vg/ubuntu-lv contains a filesystem in use. Can't deactivate volume group "ubuntu-vg" with 1 open logical volume(s) at makeError (/home/kevin/xen-orchestra/node_modules/execa/lib/error.js:60:11) at handlePromise (/home/kevin/xen-orchestra/node_modules/execa/index.js:118:26) { shortMessage: 'Command failed with exit code 5: vgchange -an', command: 'vgchange -an', escapedCommand: 'vgchange -an', exitCode: 5, signal: undefined, signalDescription: undefined, stdout: '', stderr: ' Logical volume ubuntu-vg/ubuntu-lv contains a filesystem in use.\n' + ` Can't deactivate volume group "ubuntu-vg" with 1 open logical volume(s)`, failed: true, timedOut: false, isCanceled: false, killed: false } } 2021-07-31T14:10:26.097Z xo:main INFO Setting up / → /home/kevin/xen-orchestra/packages/xo-web/dist
I'm not sure how to resolve this issue.
(edited to add warning when submitted as root) -
@k_hamilton this install was built from source, I should have mentioned that.
-
Have you tried to change the config to run it as non-root?
-
Yes I set usesudo=true and added the following line using visudo:
# User privilege specification root ALL=(ALL:ALL) ALL kevin ALL=(root)NOPASSWD: /bin/mount, /bin/umount
The page still fails to start as a non-root user. It seems to come up when I start it as root.
kevin@ubuntu-xoa:~/xen-orchestra/packages/xo-server$ yarn start yarn run v1.22.10 $ node dist/cli.mjs 2021-07-31T15:31:03.808Z xo:main INFO Configuration loaded. 2021-07-31T15:31:03.815Z xo:main INFO Web server listening on http://[::]:1024 2021-07-31T15:31:03.910Z xo:mixins:hooks WARN start failure { error: Error: Command failed with exit code 1: losetup -D losetup: /dev/loop1: detach failed: Permission denied losetup: /dev/loop4: detach failed: Permission denied losetup: /dev/loop2: detach failed: Permission denied losetup: /dev/loop0: detach failed: Permission denied losetup: /dev/loop5: detach failed: Permission denied losetup: /dev/loop3: detach failed: Permission denied at makeError (/home/kevin/xen-orchestra/node_modules/execa/lib/error.js:60:11) at handlePromise (/home/kevin/xen-orchestra/node_modules/execa/index.js:118:26) { shortMessage: 'Command failed with exit code 1: losetup -D', command: 'losetup -D', escapedCommand: 'losetup -D', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: '', stderr: 'losetup: /dev/loop1: detach failed: Permission denied\n' + 'losetup: /dev/loop4: detach failed: Permission denied\n' + 'losetup: /dev/loop2: detach failed: Permission denied\n' + 'losetup: /dev/loop0: detach failed: Permission denied\n' + 'losetup: /dev/loop5: detach failed: Permission denied\n' + 'losetup: /dev/loop3: detach failed: Permission denied', failed: true, timedOut: false, isCanceled: false, killed: false } }
-
You need to type
sudo
before theyarn start
command Sosudo yarn start
. -
Is there a difference between "sudo yarn start" with user=username set in the config, and executing yarn start as the ID? I was seeing similar errors either way. It seems like the ID I'm running xo-server as needs more permissions, but I'm not sure what they are.
I can't figure out why xo-server is looking in "/root/.config/xo-server" for something. Completely acceptable to me if the answer to fix this is, just delete the VM and pull in from a config backup. I realize that building from the sources is mostly unsupported
kevin@ubuntu-xoa:~/xen-orchestra/packages/xo-server$ sudo yarn start yarn run v1.22.10 $ node dist/cli.mjs 2021-07-31T18:18:13.784Z xo:main INFO Configuration loaded. 2021-07-31T18:18:13.790Z xo:main INFO Web server listening on http://[::]:1024 2021-07-31T18:18:13.791Z xo:main INFO User changed to kevin 2021-07-31T18:18:13.887Z xo:mixins:hooks WARN start failure { error: Error: Command failed with exit code 1: losetup -D losetup: /dev/loop1: detach failed: Permission denied losetup: /dev/loop4: detach failed: Permission denied losetup: /dev/loop2: detach failed: Permission denied losetup: /dev/loop0: detach failed: Permission denied losetup: /dev/loop5: detach failed: Permission denied losetup: /dev/loop3: detach failed: Permission denied at makeError (/home/kevin/xen-orchestra/node_modules/execa/lib/error.js:60:11) at handlePromise (/home/kevin/xen-orchestra/node_modules/execa/index.js:118:26) { shortMessage: 'Command failed with exit code 1: losetup -D', command: 'losetup -D', escapedCommand: 'losetup -D', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: '', stderr: 'losetup: /dev/loop1: detach failed: Permission denied\n' + 'losetup: /dev/loop4: detach failed: Permission denied\n' + 'losetup: /dev/loop2: detach failed: Permission denied\n' + 'losetup: /dev/loop0: detach failed: Permission denied\n' + 'losetup: /dev/loop5: detach failed: Permission denied\n' + 'losetup: /dev/loop3: detach failed: Permission denied', failed: true, timedOut: false, isCanceled: false, killed: false } } glob error [Error: EACCES: permission denied, scandir '/root/.config/xo-server'] { errno: -13, code: 'EACCES', syscall: 'scandir', path: '/root/.config/xo-server' } 2021-07-31T18:18:13.903Z xo:mixins:config WARN EACCES: permission denied, scandir '/root/.config/xo-server' { error: [Error: EACCES: permission denied, scandir '/root/.config/xo-server'] { errno: -13, code: 'EACCES', syscall: 'scandir', path: '/root/.config/xo-server' } }
-
Ping @julien-f
-
@k_hamilton The issue is that XO tries to store some config in
${HOME}/.config/xo-server
and the settinguser=username
does not set the home to the specified user.You can work-around this by explicitly setting the
$HOME
var when startingxo-server
. -
Apologies, I'm not sure how to do that, but it seems easier to run the server as root instead of these workarounds.