Page 1 of 2

[SOLVED] Weird behaviior at reboot only (shutdown works normally)

Posted: 25 Aug 2020 08:25
by Papasot
Whenever I try to reboot the system (Openbox), either via wm-logout or via sudo reboot, the system shuts down as expected then it tries to launch GRUB but it doesn't work. First I see "GRUB" on the screen, then "GRUB loading", then endless messages saying "loading", and nothing happens. Note that normal shutdown, either via wm-logout or via sudo halt works as expected. Also note that this happens on Slackel 32 only; rebooting on Slackel 64 works as always.
This is a minor issue since I rarely have the need to reboot. This is why I am not sure when the problem started to appear. However, if there is a way to fix it, please let me know.

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 25 Aug 2020 11:03
by djemos
I only can think it is a grub install problem.
Also if you shutdown and then boot your system boots since you not say system is un-bootable.
After boot upgrade your system.

Code: Select all

sudo slapt-get -u
sudo slapt-get --upgrade
sudo slapt-get -i --reinstall lsb-release
sudo lsb_release-update
Check what is in your /etc/lsb-release
It has to be something like (from my 32bit system)

Code: Select all

LSB_VERSION=1.4
DISTRIB_ID=slackel
DISTRIB_RELEASE=7.3
DISTRIB_CODENAME=Openbox
DISTRIB_DESCRIPTION='Slackel Linux 5.4.60-smp'
Where the number 5.4.60 in the last line it has to be the same with your kernel version installed. If it is not change it and save the file
Then run from menus "system" -> "Εργαλείο Εγκατάστασης και Ρύθμισης του Grub" (Grub Install and Set Up Utility)
This will install and upgrade grub.
Then reboot.

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 25 Aug 2020 12:46
by Papasot
Unfortunately, that didn't help... lsb-release was the same except the DISTRIB_DESCRIPTION was 'Slackel Linux Openbox' before. Now it matches my kernel, which is 4.4.38. I keep that kernel because last time I tried to install a more recent kernel the display was messed up right from the booting, to the point I can't see anything.
Rebooting still doesn't work. Anything else works as expected.

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 25 Aug 2020 15:20
by djemos
This is really strange. Looking at /etc/rc.d/rc.6 it looks procedure is the same for reboot or poweroff
In the end the script execute /sbin/reboot or /sbin/poweroff whch both are links to halt.

Code: Select all

# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
echo
if [ "$shutdown_command" = "reboot" ]; then
  echo -e "${BOLDYELLOW}Rebooting.${COLOR_RESET}"
  /sbin/reboot
else
  echo -e "${BOLDYELLOW}Powering down.${COLOR_RESET}"
  /sbin/poweroff
fi
ls -l /sbin/reboot
lrwxrwxrwx 1 root root 4 Ιουλ 9 16:25 /sbin/reboot -> halt
ls -l /sbin/poweroff
lrwxrwxrwx 1 root root 4 Ιουλ 9 16:25 /sbin/poweroff -> halt

So i don't know why this happened.

It is only slackel 32 installed in this pc ?
Now it matches my kernel, which is 4.4.38. I keep that kernel because last time I tried to install a more recent kernel the display was messed up right from the booting, to the point I can't see anything.
It is an old kernel and it is also strange the display is messed up. Systems has been upgraded from an old slackel installation and maybe is missing packages have added or replaced. I never had problem upgrading the kernel manually or using the "sudo install-upgrade-kernel upgrade huge"
And also why boots fine when system shutdown? And not when system reboots?
What are the messages appeared on screen when going down to reboot ?

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 26 Aug 2020 06:55
by djemos
what type is your pc ?
I found this on internet which might help solve the problem.
Edit /etc/default/grub and
Add in GRUB_CMDLINE_LINUX_DEFAULT='quiet reboot=pci' or bios or acpi
can add all of these and see if they are working
GRUB_CMDLINE_LINUX_DEFAULT='quiet reboot=bios,pci,acpi'
then sudo update-grub

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 26 Aug 2020 15:28
by Papasot
Sorry for the delayed reply, but as you will see below I had many things to do.
I tried to change GRUB_CMDLINE_LINUX_DEFAULT parameters, but after that upgrade-grub reported e syntax error.(although I checked and rechecked - there was no error, I typed parameters correctly). Against any logic, I ignored the syntax error reported by update-grub and rebooted the system (big mistake, I know). Of course the system was unbootable...
So I booted from Slackel 17.3 USB, mounted and chroot'ed my file system. Then I reverted /etc/default/grub to its previous version, and tried to update-grub in the chroot environment, trying to at least make the system as it was before. update-grub reported a lot of missing directories (including /proc, for example), and it didn't see my old Window$ XP partition (I keep it there because some old programs run in that environment only). Despite all that, update-grub actually managed to create a /boot/grub/grub.conf file without syntax errors. I shut down the system and started again. The grub screen is dark with two oprtions to boot (both entitled Slackel 17.2, not 17.3) but the system boots normally, and everything works - except rebooting and update-grub.
I tried to reboot, the original problem is still there: shutdown then boot the system works, rebooting doesn't. upgrade-grub doesn't work either. This is what I get by trying it:

