Outils pour utilisateurs

Outils du site


blog

Pb Grub Redhat - err grub2-editenv environment block too small - grubenv

Réparer un fichier grubenv modifié à la main

# grubby --args="transparent_hugepage=never" --update-kernel=ALL
grub2-editenv: error: environment block too small.

Cela arrive si le fichier /boot/grub2/grubenv a été corrompu. Il doit faire exactement 1024 octets.

Solution 1

Voir :

On copie les fichiers avant de les modifier

cp -p /boot/grub2/grubenv /boot/grub2/grubenv.bak
cp -p /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak
grub2-editenv create

Et si EFI

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
 
# Et si besoin
#ln -s /boot/efi/EFI/redhat/grubenv /boot/grub2/grubenv

Ou si BIOS

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

Pour SELinux

touch /.autorelabel

Solution 2

On copie le fichier avant de le modifier

cp -p /boot/grub2/grubenv /boot/grub2/grubenv.bak
echo "# GRUB Environment Block" > grubenv.new
grep -v "#" /boot/grub2/grub.cfg.bak >> grubenv.new
$ stat -c "%s" grubenv.new
344

$ echo $((1024 - 344))
680
dd if=<(tr '\000' '#' < /dev/zero) count=1 bs=680 >> grubenv.new
mv grubenv.new /boot/grub2/grubenv

Pour SELinux

touch /.autorelabel

Autres

Recreate file with grub2-editenv create and then set the appropriate saved_entry with grub2-editenv - set saved_entry=

2025/03/24 15:06

Pb failed to find module pci-hotplug acpiphp

after apt-get install

Nov 26 10:22:22 servername systemd-modules-load[22993]: Failed to find module 'pci-hotplug'
Nov 26 10:22:22 servername systemd-modules-load[22993]: Failed to find module 'acpiphp'

Solution

Comment lines

/etc/modules-load.d/modules.conf1
#pci-hotplug
#acpiphp
2025/03/24 15:06

Pb Err Failed to connect to bus: No such file or directory

                                                                                       
$ systemctl --user enable --now redshift
Failed to connect to bus: Aucun fichier ou dossier de ce type

Solution

export XDG_RUNTIME_DIR=/run/user/`id -u`

Source : https://askubuntu.com/questions/813588/systemctl-failed-to-connect-to-bus-docker-ubuntu16-04-container

Est-ce que systemd est bien démarré en userland

$ ps -u $USER  -f --no-headers | head -1
k8s         1333       1  0 21:56 ?        00:00:00 /usr/lib/systemd/systemd --user

Est-ce que le lingering est activé ?

Si vous avez terminez le process /usr/lib/systemd/systemd vous pouvez sous le compte root faire :

service systemd-logind status

Cela va relancer le process /usr/lib/systemd/systemd --user dans le userland des comptes qui ont le lingering activé

Autres

loginctl enable-linger $username
 
sudo service systemd-logind status
sudo apt install dbus-user-session
sudo apt install --reinstall libpam-systemd
sudo systemctl start dbus

FIXME

2025/03/24 15:06

Pb Err dmesg EXT4-fs error count initial error

Source : https://lkml.org/lkml/2010/9/26/105

# #dmesg -l warn |tail
# dmesg |tail
[8141220.179232] : inode 6946817: block 27787296
[8141220.179237] EXT4-fs (dm-4): error count: 48
[8141220.179243] EXT4-fs (dm-4): initial error at 1432118116: __ext4_journal_start_sb:62
[8141220.179248] EXT4-fs (dm-4): last error at 1453127164: ext4_put_super:789
[8141220.179263] EXT4-fs (dm-5): error count: 41
[8141220.179267] EXT4-fs (dm-6): initial error at 1432127211: ext4_mb_generate_buddy:755
[8141220.179270] EXT4-fs (dm-5): initial error at 1432648670: __ext4_journal_start_sb:62
[8141220.179274] EXT4-fs (dm-5): last error at 1453127158: ext4_put_super:789

