Can't use sudo error with PAM: No such file or directory

Creating a bug report/issue

Required Information

  • DietPi version 8.21.1
  • Distro version | buster 1
  • Kernel version | Linux DietPi 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux
  • Architecture | armhf
  • SBC model | RPi 4 Model B (armv71)
  • Power supply used | Official RPi powersupply
  • SD card used | SanDisk ultra

Additional Information (if applicable)

  • Software title | sudo
  • used to work without issue, recently checked for a routine update but it now fails

Steps to reproduce

  1. use sudo with any command
  2. error returned: sudo: unable to initialize PAM: Invalid argument
  3. I have checked /etc/pam.d/* files and they seem ok

Expected behaviour

  • password is prompted
  • command is executed with admin privilages

Actual behaviour

  • error returns
  • command isn’t executed

Extra details

  • Because of this I cannot inspect journalctl logs as it requires su privileges and other such commands like dietpi-update

Did you modify or change anything?
If this appears out of the blue without any user interaction, I would guess data corruption is the cause of this.maybe you can perform a filesystem check.
A workaround, until we found the cause, could be to log in as root or change to root.
If you are already logged in as dietpi or whatever, you can do

su -l root

I’ve not modified or logged in for a long time. I use ssh to login which does work, but trying your command su -l root returns Segmentation fault

uhhh that sounds like some corruption. I see your system is quite old, running Debian Buster still. Maybe SD card ist giving up slowly.

that’s a shame, this is already a replacement for the last one.

Any suggestions on what to install the OS on for RPis? Are USB connected HDs fast enough? I don’t really store anything on the SD, I use a NAS, the SD is just for the OS and programs

You are running Debian Buster, how old is your SD card?

The quality of the SD card is crucial, cards that are too cheap die more quickly

Usually HDD/SDD are faster than SD cards.

But I/O speed doesn’t seems to matter in your case

Theoretically, you can also use a USB stick, it does not have to be a HDD/SSD. Another alternativ is to use RaspiKey eMMC modul for Raspberry Pi device.

Thanks for your advice, I may look into a USB drive in that case for the future, however I would like to recover as much as possible from this drive if I can.

Is there anything I can do from the position I’m in without having to mount this drive on another system and backing up my settings and programs?