Code: Select all

Generating grub configuration file ...
Found background: /boot/grub/slackel.png
Found linux image: /boot/vmlinuz-huge-smp-4.4.38-smp
Found linux image: /boot/vmlinuz-huge-smp
Found linux image: /boot/vmlinuz-huge-4.4.38
Found linux image: /boot/vmlinuz-huge
Found linux image: /boot/vmlinuz-huge-smp-4.4.38-smp
Found linux image: /boot/vmlinuz-huge-smp
Found linux image: /boot/vmlinuz-huge-4.4.38
Found linux image: /boot/vmlinuz-huge
Found Windows Recovery Environment on /dev/sda1
Found Microsoft Windows XP Home Edition on /dev/sda2
Found 'Slackel Linux 4.4.38-smp' (7.3) on /dev/sda3
Found linux image: /boot/vmlinuz-huge-smp-4.4.38-smp
Found linux image: /boot/vmlinuz-huge-smp
Found linux image: /boot/vmlinuz-huge-4.4.38
Found linux image: /boot/vmlinuz-huge
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 319
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
As you can see it reports a syntax error at line 319. This is the contents of /boot/grub/grub.cfg.new around line 319:

Code: Select all

308  menuentry "\"'Slackel Linux 4.4.38-smp'\'' (7.3) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge-smp-4.4.38-smp--a4debc3b-282b-470a-b859-c5139904b959' {
309  		insmod part_msdos
310  		insmod ext2
311  		set root='hd0,msdos3'
312  		if [ x$feature_platform_search_hint = xy ]; then
313  		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3  a4debc3b-282b-470a-b859-c5139904b959
314  		else
315  		  search --no-floppy --fs-uuid --set=root a4debc3b-282b-470a-b859-c5139904b959
316  		fi
317  		linux /boot/vmlinuz-huge-smp-4.4.38-smp root=/dev/sda3
318  }
319  } 
320  ### END /etc/grub.d/22_os-prober_proxy ###
Line 319 seems to contain an orphaned close curly bracket indeed. I know that file is automated and you should not mess with it, but since t doesn't work anyway I deleted line 319 manually, renamed that file /boot/grub/grub.cfg and tried to boot the system... of course that dirty trick didn't work: I see the first 2 lines of a normal grub boot then screen flashes and it starts over again and again. So I had to boot via USB to make the system bootabe as described earlier.

So now I somehow messed up grub... I am still able to boot by running update-grub in a chroot environment but I cannot really update-grub properly, and I have no way to boot the old Window$ XP partition (I need it very rarely, but it still needs to be there).
If it wasn't for the kernel problem that messes my screen, I would have re-install Slackel from scratch. Last time I did that on this machine was about two years ago, maybe the kernel won't mess up the screen now since the kernel changed in those two years. And reinstalling is not really a big deal, Slackel itself takes 5 minutes to be installed, configuring everything as it was before (my own libraries etc) takes way more (several hours). I will actually try that, unless there is something else I should try before.

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 26 Aug 2020 15:57
by djemos
To chroot you have also to mount proc,dev,sys. Don't worry, your system will be just fine.
I see you run an old version of os-prober. But never mind.
Line 319 is not orphaned. Same here

Code: Select all

linux /boot/vmlinuz-huge root=/dev/sda7 ro vt.default_utf8=1 quiet
  }
}
### END /etc/grub.d/30_os-prober ###
Here is one script to chroot (chroot-sl.sh)

Code: Select all

#! /bin/sh
TARGET=/run/media/djemos/0c1d44e4-be6b-47cd-be8a-a26e570f68d3
mount -o bind /proc $TARGET/proc
mount -o bind /sys $TARGET/sys
mount -o bind /dev $TARGET/dev
#mount -o bind /tmp $TARGET/tmp
mount --bind /etc/resolv.conf $TARGET/etc/resolv.conf

chroot $TARGET /bin/bash -l
So after boot with slackel live mount your slackel partition with pcmanfm
Change the line TARGET=/run/media/djemos/0c1d44e4-be6b-47cd-be8a-a26e570f68d3 with your mount point of slackel installation partition

Then type

Code: Select all

sudo sh chroot-sl.sh
and type

Code: Select all

grup-install /dev/sda
You have to see no errors. And the message "Installation finished. No error reported."
Then run

Code: Select all

update-grub
then type

Code: Select all

 exit

Note that while in chroot you can install or reinstall or upgrade packages. like slapt-get -i --reinstall grub
if you have connected to the internet using wicd from slackel live.

this script unchroot your system (Change the line TARGET=/run/media/djemos/0c1d44e4-be6b-47cd-be8a-a26e570f68d3 with your mount point of slackel installation partition)

Code: Select all

#! /bin/sh
TARGET=/run/media/djemos/0c1d44e4-be6b-47cd-be8a-a26e570f68d3
umount -l $TARGET/proc
umount -l $TARGET/sys
umount -l $TARGET/dev
#umount -l $TARGET/tmp
umount -l $TARGET/etc/resolv.conf

type

Code: Select all

sudo sh unchroot-sl.sh
Then reboot


Also this is my /etc/default/grub.cfg. So use this in case yours is messed up.

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

# If you want to dynamically change the default entry booted using
# `grub-set-default' or `grub-reboot', set this to "saved".
# Placing a number here will always boot that entry and the previously
# mentioned two tools won't have any effect.
# For savedefault functionality
GRUB_DEFAULT=saved

GRUB_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_DISTRIBUTOR="Slackel $(sed -e 's/^Slackware //' /etc/slackware-version)"
GRUB_CMDLINE_LINUX_DEFAULT='quiet rootfstype=ext4'
GRUB_CMDLINE_LINUX='vt.default_utf8=1'

# Uncomment this to enable savedefault support (i.e. the last chosen
# menuentry is booted the next time).
# Note: This depends on "GRUB_DEFAULT=saved"
#GRUB_SAVEDEFAULT=true

# The background image which should be used for the graphical terminal.
GRUB_BACKGROUND="/boot/grub/slackel.png"

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_MENU_COLOR_NORMAL=white/black
GRUB_COLOR_HIGHLIGHT=white/cyan
GRUB_COLOR_NORMAL=white/black

# The theme which should be used for the graphical terminal.
# This makes the background option obsolete.
#GRUB_THEME="/boot/grub/mytheme"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto
#GRUB_GFXMODE=640x480
#GRUB_GFXMODE=1024x768x32


# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Font used on the graphical terminal:
#GRUB_FONT=/usr/share/grub/dejavusansmono.pf2
GRUB_FONT=/usr/share/grub/unicode.pf2

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to disable the detection of other installed operating
# systems using os-prober
#GRUB_DISABLE_OS_PROBER=true

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 26 Aug 2020 18:24
by Papasot
I did as you recommended, and it worked. The system is now restored to its previous state, before I started this thread. It has been a long time I used chroot, and I totally forgot /proc, /dev, and /sys need special treatment. But it won't happen again because this time I saved your scripts for future use.

Now, once the system was restored, I tried to update-grub from the system itself (not in a chroot environment). It didn't work again... it only works if I do as you recommended. I am pretty sure in the past I was able to update-grub right away, without having to boot from live usb and set up chroot. I have no idea why this is not the case anymore.

As for the original problem... it's still there. shutdown then boot again works, rebooting by any means doesn't work. And by "any means" I mean via wm-logout, Alt+Ctrl+Del, or sudo reboot.None of those works. For reference this is what I see when I try to reboot:

Code: Select all

_ (several seconds pass with just a blinking cursor)
GRUB _ (several seconds pass with just this message)
GRUB loading (again, several second pass, then)
loading
loading
loading
(and so on forever, it just quickly spams "loading" on screen)
I don't think I would exaggerate if I said this is the weirdest problem I've ever seen. Now, I tried to add

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT='quiet reboot=bios,pci,acpi'
in /etc/default/grub then upgrade-grub (in a chroot environment, because like I said otherwise it doesn't work). Grub is indeed updated without any errors, but rebooting doesn't work.

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 26 Aug 2020 18:51
by djemos
It is really strange. Boot in windows and make a chkdisk in windows system for errors.
Then shutdown not reboot.
Boot in slackel and then run update-grub
And then reboot to see if it is working.
But then why is working when shutdown? Maybe some device is not umounted on reboot while on shutdown everything is stopped.

Re: Weird behaviior at reboot only (shutdown works normally)

Posted: 26 Aug 2020 21:31
by Papasot
The Window$ XP partition is there for one reason only: I have a Casio programmable calculator (basically, a palmtop) which communicates with the computer via a program that runs on XP only. That program is rarely needed,. I am guessing I could get rid of the partition and just run the program on a virtual machine, but since it communicates via usb I expected problems on virtual machine, and I never really bothered. In any case, Window$ chkdsk didn't detect any error on that partition.

The problem is of minor importance anyway; even more so since I rarely need to reboot Slackel; 99% of the time I just shutdown the system when my work on it is done (that is why I realized there is a problem with reboot just yesterday). If I were to guess, I'd say grub is missing a dependency, probably added later, after I installed Slackel two years ago. However, this machine runs different versions of Slackel since 2015, and I never had any similar problem. At some point I will just reinstall everything I guess. But that minor issue doesn't justify a full reinstall on an otherwise perfectly working system.