asb / raspi-config

Configuration tool for the Raspberry Pi. Now maintained at https://github.com/RPi-Distro/raspi-config
Other
263 stars 328 forks source link

Boot options (e.g. to turn autologin on/off) don't work with Jessie Lite (or if /etc/init.d/lightdm doesn't exist) #59

Closed geekycow closed 8 years ago

geekycow commented 8 years ago

(NOTE: This is a dupe of [https://github.com/RPi-Distro/raspi-config/issues/4] - I'm not sure where new issues are supposed to go.)

Hi

I've encountered a problem where I couldn't use raspi-config to switch between boot options, e.g. to turn console autologin for user pi on or off.

Having looked at the script, it looks like boot options can only change if /etc/init.d/lightdm exists - on non-graphical light installations where lightdm doesn't exist, such as Jessie Lite, that means it's impossible to change boot options using raspi-config.

How about changing-

      B1*)
--->    if [ -e /etc/init.d/lightdm ]; then                               <--- DELETE THIS LINE
          if [ $SYSTEMD -eq 1 ]; then
            systemctl set-default multi-user.target
            ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
          else
            update-rc.d lightdm disable 2
            sed /etc/inittab -i -e "s/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/"
          fi
--->    fi                                                               <--- DELETE THIS LINE
        ;;
      B2*)
--->    if [ -e /etc/init.d/lightdm ]; then                              <--- DELETE THIS LINE
          if [ $SYSTEMD -eq 1 ]; then
            systemctl set-default multi-user.target
            ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
          else
            update-rc.d lightdm disable 2
            sed /etc/inittab -i -e "s/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/"
          fi
--->    fi                                                               <--- DELETE THIS LINE
        ;;

To-

      B1*)
        if [ $SYSTEMD -eq 1 ]; then
          systemctl set-default multi-user.target
          ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
        else
--->      [ -e /etc/init.d/lightdm ] && update-rc.d lightdm disable 2       <--- CHANGE TO THIS
          sed /etc/inittab -i -e "s/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/"
        fi
        ;;
      B2*)
        if [ $SYSTEMD -eq 1 ]; then
          systemctl set-default multi-user.target
          ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
        else
--->      [ -e /etc/init.d/lightdm ] && update-rc.d lightdm disable 2       <--- CHANGE TO THIS
          sed /etc/inittab -i -e "s/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/"
        fi
        ;;

Thanks for all your hard work! Loving the Pi and about to get another soon. :)

Seasons Greetings Julie x