sudo update-grub: *******#: 見つかりません

sudo update-grub: *******#: 見つかりません

GRUB 設定ファイルを編集してsudo update-grub更新しようとしましたが、次のような出力が表示されました。

Sourcing file `enter code here`/etc/default/grub
/usr/sbin/grub-mkconfig: 1: /etc/default/grub: *******#: not found

* は私のアカウントのパスワードに似た数字です。私も試してみましたsudo update-grub2が、うまくいきませんでした。どうすればいいでしょうか?

答え1

システムのコマンドupdate-grub(これは実際には コマンドの小さなショートカットです)に問題はありません。編集中に何らかの理由でファイルに不要なテキストを挿入しただけです。grub-mkconfig -o /boot/grub/grub.cfg/etc/default/grub

zanna@toaster:~$ sudo update-grub
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: junk: not found

私の場合、 はjunk35 行目にあります。あなたの場合は、 1 行目にあります。最初に不正なテキストを挿入したか、ファイル全体を上書きしたかのどちらかです。

おそらく、ファイルを再度編集し、*******(または質問で表すもの) を含む行と、そこにあってはならない他の挿入行を削除することで、この問題を修正できるでしょう。

通常、システム用の最新のダウンロード済みパッケージ メンテナのバージョンのファイルは にあります/var/lib/ucf/cache/:etc:default:grub。たとえば、次のコマンドを実行してこのファイルを読み取ることができます。

cat /var/lib/ucf/cache/:etc:default:grub

たとえば、次のコマンドを実行すると、編集したファイルとこのファイルの違いを確認できます。

diff /var/lib/ucf/cache/:etc:default:grub /etc/default/grub

最悪の場合、紛失または破損した部品を交換する必要がある場合は/etc/default/grub、このコマンドを使用できます(/etc/default/grubこのコマンドにより既存のものは自動的に上書きされます)。

sudo cp /var/lib/ucf/cache/:etc:default:grub /etc/default/grub

答え2

ファイルが/etc/default/grub存在するかどうかを確認します。存在しない場合は、以下のようにファイルを作成します。

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# 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"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=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=640x480

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

# 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"

あなたが試すことができます:

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

以下も参照このUbuntuフォーラムのスレッド

関連情報