-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
FS#1071 - Sysupgrade fails when kernel console is disabled #6005
Comments
xback: More details as I'm currently digging into this issue: /sbin/sysupgrade finally makes following call: ubus call system sysupgrade '{ When this call is issued and there is no kernel console available, the board reboots immediately. More details later on .. hopefully .. |
xback: Issue identified: The wiki page [1] states that the ventana kernel prints can be disabled using following u-boot command:
In this case, I would expect the following line checking the kernel boot using dmesg: But I'm seeing this: I've also tried this:
Which results in this one: Practically, these faulty strings cause sysupgrade to reboot instantly as soon as the upgrade starts. (100% repro rate) I've reported this back to Gateworks Corp. [1] |
TB: I have the same problem, is there any solution? |
dpprog: The problem with this code is:
|
dpprog: With the console turned off, the process /sbin/upgraded will start up with a working directory /dev/ |
TB: Dmitry, thank you for the information. After this procedure, the update proceeds correctly. |
abatyiev: Hello everyone, I've got hit by same bug on ath79. Sysupgrade almost immediately goes into reboot without changing firmware. Apparently, it is a bug in procd. There is state.c file with following function: As you can see, if there is an error, the chdir("/") function is not called. That means, that during sysupgrade the cwd of procd process would be "/dev" (you can check that by "ls -l /proc/1/cwd"). Such arragement breaks /sbin/upgraded process (that is exec'ed into from procd), when it tries to chroot("."), because instead of chrooting into "/", it instead chroots into "/dev" and fails to find/exec "/lib/upgrade/stage2". Steps to reproduce:
Quick and dirty fix (i.e. "I want to upgrade my firmware somehow"):
Proper fix should insert "chdir("/");" into sysupgrade.c file of procd just before chroot. |
Too old. |
set_stdio chdirs to /dev/ to facilitate easy freopen of the console device name given by the tty parameter. Make sure to chdir back to / in all cases, even in the error path. This keeps the function free from unintended side effects. Before this commit, in case of an error, the working directory would remain /dev/ which would break sysupgrade because the rest of the code would rely on the current working directory to be unchanged, which is not an unreasonable expectation to make. Fixing this fixes an issue where sysupgrade would fail, when /dev/console does not exist or cannot be opened, which can happen for example when setting console= on kernel cmdline. Closes: openwrt/openwrt#6005 Fixes: 91da63d ("properly handle return codes") Signed-off-by: Andreas Gnau <[email protected]>
xback:
Hardware used:
Synopsis:
Running sysupgrade with a valid image fails if the kernel console is disabled in u-boot (setenv console ; saveenv; reset)
As soon as sysupgrade starts, the board reboots immediately.
The detected reboot reason displayed is exactly the same in both cases.
Reset cause: WDOG
WDOG1 Reset cause: SFTW
WDOG2 Reset cause: POR
Basically:
Rationale for disabling kernel console:
The text was updated successfully, but these errors were encountered: