Comments on Run programs of normal OS from a live USB
Parent
Run programs of normal OS from a live USB
I am experiencing hardware or software problems that I cannot explain, or find a solution for. As part of the troubleshooting process, I have now arrived at running an older version of the OS from a USB stick, and attempting to run the failing applications in this environment. However, I am not sure how to actually run the applications that are stored on the disk.
I always run these from the GUI launcher, so I located the ".desktop" file for one of them, opened it in Text Editor, and found a line starting with "Exec=". I then copied this command, and pasted it into the Terminal. For instance, with Steam:
>> /usr/games/steam steam://open/games
bash: /usr/games/steam: No such file or directory
That fails because the path goes to the USB, not the disk, so I located the mounting folder for the disk, and prefixed the path with that:
>> /media/pop-os/<\some-uuid\>/usr/games/steam
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: repo.steampowered.com
Aha, that fails. Not sure why, so I try another application:
>> /media/pop-os/<\some-uuid\>/usr/bin/winetricks --gui
winetricks GUI enabled, using Zenity 3.42.1
------------------------------------------------------
warning: wineserver not found!
------------------------------------------------------
So, how do I actually run programs stored on the disk, when the OS is on the USB stick?
Post
It sounds like what you want is:
There is a program installed in the regular OS on my hard drive, but I am booted into a live OS. How do I run that program?
The common way to do this is to use chroot.
Linux looks for programs under certain standard paths like /usr/bin
. If you're in a live OS, your /usr/bin
will be on a virtual disk (which uses your RAM) and will contain programs that came with the live USB. The normal OS's files are in the /usr/bin
of the drive, which is not active in the live OS.
Let's say you mounted your main OS partition at /mnt
, so that you see /mnt/usr/games/steam
. You can't run steam
because Linux will look for it in /usr
not /mnt/usr
. If you do chroot /mnt
this will make it so that instead of looking in /usr
, it looks in /mnt/usr
as if that was actually /usr
. When you run the chroot, it will alter your shell, and everything else you run in that shell will be "inside" /mnt
(or whatever argument you use). In your case, you would run something like:
chroot /media/pop-os/$SOME_UUID/
And after that, trying to do steam
should actually execute /media/pop-os/$SOME_UUID/usr/games/steam
Chroot is a bit like running one Linux inside another. However, keep in mind that it's not like a true virtual machine, just some trickery with paths. You will still be using the kernel and device drivers of the host OS. Just the programs being executed will change. Depending on the complexity of the program you run, you may need to set up additional virtual directories like /tmp
(chroot won't create these for you, it only covers real directories and files). This is why with just a basic chroot, GUI programs like Steam might not run, because they're not properly connected to the live OS's graphics server.
Arch Linux has a slightly extended version called arch-chroot. This sets up some extra stuff so you don't have to do it manually. However, to use this, you'll probably need to boot from the Arch ISO, which has no graphics and might be difficult to use if you're not comfortable in the terminal. As a workaround, you can try the Manjaro ISO which has a similar manjaro-chroot
but also comes with a GUI.
But if the program you are trying to run is specifically Steam or a Wine game, I think you might find that challenging. These rely on many specialized and obscure system features, and it's hard to provide all of those in a chroot, without booting into the regular OS. IMO running Steam/Wine inside chroot should be its own question, because it's very specialized and not the same as running simpler programs (CLI).
Normally what people do is boot from live USB, mount their hard drive, chroot into their normal system, use terminal commands to do fix it just enough to be bootable, then boot into the regular OS and troubleshoot further from there. You only really need to chroot from a live USB when the normal OS is unbootable. Once it boots, even just into a console, you don't need the live USB. As an aside, Arch Linux is even installed in the same way through a chroot, so you might find their install guide helpful. If you need a "working reference configuration", it's better to create a virtual machine inside your normal OS, or dual boot.
Good luck, and if you can narrow down to a more specific issue, try asking it as a separate question.
1 comment thread