Closed brendenhoffman closed 2 years ago
Hi,
Thanks for raising this issue, which is a good point to me.
the default way junest should run is ns --fakeroot, but this seems like it is defaulting to proot
This is not correct, it points to linux namespace with (fake)root privileges.
As you mentioned already, if you look at the content in ~/.junest/usr/bin_wrappers/yay
you will see JUNEST_ARGS
has default to ns --fakeroot
.
In order to make yay
working outside junest session is to set the JUNEST_ARGS
without fakeroot:
JUNEST_ARGS="ns" yay -S tcptraceroute
The reason we have --fakeroot
by default to all commands is because of convenience given it is helpful for the majority of the commands (except yay
). One way to solve this is to have a curated mapping rule between the commands and their mode, which may be not a bad idea.
Ok, the readme is a bit confusing, it sounds like while in the junest session that you are fakeroot, but I could not tell while I was in that session because JUNEST_ARGS
is unset. Maybe I skimmed over the readme too much, or I just didn't understand because I'm not an expert. It didn't occur to me at first that fakeroot is also root, which is a bit obvious now.
Now that you have cleared that up, why is fakeroot default for all commands outside of the junest session? To me, it doesn't seem helpful at all... A lot of commands don't really care about root, some won't run as root, and the commands that need root like pacman
didn't actually work. That being said, I don't see how a curated rule for commands will work all that well, what will happen to applications installed from pacman or the aur, will the user have to include commands in the rule for those if they do not work?
I am not sure what would break if fakeroot was disabled from outside of the junest session, or how it would depend on usecase. I started looking into junest because of the Steamdeck, to solve the problem of installing applications via pacman without messing with the immutable file system, so my current usecase is just a kde neon vm and I am installing my extra programs in junest rather than apt. I do not know how this differs from your other users.
I set JUNEST_ARGS="ns"
in my bashrc and that does not seem to do anything... also, using yay like in your example JUNEST_ARGS="ns" yay -S kate
fails and just starts a new line, but simply JUNEST_ARGS="ns" yay
did work, even to install a program. This mostly goes inline with my finding that commands needing sudo
must be run in the junest session, while yay doesn't want root, in this case its directly taking place of pacman which would need root. But how would I default to no fakeroot instead of putting JUNEST_ARGS="ns"
in front of every command, if it doesn't work in bashrc?
and the commands that need root like pacman didn't actually work.
It does work (at least to me). Update to the latest junest command version first and try again.
I set JUNEST_ARGS="ns" in my bashrc and that does not seem to do anything..
Are you source bashrc gets called when you open a new shell?
also, using yay like in your example JUNEST_ARGS="ns" yay -S kate fails and just starts a new line
Very hard to understand that without you sharing traceback or more info. The only thing I can tell is that it should work (at least to me)
.
There are no updates right now (through pacman), if there is anything I need to show you let me know, I wouldn't know. This is a fresh install as of yesterday.
When I open a regular shell or a junest shell? When I open a new terminal then of course it is reloading the bashrc, and I can confirm that it is set with echo JUNEST_ARGS
. Junest however, is using sh, but I don't know if that matters.
I should mention that export JUNEST_ARGS="ns"
works, but the result of echo JUNEST_ARGS
is just the same.
How fresh is junest command?
Can you do this?
cd ~/.local/share/junest
git pull origin master
Maybe latest code change solve the issue. When I try pacman -Rsn
command I get this:
$]> pacman -Rns tcptraceroute
checking dependencies...
Packages (3) libnet-1:1.1.6-1 libpcap-1.10.1-2 tcptraceroute-1.5beta7-8
Total Removed Size: 1.00 MiB
:: Do you want to remove these packages? [Y/n]
:: Processing package changes...
(1/3) removing tcptraceroute [##################################################] 100%
(2/3) removing libpcap [##################################################] 100%
(3/3) removing libnet [##################################################] 100%
What is your exact and complete output instead?
Branch was already up to date, I mean fresh as in about 2 days old and I haven't really modified it
From my kde neon shell:
$ pacman -Rsn neovim
error: invalid option '-e'
Idk, you previously mentioned a different output:
pacman -Rns falkon
which returned pacman: invalid option -- 'a'
I can't reproduce the issue this way. My guess is that you have a different version of bash or something like this.
It seems like it is the second letter of the word for anything I try... Can you think of any reason why it would do that? Bash should be version 5.1.
I am taking your suggestion about making the ns
mode (no fakeroot) as the default one and adding a sudoj
helper for fakeroot privileges.
Apparently the issue you got is caused by this recent merge: https://github.com/fsquillace/junest/pull/287
If I revert to older commit it works:
git co 5f7eaff
# Recreating the pacman bin wrapper by removing the file and temporarily entering into junest:
rm ~/.junest/usr/bin_wrappers/pacman
junest -- exit
bash -x ~/.junest/usr/bin_wrappers/pacman -Rsn neovim
+ JUNEST_ARGS='ns --fakeroot'
+ eval junest ns --fakeroot -- pacman -Rsn neovim
++ junest ns --fakeroot -- pacman -Rsn neovim
checking dependencies...
Packages (9) libluv-1.43.0_0-1 libtermkey-0.22-2 libuv-1.43.0-1 libvterm01-0.1.4-2 luajit-2.1.0.beta3.r397.g20aea939-1 msgpack-c-4.0.0-1 tree-sitter-0.20.6-1 unibilium-2.1.1-1
neovim-0.7.0-3
Total Removed Size: 37.00 MiB
:: Do you want to remove these packages? [Y/n] n
The culprit commit is bc543a9
git co bc543a9
# Recreating the pacman bin wrapper by removing the file and temporarily entering into junest:
rm ~/.junest/usr/bin_wrappers/pacman
junest -- exit
bash -x ~/.junest/usr/bin_wrappers/pacman -Rsn neovim
+ JUNEST_ARGS='ns --fakeroot'
++ printf %q -Rsn neovim
+ eval junest 'ns --fakeroot' -- pacman -Rsnneovim
++ junest ns --fakeroot -- pacman -Rsnneovim
error: invalid option '-e'
Interesting. When I get a chance I will be sure to give it a test
Fix merged in master
. This now fixes the problem:
junest create-bin-wrappers -f
sudoj pacman -Rsn neovim
checking dependencies...
Packages (9) libluv-1.43.0_0-1 libtermkey-0.22-2 libuv-1.43.0-1 libvterm01-0.1.4-2 luajit-2.1.0.beta3.r397.g20aea939-1 msgpack-c-4.0.0-1 tree-sitter-0.20.6-1 unibilium-2.1.1-1
neovim-0.7.0-3
Total Removed Size: 37.00 MiB
:: Do you want to remove these packages? [Y/n] n
Resolving.
I don't know if I did something wrong, but as far as I can tell JuNest is working perfectly fine, there is just one annoyance. I have ~/.local/share/junest/bin and ~/.junest/usr/bin_wrappers in my path, I can run, say nvim from junest just by starting a terminal and running nvim. However, when I run yay, I get a message about how it can't be run as root, so I have to run
junest
before I runyay
, then I would have to runexit
to get back to the main system. I have also run into this with other apps that don't want to be run as root. If I understand correctly, the default way junest should run isns --fakeroot
, but this seems like it is defaulting toproot
. What is the solution here? I would like to be able to open a terminal and run whatever application I want out of JuNest with out it being in some kind of root mode, for that I want to usesudo
like normal. Though I can't really getsudo
to work right without runningjunest
first. For instancepacman -Rns falkon
returnedpacman: invalid option -- 'a'
Which I guess is fine, but if I have to runjunest
to usesudo
, why would the default mode be root?