TrueNAS SCALE (21.02/21.04-ALPHA.1) reboot system when poweroff (CORE doesn't)

th3n3k

Cadet
Joined
Apr 24, 2021
Messages
5
Hi all,
First of all, please excuse my English as it is my main language. Second, thank you all for TrueNAS software. I'm quite newbie with it but I would like to comment an issue I've found with my system. I'm not use to reaise bugs or whatever and I'm not sure even if I could be facing one (although it seems to me) so I really appreciate your comments/suggestions.

The problem: Both in TrueNAS SCALE 21.02 and 21.04 (alpha stage, I know) when I power off my system ("poweroff", "shutdown -h now", "init 0" commands into SSH, or by clicking into the web GUI button) the system poweroff (ok) but a few seconds after, it turns on again by itself (bad).
Checked the BIOS there is no wake-on-lan option enabled. In fact, BIOS is really quite simple and there is no much room to touch anything on it (besides EuP which has been tested enabled and disabled with the same result).

I've tested with Debian 10.9 and Debian 11 (RC) with the same result. And searching at forums it seems an issue related with ACPI tables or whatever but I don't get any solution for that.

Funny thing is TrueNAS Core 12.0-U3 works flawlessly: you click shutdown and it goes down and stays down. I know the core of both platforms are different (Linux vs FreeBSD) so it probably explains the different behavior but... as you iXSystem develops both solutions, do you think I should raise a bug case regarding TrueNAS SCALE? Or maybe someone else faced this issue and can provide some guidance to tweak files or configurations? (as said, I'm afraid BIOS hasn't room for more checks)

My system is an old QNAP TS-451 NAS (J1800 + 8GB RAM) and I'm trying to replace its QTS SO with TrueNAS. I've seen I could choose TrueNAS CORE but with TrueNAS SCALE development near beta stage I would like to know if there is something to do with this issue and stay on SCALE/Debian.

Thank you all in advance for your reading and, for sure, your suggestions.
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
I don't have a solution for your issue, but I had a similar issue with my newish miniature desktop & Linux. It would power down fine, but within seconds of power off, it would power back on. I tracked it to my action of either accidentally hitting a key or turning my wireless mouse off.

The solution for me, was to find the "wake" sources. Seems Linux likes to use any source as a wake source, including USB. For me, using the power button only is just fine. So I had to find all the others and disable them. A quick search, and I was unable to find how I did it. Might be something with "/proc/acpi/wakeup", which you can just "cat" to see what is enabled for power on.
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
<humor>
Arg, @Redcoat your last like on my above post, pushed my likes to 666!

Someone please like another of my posts so I can avoid the dreaded number of beast :smile:.
</humor>
 

th3n3k

Cadet
Joined
Apr 24, 2021
Messages
5
Thank you @Arwen for the tip! (you won't have the number of beast anymore)
Thank you to your "/proc/acpi/wakeup" reference I've managed (https://unix.stackexchange.com/questions/417956/make-changes-to-proc-acpi-wakeup-permanent + https://bbs.archlinux.org/viewtopic.php?id=263268) to set the XHC1 device status at "/proc/acpi/wakeup" as disabled but, unfortunately it seems the system keeps rebooting itself after I power it off :-(

I'll try installing TrueNAS CORE and checking if it has a /proc/acpi/wakeup file to try to get from there the working configuration (probably a long shot because I don't know if in FreeBSD that file will exists but... it is just one more SO installation for checking).

I'm open to other suggestions too :smile:
 

th3n3k

Cadet
Joined
Apr 24, 2021
Messages
5
I got this fixed under Debian 11 (RC): I had to add "xhci_hcd.quirks=270336" (https://bugzilla.kernel.org/show_bug.cgi?id=66171) into the "/etc/default/grub" file into the "GRUB_CMDLINE_LINUX_DEFAULT" line and afterwards run "update-grub". And voilà! Poweroff command works as expected!

Problem? I'm not able to do the same thing into TrueNAS SCALE 21.04. Apparently the "/etc/default/grub" file doesn't exist on it:

Code:
# cat /etc/default/grub
cat: /etc/default/grub: No such file or directory


Please, could someone help me to set that GRUB_CMDLINE_LINUX_DEFAULT into TrueNAS SCALE? Thank you in advance!
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
We may need to make a change to allow setting custom grub settings in the UI, but here's where you can manually set it for now.

 

waqarahmed

iXsystems
iXsystems
Joined
Aug 28, 2019
Messages
136
@th3n3k can you please make some edits so that we can see if the grub configuration is helpful ? If yes, please follow the following steps:
1) Open "/usr/local/bin/truenas-grub.py" with an editor like "nano".
2) Edit "'GRUB_CMDLINE_LINUX_DEFAULT="libata.allow_tpm=1 systemd.unified_cgroup_hierarchy=0 '" line to
Code:
'GRUB_CMDLINE_LINUX_DEFAULT="libata.allow_tpm=1 systemd.unified_cgroup_hierarchy=0 xhci_hcd.quirks=270336 '

( please make sure to copy the line as it is )
3) Run "midclt call etc.generate initramfs"
4) Run "midclt call etc.generate grub"
5) Step (3) is for safety, i think it should not be required but based one on user's comment it might be so not sure. Please reboot after this and kindly let us know if that helps.

Looking forward to hearing from you. Thank you
 

th3n3k

Cadet
Joined
Apr 24, 2021
Messages
5
Thank you bot @Kris Moore and @waqarahmed : it worked!

Step 3) provided by @waqarahmed failed with below error message but I continued with step 4 as it was mentioned probably step3 wasn't necessary and, as I said, after a reboot to take into account the GRUB changes, now the power off works like it was expected (my QNAP TS-451 now remains off)

Code:
# midclt call etc.generate initramfs
initramfs group not found
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 138, in call_method
    result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self,
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1196, in _call
    return await methodobj(*prepared_call.args)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/etc.py", line 360, in generate
    raise ValueError('{0} group not found'.format(name))
ValueError: initramfs group not found


Thank you for your help!

Regarding a GUI option to modify GRUB it sounds like a winner choice here :smile:
 

waqarahmed

iXsystems
iXsystems
Joined
Aug 28, 2019
Messages
136
Awesome, thanks for confirming @th3n3k. You'll lose these changes on a system upgrade. We'll however i think add option to allow specifying GRUB parameters via api/cli, so this can be easily handled then.
 
Top