linsk icon indicating copy to clipboard operation
linsk copied to clipboard

linsk shell to access the filesystem?

Open emanuele opened this issue 1 year ago • 5 comments

Is it possible to use linsk shell to access the Linux filesystem mounted via linsk? How?

emanuele avatar Dec 08 '24 17:12 emanuele

Yes. Use linsk run --debug-shell.

AlexSSD7 avatar Dec 08 '24 20:12 AlexSSD7

Great, exactly what I needed! Thanks a lot @AlexSSD7 !

A follow-up question. Once in the shell, I installed vim via apk add vim, which worked well. But at the next use of linsk run --debug-shell ..., vim was not there anymore. Is apk add ... installation not persistent?

emanuele avatar Dec 15 '24 11:12 emanuele

It is not. Every VM is created in an ad-hoc manner, being an inherent feature of Linsk. If you wish to add packages permanently, add desired package names to this line of code and rebuild the VM image.

AlexSSD7 avatar Dec 15 '24 12:12 AlexSSD7

Understood. Thanks.

Besides using linsk (which is great!), I am playing with qemu on macOS (silicon) trying to create a minimalistic linux vm with network support, hardware acceleration, etc. Alpine linux, or Debian, seem good candidates so, basically, it is akin to what you provide inside linsk - and possibly with persistence of the changes. I've read tutorials but they have heterogeneous/conflicting information and my experiments failed, so far. It would be great to have indications from you on how to proceed, given your expertise on the matter. Even more, I'd create a mini repo just for this, given the unclear information online - and I will when I'll succeed.

emanuele avatar Dec 15 '24 13:12 emanuele

Take a look at vm/cfg.go#L59-L373. These are the helper functions that create QEMU flags for the Linsk VM. These are called in vm/vm.go#L107.

Also, as a tip for you, you can run a QEMU VM using a QEMU-based tool of choice and use ps aux | grep qemu-system to see what arguments the qemu-system command is called with, to use as a reference. QEMU man page can be very useful as well. It doesn't cover all flags and options; however, I would say that there is more than enough info for basic use.

AlexSSD7 avatar Dec 24 '24 01:12 AlexSSD7