obsidian-execute-code icon indicating copy to clipboard operation
obsidian-execute-code copied to clipboard

running multipass shell not working

Open JCzz opened this issue 2 years ago • 8 comments

Hi

Thanks, this is a really cool plugin

Maybe Its' a stretch, but I am trying to run a shell command in multipass/ubuntu vm. Multipass: https://multipass.run

From the terminal it is possible tu run shell commands within multipass like:

multipass exec myserver -- pwd
/home/ubuntu

I was trying to add this

multipass exec myserver -- /bin/bash

to the configuration of the shell part of "execute code" plugin, but I get:

"/bin/sh: multipass: command not found!"

Do you know it it is possible, thanks again - great plugin

JCzz avatar Feb 20 '23 20:02 JCzz

are you able to run that cmd from shell?

multipass exec myserver -- /bin/bash

it seems like this error is related to multipass

hannesdelbeke avatar Feb 23 '23 20:02 hannesdelbeke

Yes, I can do something like:

multipass exec myserver -- pwd
/home/ubuntu

Do you know if it is possible to do a ssh shell ?

JCzz avatar Feb 23 '23 20:02 JCzz

but in this command, you didn't set pwd. could this typo be it perhaps?

multipass exec myserver -- /bin/bash

hannesdelbeke avatar Feb 23 '23 20:02 hannesdelbeke

I was wondering it it would start a bash shell in Obsidian that could be used.

But this it quite a feature stretch, I was/am just curious to see it is possible.

I am curious as I am presenting shell code on different plafroms WSL on Windows and Terminal on MacOs, then I thought maybe I can use Multipass/Ubuntu as the a common VM. Even a Docker container shell would work.

Well, this is still so nice to use, for showing and execute code :-)

JCzz avatar Feb 23 '23 21:02 JCzz

Let me know if you have any idea, or if not possible - then I will close this one.

Thanks!

JCzz avatar Feb 23 '23 21:02 JCzz

Hi @JCzz I am unsure how multipass works exactly. Is it another kind of shell (like zsh etc)? Or is it a normal program that is executed within a shell?

twibiral avatar Feb 24 '23 00:02 twibiral

Hi @twibiral It is more like you would ssh into a shell.

Multipass is a vm manager for quickly spin-up Ubuntu vms. Instead of using multipass cli you could also ssh into the vm.

Again I am sure this is a stretch, but maybe ssh could be a thing to look at ;-)

JCzz avatar Feb 24 '23 00:02 JCzz

I just solved a similar issue while I was getting my own environment sorted, run env in your main terminal and within Obsidian, I'll bet that your environment vars aren't being imported correctly.

Check the PATH that is being set in obsidian shell - in my case I went into settings and added the following to get it to use my regular bash configuration:

source ~/.bash_profile
cd ~

I've customized my terminal with a custom bash profile, so you might need to use ~/.bashrc or other, like your regular terminal does.

grepler avatar Apr 23 '23 22:04 grepler