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

unable to find a config file in /proc #137

Closed
arun54321 opened this issue Feb 28, 2022 · 49 comments
Closed

unable to find a config file in /proc #137

arun54321 opened this issue Feb 28, 2022 · 49 comments

Comments

@arun54321
Copy link

On fedora config file is on /boot
image

>sudo booster -output /tmp/booster.img -strip  -debug  -force
unable to find a config file in /proc

@anatol
Copy link
Owner

anatol commented Feb 28, 2022

Thanks for reporting it. Just to double-check, do you have any /proc/config* files at your system?

@anatol
Copy link
Owner

anatol commented Feb 28, 2022

Could you please also provide output of ls /boot/?

@arun54321
Copy link
Author

ls /boot
booster.img			      refind
config-5.16.8-200.fc35.x86_64	      refind_linux.conf
efi				      symvers-5.16.8-200.fc35.x86_64.gz
grub2				      System.map-5.16.8-200.fc35.x86_64
initramfs-5.16.8-200.fc35.x86_64.img  vmlinuz-5.16.8-200.fc35.x86_64
lost+found

ls /proc
1     1130  1257  1299	1404  1436  17	  19	24    27    3217  3407	394   412   4253  4263	4328  46    53	 69	 bootconfig  driver	    kcore	   meminfo	 self		uptime
10    1155  1258  13	1405  1449  1745  1907	2401  2717  325   3411	3946  414   4254  4264	4329  4628  54	 70	 buddyinfo   dynamic_debug  keys	   misc		 slabinfo	version
1029  1186  1260  1308	1406  1453  1763  2	2429  274   3256  35	395   415   4255  4265	4330  463   55	 71	 bus	     execdomains    key-users	   modules	 softirqs	vmallocinfo
1043  1190  1263  1331	1411  1455  1770  200	2483  28    326   36	4     418   4256  4268	4331  4635  6	 805	 cgroups     fb		    kmsg	   mounts	 stat		vmstat
1050  1191  1265  1347	1412  1461  1781  21	2551  29    3288  3671	40    4197  4257  4269	4385  464   609  81	 cmdline     filesystems    kpagecgroup    mtrr		 swaps		zoneinfo
1063  12    1274  1348	1416  1479  1793  22	2553  3     3292  3673	402   42    4258  427	44    47    61	 9	 consoles    fs		    kpagecount	   net		 sys
1072  1201  1279  1353	1425  15    18	  222	2588  3000  33	  37	403   424   4259  4287	445   48    63	 94	 cpuinfo     interrupts     kpageflags	   pagetypeinfo  sysrq-trigger
1074  1203  1287  1369	1427  1521  1875  224	26    303   330   3731	406   425   426   43	45    49    64	 95	 crypto      iomem	    latency_stats  partitions	 sysvipc
11    1226  1293  1388	1428  1565  1879  23	261   31    331   38	407   4250  4260  431	4546  497   65	 951	 devices     ioports	    loadavg	   pressure	 thread-self
1122  1238  1294  14	1432  16    1883  2310	2617  312   332   3808	41    4251  4261  4324	4547  504   66	 acpi	 diskstats   irq	    locks	   schedstat	 timer_list
1126  1253  1295  1402	1434  1684  1888  235	2653  32    34	  39	410   4252  4262  4327	4555  524   68	 asound  dma	     kallsyms	    mdstat	   scsi		 tty

anatol added a commit that referenced this issue Feb 28, 2022
Booster reads kernel's config file at generation time. Some systems
(e.g. Arch Linux) provides /proc/config file. Some other systems (e.g.
Fedora) have /boot/config-$kernelVersion. Add support for the /boot
config path.

Implements #137
@anatol
Copy link
Owner

anatol commented Feb 28, 2022

@arun54321 I added a change that implements this /boot/config-* feature. Please check wip branch and let me know if it makes any difference for you.

@arun54321
Copy link
Author

init - wip ❯ CGO_ENABLED=0 go build -trimpath -mod=readonly -modcacherw
go: github.com/anatol/[email protected] requires
	github.com/anatol/[email protected] requires
	github.com/anatol/[email protected] requires
	github.com/anatol/[email protected]: invalid version: unknown revision 4f66a321d8ef

I don't know whether I'm doing something wrong, I get this error.

@anatol
Copy link
Owner

anatol commented Feb 28, 2022

Oops sorry. I messed with dependencies earlier. I pushed a fix to wip branch. Please try it again.

@arun54321

This comment was marked as duplicate.

@arun54321
Copy link
Author

image

@anatol
Copy link
Owner

anatol commented Mar 1, 2022

Hmm, it works fine for me:

➜  init git:(wip) go version
go version go1.17.7 linux/amd64
➜  init git:(wip) CGO_ENABLED=0 go build -trimpath -mod=readonly -modcacherw
go: downloading github.com/anatol/devmapper.go v0.0.0-20211210164347-f67e20c4e7f7
go: downloading github.com/anatol/smart.go v0.0.0-20220218195151-5ee9e8fa73f0
go: downloading github.com/anatol/luks.go v0.0.0-20211210165108-5d9a15b4f614
go: downloading github.com/anatol/clevis.go v0.0.0-20220228201535-e211c818efc5
go: downloading github.com/anatol/uevent.go v1.0.1-0.20210811163347-3e166d38c549
go: downloading github.com/google/go-tpm v0.3.3
go: downloading github.com/insomniacslk/dhcp v0.0.0-20220119180841-3c283ff8b7dd
go: downloading github.com/vishvananda/netlink v1.1.0
go: downloading github.com/yookoala/realpath v1.0.0
go: downloading golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
go: downloading golang.org/x/net v0.0.0-20220225172249-27dd8689420f
go: downloading github.com/u-root/uio v0.0.0-20220204230159-dac05f7d2cb4
go: downloading golang.org/x/crypto v0.0.0-20220214200702-86341886e292
go: downloading github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
go: downloading github.com/lestrrat-go/jwx v1.2.19
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/lestrrat-go/iter v1.0.1
go: downloading github.com/lestrrat-go/backoff/v2 v2.0.8
go: downloading github.com/lestrrat-go/option v1.0.0
go: downloading github.com/lestrrat-go/blackmagic v1.0.0
go: downloading github.com/lestrrat-go/httpcc v1.0.0

What go version do you use?

@arun54321
Copy link
Author

arun54321 commented Mar 1, 2022

go version go1.16.14 linux/amd64
I installed it from fedora repos.

I will try again after updating to 1.17.7

@anatol
Copy link
Owner

anatol commented Mar 1, 2022

I believe clevis.go has been go mod tidy with 1.17 compat.

Does Fedora provide 1.17 go? If not then I will need to downgrade modules to 1.16.

@anatol
Copy link
Owner

anatol commented Mar 1, 2022

@arun54321 let me know if you was able to get it compiled with 1.17.

@arun54321
Copy link
Author

I have compiled v1.18 . Does it compile on that?

@anatol
Copy link
Owner

anatol commented Mar 2, 2022

Yes, it should work with 1.17+.

@arun54321
Copy link
Author

I don't see the error now. so I think it is working now.

https://0bin.net/paste/xPA+MbcG#kS4L3yChfWKg4VR-Tnl7ajrbCfOItbq7v7MGNEnqQ9I

@arun54321
Copy link
Author

But booster from this branch does not create initramfs image.

@anatol
Copy link
Owner

anatol commented Mar 2, 2022

Booster fails for some reason:

enabling virtual console
detected language - '"en_US.UTF-8"'
2022/03/02  exit status 1

I need to look at the code to figure out why there is no any error message for this failure.

@anatol
Copy link
Owner

anatol commented Mar 2, 2022

Also related question. Is golang 1.17 easily available for Fedore users? Is it ok to use 1.17 specific feature or it is going to be a lot of troubles for Fedora users?

anatol added a commit that referenced this issue Mar 2, 2022
@anatol
Copy link
Owner

anatol commented Mar 2, 2022

My guess that there is a problem with loadkeys binary. I added a commit that prints more information in case of its failure. @arun54321 please pull the changes from wip and try it one more time. Share your debug output as well.

You can also disable vconsole option in your config file to skip this step.

@arun54321
Copy link
Author

arun54321 commented Mar 3, 2022

exit status 1: loadkeys: Unable to open file: "us": No such file or directory
builds fine after disabling vconsole.

@anatol
Copy link
Owner

anatol commented Mar 3, 2022

exit status 1: loadkeys: Unable to open file: "us": No such file or directory

thanks. What is the content of /etc/vconsole.conf and /etc/locale.conf?

what is output of loadkeys -q -b us?

@arun54321
Copy link
Author

Also related question. Is golang 1.17 easily available for Fedore users? Is it ok to use 1.17 specific feature or it is going to be a lot of troubles for Fedora users?

I'm using fedora for around a week or 10 days. I don't know about fedora release schedules. For a time being anyone could use my copr repo till it arrives on official repositories.

1.18 is coming in fedora 36 so It should not be problem in future.

@arun54321
Copy link
Author

arun54321 commented Mar 3, 2022

/etc ❯ cat vconsole.conf
KEYMAP="us"
FONT="eurlatgr"
/etc ❯ cat locale.conf
LANG="en_US.UTF-8"

@arun54321
Copy link
Author

https://paste.centos.org/view/adb37d94

for loadkeys.

@arun54321
Copy link
Author

It looks like this in terminal.
image

@anatol
Copy link
Owner

anatol commented Mar 3, 2022

If loadkeys -q -b us works for you then I don't really understand why booster with the same command.

Could you please post output of /etc/booster.yaml? And btw you can paste the text right here, without using screenshots.

@arun54321
Copy link
Author

strace.zip

@anatol
Copy link
Owner

anatol commented Mar 4, 2022

Looking at strace output I see that loadkeys called with correct parameters:

execve("/usr/bin/loadkeys", ["loadkeys", "-q", "-b", "\"us\""], 0xc000d05440 /* 68 vars */ <unfinished ...>

(which is loadkeys -q -b "us")

yet it fails with

[pid 12157] write(2, "loadkeys: ", 10)  = 10
[pid 12157] write(2, "Unable to open file: \"us\": No su"..., 52 <unfinished ...>
[pid 12157] <... write resumed>)        = 52
[pid 12157] write(2, "\n", 1 <unfinished ...>
[pid 12157] <... write resumed>)        = 1
[pid 12157] exit_group(1)               = ?
[pid 12157] +++ exited with 1 +++
[pid 12114] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12157, si_uid=1000, si_status=1, si_utime=0, si_stime=2} ---
[pid 12128] <... waitid resumed>{si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12157, si_uid=1000, si_status=1, si_utime=0, si_stime=0}, WEXITED|WNOWAIT, NULL) = 0
[pid 12128] wait4(12157,  <unfinished ...>
[pid 12128] <... wait4 resumed>[{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, {ru_utime={tv_sec=0, tv_usec=2646}, ru_stime={tv_sec=0, tv_usec=27690}, ...}) = 12157

it is not clear for me why it happens. It might be that Fedora's loadkeys expects some env var or maybe something else.

@arun54321
Copy link
Author

anatol added a commit that referenced this issue Mar 5, 2022
Some users add quotes around property values in these files. Strip the
quotes to avoid `loadkeys` tool confusion.

Related #137
@anatol
Copy link
Owner

anatol commented Mar 5, 2022

@arun54321 I actually found one more difference from my setup. The values in your /etc/vconsole.conf have quotes around values (KEYMAP="us"). I added code that strips these quotes. Hopefully it fixes the problem with loadkeys. Please take a look at wip branch.

@arun54321
Copy link
Author

arun54321 commented Mar 5, 2022

booster - wip! ❯ g clean -f
Removing generator/booster
Removing init/init
booster - wip ❯ cd generator
generator - wip ❯ CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection"
generator - wip ❯ CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
generator - wip ❯ LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
generator - wip ❯ CGO_CPPFLAGS="${CPPFLAGS}" CGO_CFLAGS="${CFLAGS}" CGO_CXXFLAGS="${CXXFLAGS}" CGO_LDFLAGS="${LDFLAGS}"
generator - wip ❯ go build -trimpath \
      -buildmode=pie \
      -mod=readonly \
      -modcacherw \
      -ldflags "-linkmode external -extldflags \"${LDFLAGS}\""

generator - wip! ❯ cd ../init
init - wip ❯ CGO_ENABLED=0 go build -trimpath -mod=readonly -modcacherw
init - wip! ❯ cd ..
booster - wip! ❯ sudo install -Dp -m755 generator/booster "/usr/bin/booster"
[sudo] password for arun: 
booster - wip! ❯ sudo install -Dp -m755 init/init "/usr/lib/booster/init"
booster - wip! ❯ booster build /tmp/a.img -v
increasing open file limit 1024->524288
reading /boot/config-5.16.8-200.fc35.x86_64

no matches found for a device alias 'platform:efivars'
no matches found for a device alias 'acpi:LNXSYSTM:'
enabling virtual console
detected language - 'en_US.UTF-8'
2022/03/05 15:11:12 lstat /lib/libc.so.6: no such file or directory
booster - wip! ❯ 


@arun54321
Copy link
Author

libc file is in /usr/lib64. How do I compile / fix it properly?

@arun54321
Copy link
Author

arun54321 commented Mar 5, 2022

I tried to symlink libc file to the destination.
Now I get open /usr/share/kbd/consolefonts/: no such file or directory

On fedora that folder is in /usr/lib/kbd/consolefonts

Image generation is working now after symlink those missing folders.

enabling virtual console
detected language - 'en_US.UTF-8'
font eurlatgr matched to file /usr/share/kbd/consolefonts/eurlatgr.psfu.gz

/ ❯ file /tmp/a.img
/tmp/a.img: Zstandard compressed data (v0.8+), Dictionary ID: None

anatol added a commit that referenced this issue Mar 5, 2022
Fedora keeps some of its libraries under /usr/lib64. Look at this
directory when searching for ELF libraries.

Related #137
@anatol
Copy link
Owner

anatol commented Mar 5, 2022

libc file is in /usr/lib64. How do I compile / fix it properly?

I added /usr/lib64 path to the booster search list. Booster wip should work for you now without any extra symlinks.

anatol added a commit that referenced this issue Mar 5, 2022
Different systems have different consolefonts path, e.g. Fedora uses
`/usr/lib/kbd/consolefonts`. Having this path as a separate constant
makes it easier to patch for a specific distro.

Related #137
@anatol
Copy link
Owner

anatol commented Mar 5, 2022

On fedora that folder is in /usr/lib/kbd/consolefonts

I added a patch that makes it easier to configure this folder. Distros could update this path if needed.

051c8a1#diff-1dff658e5bba8c544f3d28aae04581865748e30fd711239342a747f63c4a406bR14

So the fedora package should patch booster path to /usr/lib/kbd/consolefonts

@anatol
Copy link
Owner

anatol commented Mar 5, 2022

Image generation is working now after symlink those missing folders.

Could you please pull wip branch, remove all the symlinks you've made and then try booster one more time?

@anatol
Copy link
Owner

anatol commented Mar 5, 2022

open /usr/share/kbd/consolefonts/: no such file or directory

The sourcecode needs to be patched to adjust it to Fedora's defaults.

@arun54321
Copy link
Author

arun54321 commented Mar 5, 2022

Should I apply the patch or just pull and build again?
edit: ok

@arun54321
Copy link
Author

arun54321 commented Mar 5, 2022

Works well.

@anatol
Copy link
Owner

anatol commented Mar 5, 2022

Does it boot at Fedora?

Could you please also make a package for Fedora so other people can use the package easily? Is there any way to get this package to Fedora repository?

@arun54321
Copy link
Author

I don't know to write hooks to which rebuilds image during kernel updates.

@arun54321
Copy link
Author

arun54321 commented Mar 5, 2022

Just now tested it. It boots to fedora.

Thank you.

anatol added a commit that referenced this issue Mar 5, 2022
Booster reads kernel's config file at generation time. Some systems
(e.g. Arch Linux) provides /proc/config file. Some other systems (e.g.
Fedora) have /boot/config-$kernelVersion. Add support for the /boot
config path.

Implements #137
anatol added a commit that referenced this issue Mar 5, 2022
Some users add quotes around property values in these files. Strip the
quotes to avoid `loadkeys` tool confusion.

Related #137
anatol added a commit that referenced this issue Mar 5, 2022
Fedora keeps some of its libraries under /usr/lib64. Look at this
directory when searching for ELF libraries.

Related #137
anatol added a commit that referenced this issue Mar 5, 2022
Different systems have different consolefonts path, e.g. Fedora uses
`/usr/lib/kbd/consolefonts`. Having this path as a separate constant
makes it easier to patch for a specific distro.

Related #137
@arun54321
Copy link
Author

arun54321 commented Mar 11, 2022

Could you add force and kernelVersion flags to wip branch?

I am trying to write image generation script. It doesn't work due to missing flags.

So far, it works without those flags.

#!/bin/bash -e

# find out all installed kernels
kernels=($(rpm -q kernel-core))

for kernel in "$kernels"; do
    version=$( echo $kernel | sed 's/kernel-core-//g' )
# write to tmp for testing
    booster  build /tmp/booster-${version}.img  &
done

wait

It outputs

unknown flag `k'
unknown flag `f'

@anatol
Copy link
Owner

anatol commented Mar 11, 2022

The flags start with double hype: --force. Please see man page for more information.

@arun54321
Copy link
Author

tmp ❯ booster --force build /tmp/booster.img
unknown flag `force'

@anatol
Copy link
Owner

anatol commented Mar 11, 2022

--force and --kernel-version are build subcommand flags. i.e. you have to put it after the build codeword.

Here is an example of usage https://github.com/anatol/booster/blob/master/packaging/arch/regenerate_images

@arun54321
Copy link
Author

arun54321 commented Mar 11, 2022

Thanks. Works fine now.

#!/bin/bash -e

# find out all installed kernels
kernels=($(rpm -q kernel-core))

for kernel in "$kernels"; do
    version=$( echo $kernel | sed 's/kernel-core-//g' )
# write to tmp for testing
    booster  build --force --kernel-version ${version} /tmp/booster-${version}.img   & 
done

wait

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