[8141220.179284] EXT4-fs (dm-6): last error at 1473645508: ext4_mb_generate_buddy:755
$ date --date=@1473645508
Mon Sep 12 03:58:28 CEST 2016

Ou plus simple, pour avoir les dates et heures

dmesg -T

Généralement peut être ignoré.

2025/03/24 15:06

Cloud - Terraform import - OpenTofu import

Importation d'une instance dans le "state"

import.tf
provider "aws" {
  profile    = "default"
  region     = "eu-west-1"
}

resource "aws_instance" "inst1" {
  # (resource arguments)
}
terraform import aws_instance.inst1 i-0127e23e987f1f08a

Création de la définition de notre instance

terraform state list
terraform state show -no-color aws_instance.inst1 > aws_instance-inst1.tf
 
mv import.tf import.tf.bak
 
terraform fmt aws_instance-inst1.tf

Créer ce fichier

region.tf
provider "aws" {
access_key = ""
secret_key = ""
region = "eu-west-1"
}
Correction du code
terraform plan -target=aws_instance.inst1 2>&1 |grep Err
Error: "public_ip": this field cannot be set
Error: "arn": this field cannot be set
Error: "public_dns": this field cannot be set
Error: "instance_state": this field cannot be set
Error: "root_block_device.0.volume_id": this field cannot be set
Error: "private_dns": this field cannot be set
Error: "primary_network_interface_id": this field cannot be set
Error: : invalid or unknown key: id

Commenter les ligner en erreur (“public_ip, arn…”)

aws_instance-inst1.tf
# aws_instance.inst1:
resource "aws_instance" "inst1" {
  ami                          = "ami-0a3c5e107eda3e29b"
  #arn                          = "arn:aws:ec2:eu-west-1:299632874688:instance/i-0127e23e987f1f08a"
  associate_public_ip_address  = true
  availability_zone            = "eu-west-1b"
  #cpu_core_count               = 1
  #cpu_threads_per_core         = 1
  disable_api_termination      = false
  ebs_optimized                = false
  get_password_data            = false
  #id                           = "i-0127e23e987f1f08a"
  #instance_state               = "running"
  instance_type                = "t2.micro"
  ipv6_address_count           = 0
  ipv6_addresses               = []
  key_name                     = "My keyPair"
  monitoring                   = false
  #primary_network_interface_id = "eni-034b4bb5957d77123"
  #private_dns                  = "ip-172-31-237-138.eu-west-1.compute.internal"
  private_ip                   = "172.31.237.138"
  #public_dns                   = "ec2-34-241-189-63.eu-west-1.compute.amazonaws.com"
  #public_ip                    = "34.241.189.63"
  security_groups              = []
  source_dest_check            = true
  subnet_id                    = "subnet-0d63fcd2f893bbb9b"
  tags = {
    "Name" = "InstanceName"
  }
  tenancy     = "default"
  volume_tags = {}
  vpc_security_group_ids = [
    "sg-0e09491e039edf3dd",
  ]

  credit_specification {
    cpu_credits = "standard"
  }

#  root_block_device {
#    delete_on_termination = true
#    iops                  = 100
#    volume_id             = "vol-02ccd390ba7b838cd"
#    volume_size           = 8
#    volume_type           = "gp2"
#  }

  timeouts {}
}
#terraform plan -target=aws_instance.inst1
terraform apply
Error: Error launching source instance: UnsupportedOperation: The t2.micro instance type does not support specifying CpuOptions.
        status code: 400, request id: e6bb04ea-3f2a-47d7-a140-98d12857ceed

Commenter les lignes “cpu_core_count” et “cpu_threads_per_core” puis

terraform plan |grep 'known after apply'
#terraform taint aws_instance.inst1
terraform state rm aws_instance.inst1
terraform apply
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki