Botspot / vdesktop

Run a second instance of Raspbian inside Raspbian.
GNU General Public License v3.0
125 stars 21 forks source link

Support useradd command #10

Closed mtlynch closed 4 years ago

mtlynch commented 4 years ago

In a mounted Raspbian image, the useradd command fails.

Example on the stock Raspbian 2020-05-27 image:

sudo ~/vdesktop/vdesktop 2020-05-27-raspios-buster-lite-armhf.img cli-login
pi@raspberrypi:~ $ sudo useradd foo
useradd: failure while writing changes to /etc/shadow

Any idea what's going wrong here?

Botspot commented 4 years ago

Oh wow, this is the craziest edge case I've seen.

Vdesktop mounts a custom /etc/shadow to the guest as part of the autologin procedure to temporarily ensure pi's password is raspberry.

As it so happens, /etc/shadow not only stores hashed passwords, but also information about all users in Linux. So that explains why useradd would fail like it does. To fix the issue, delete /home/pi/vdesktop/shadow to disable the bind-mount, or run vdesktop in cli mode.