I'm getting an some kind of error at the VGA console when I make a configuration file for grub (at least I think it's an error), with

grub-mkconfig -o /boot/grub/grub.cfg

I tried to redirect stderr and stdout into a file named ~/grub_error like this:

grub-mkconfig -o /boot/grub/grub.cfg 2>&1 ~/grub_error

However, what I though to be an error, still printed to the screen (~/grub_error had stdout redirected to it, so I don't think I made a syntax error).

I also noticed that when I run grub-mkconfig in a terminal in an X session, the "error" that shows up on the VGA console doesn't show up. Is there something else I should be redirecting, because the error seemed pretty serious, something along the lines of "...could lead to file system corruption". It may be worth noting that i'm using a BIOS machine with GPT, so I have a bios_boot partition, and the error said something about /dev/sda1 (my bios_boot partition) not having and ext4 file system (which it doesn't and shouldn't).

[ 2709.836576] EXT4-fs (sda1): VFS: Can't find ext4 filesystem
[ 2709.839402] EXT4-fs (sda1): VFS: Can't find ext4 filesystem
[ 2709.841988] EXT4-fs (sda1): VFS: Can't find ext4 filesystem
[ 2709.846191] XFS (sda1): Invalid superblock magic number
[ 2709.850344] FAT-fs (sda1): invalid media value (0xe2)
[ 2709.850806] FAT-fs (sda1): Can't find a valid FAT filesystem
[ 2709.853194] FAT-fs (sda1): invalid media value (0xe2)
[ 2709.853781] FAT-fs (sda1): Can't find a valid FAT filesystem
[ 2709.855905] ntfs: (device sda1): is_boot_sector_ntfs(): Invalid boot sector checksum.
[ 2709.855913] ntfs: (device sda1): read_ntfs_boot_sector(): Primary boot sector is invalid.
[ 2709.856367] ntfs: (device sda1): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover.
[ 2709.856902] ntfs: (device sda1): ntfs_fill_super(): Not an NTFS volume.
[ 2709.859565] VFS: Can't find a Minix filesystem V1 | V2 | V3 on device sda1.
[ 2709.861950] hfsplus: unable to find HFS+ superblock
[ 2709.863881] ufs: You didn't specify the type of your ufs filesystem

               mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...

               >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
[ 2709.867491] ufs: ufs_fill_super(): bad magic number
[ 2709.872393] hfs: can't find a HFS filesystem on dev sda1
  • You're asking two different things. You should split the second one into another question.
    – h0tw1r3
    Jul 27, 2016 at 2:50
  • Sorry if it's unclear, but i'm asking how to redirect all of the output of the command, then I can ask a question regarding that output, the rest of the question is background.
    – Vityou
    Jul 27, 2016 at 2:53

1 Answer 1


You redirect stderr to stdout, but you also need to redirect stdout itself. You're just missing the > and the order of redirection is very important.

grub-mkconfig -o /boot/grub/grub.cfg >~/grub_error 2>&1


As for the difference between the console and terminal output (and seemingly lack of redirection on the console), that usually indicates a kernel message. Open another terminal and type dmesg -w. Then run the program or script again. You should see the messages that were not redirected in the console, or absent in the terminal, output by the dmesg command.

  • That didn't redirect anything into the file.
    – Vityou
    Jul 27, 2016 at 2:51
  • 1
    updated answer. the order is important.
    – h0tw1r3
    Jul 27, 2016 at 2:54
  • That seemed to work, but I still got the "error" message. So I guess it's not stdout or stderr.
    – Vityou
    Jul 27, 2016 at 2:57
  • That was it, I added the error to the question, or should I ask a separate question?
    – Vityou
    Jul 27, 2016 at 3:02
  • Let us continue this discussion in chat.
    – h0tw1r3
    Jul 27, 2016 at 3:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .