Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSUSE Tumbleweed in WSL #2

Closed
TaivasJumala opened this issue Nov 21, 2022 · 3 comments
Closed

OpenSUSE Tumbleweed in WSL #2

TaivasJumala opened this issue Nov 21, 2022 · 3 comments

Comments

@TaivasJumala
Copy link

TaivasJumala commented Nov 21, 2022

I'm a native Chinese speaker, so I can provide Chinese translation if needed.
我的母语是中文,如果需要我可以提供中文说明。

Background

I'm following the guide SDB:Add package repositories-OpenSUSE Wiki in Simplified Chinese to add package repositories for my OpenSUSE Tumbleweed.

Info
wsl --version

WSL version: 1.0.0.0
kernel version: 5.15.74.2
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22623.891

Steps to reproduce
  1. OpenSUSE Tumbleweed fresh installation from Microsoft Store
  2. Download this tool by
wget https://github.com/marguerite/rankmirror-ng/releases/download/v1.0.0/rankmirror-ng-v2-v1.0.0.x86_64.AppImage
  1. First try
./rankmirror-ng-v2-v1.0.0.x86_64.AppImage

which says:

dlopen(): error loading libfuse.so.2

AppImages require FUSE to run.
You might still be able to extract the contents of this AppImage
if you run it with the --appimage-extract option.
See https://github.com/AppImage/AppImageKit/wiki/FUSE
for more information

then I followed the guide in the link:

sudo zypper install fuse libfuse2

Before that, I still have problem connecting with OpenSUSE package repository in European because I'm in China. So I use a rather fast mirror:

sudo zypper ar -fcg https://mirrors.ustc.edu.cn/opensuse/tumbleweed/repo/oss USTC:OSS
sudo zypper ar -fcg https://mirrors.ustc.edu.cn/opensuse/tumbleweed/repo/non-oss USTC:NON-OSS
  1. After install FUSE, here is the second try:

Reading mirror list...
panic: open /var/run/utmp: no such file or directory

goroutine 1 [running]:
github.com/marguerite/go-stdlib/runtime.LogName(0x0, 0x17)
/home/runner/work/rankmirror-ng/rankmirror-ng/vendor/github.com/marguerite/go-stdlib/runtime/runtime.go:25 +0xe9
main.mirrorsPath(0x7889c0, 0xc000010018, 0xc000147de0, 0x1)
/home/runner/work/rankmirror-ng/rankmirror-ng/rankmirror-ng.go:45 +0x34
main.main()
/home/runner/work/rankmirror-ng/rankmirror-ng/rankmirror-ng.go:222 +0xaf

I googled "/var/run/utmp" for help, learning from utmp(5) — Linux manual page that "The utmp file allows one to discover information about who is currently using the system. There may be more users currently using the system, because not all programs use utmp logging."

I created one by doing:

sudo touch /var/run/utmp
  1. This is the last try. I'm stuck here, coming for getting help:

Reading mirror list...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x663b5b]

goroutine 1 [running]:
github.com/marguerite/go-gnulib/login.GetLogin(0x17, 0x0, 0xc0000620d8, 0x4c4e80)
/home/runner/work/rankmirror-ng/rankmirror-ng/vendor/github.com/marguerite/go-gnulib/login/getlogin.go:33 +0x19b
github.com/marguerite/go-stdlib/runtime.LogName(0x0, 0x17)
/home/runner/work/rankmirror-ng/rankmirror-ng/vendor/github.com/marguerite/go-stdlib/runtime/runtime.go:23 +0x26
main.mirrorsPath(0x7889c0, 0xc000010018, 0xc000147de0, 0x1)
/home/runner/work/rankmirror-ng/rankmirror-ng/rankmirror-ng.go:45 +0x34
main.main()
/home/runner/work/rankmirror-ng/rankmirror-ng/rankmirror-ng.go:222 +0xaf

It seems that problem is still relative to /var/run/tump file?

Thanks for reading. Appreciate for any helps.

@marguerite
Copy link
Owner

microsoft/WSL#573

utmp is a binary file created by system, you can not simply touch it.

rankmirror-ng highly depends on logged-in username for configuration files finding, because to modify repositories, you have to run sudo rankmirror-ng blabla, and I better not store those configuration files under the home directory of root :-D.

I can not help with a system without whoami or logname functions.

@TaivasJumala
Copy link
Author

TaivasJumala commented Nov 22, 2022

It's weird that I test whoami, who, w and w -H, all of them worked but logname failed.

In microsof/WSL#573, I found method_1 to bring back /var/run/utmp.

Still, logname says logname: no login name.

So I check the source code of logname, logname.c, noting that in line 76 to 78:

  cp = getlogin ();
  if (! cp)
    die (EXIT_FAILURE, 0, _("no login name"));

So, problem should be related to getloin() function.

According to this site, I then put my eye on getlogin_r() function, and this site mentioned file /var/run/utmp confirmed my thought.

By searching, I found microsoft/WSL#888. So I write a simple C code to test it. My getlogin_r() also returns 2. I think I met the same problem with him.

So I tried method_2 mentioned there by touch /var/run/utmp to create it first then login a user shell.

What make it even weird is that in Ubuntu-22.04-WSL method_2 works, logname works normally, however, in openSUSE-Tumbleweed-WSL, it doesn't. I entered password and waited seconds, then it looks nothing happened, while Ubuntu will start a new login shell.

Besides, both methode_1 and method_2 created same content for /var/run/utmp🤔.

Will the problem be with openSUSE or not? I currently have poor skills to find it out.


@Auckas helps a lot with me to find problems.

@TaivasJumala
Copy link
Author

openSUSE 的人气为何远不如 Ubuntu 和 Fedora ? - 瑪麗蘇的回答 - 知乎
This is the very first article who introduce openSUSE to me. Is that you? @marguerite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants