Choose-a-VM Thin Client with Raspberry Pi + Proxmox

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so we got a pretty standard raspberry pi login screen here we got our user pi we got a little bit more we got windows 10 with gpu ubuntu desktop vm what are these well both of these are virtual machines running in proxmox and i've configured it so when you log into this account it takes you straight to the virtual machine so if we log into windows 10 you should get the virtual machine there we go we're connecting to the server and there boom windows this video is going to walk through how to set up this thin client login so when you log into a user on the raspberry pi it jumps to a thin client you can use this to connect to all of your virtual machines remotely or let the user choose which virtual machine they want to connect to i know that these little guys are preciously hard to find right now so i've also got instructions in my blog post link in the description for how to do all of this on a standard debian install if you've got an old laptop or an old computer lying around you want to use it with so i have a previous video link up there in the card where i went through setting up proxmox for spice based thin clients and this is the same kind of setup but i'll just go over real quick again so the short answer is we need to set up the display on a virtual machine to use spice as the graphics card we can optionally add usb devices or sound cards that we can pass through from the virtual machine to the client which in this case is the raspberry pi we created a user here called vdi user in the pve realm so proxmox manages the password and this is the user account that we've hard coded into a shell script on the thin client and we've given that user permission to access vm 106 as console so the role of pve vm user that gives them enough permissions to access vm 106. so i've just finished the raspberry pi setup process i got a brand new raspberry pi install and we're going to configure it with raspby config so system options auto login at boot we need to change auto login at boot to be desktop auto login requiring user to log in this way when the thin client comes up you can select which virtual machine you want to be redirected to we're going to enable the ssh server so we'd say yes and that's it so we'll let it reboot we'll come back so now that we've disabled auto login when the pi boots up we get a screen like this we've got a drop down box or we can pick pi or we can type a user in our self and we have to type the password in so now that we have the ssh server installed and running i've switched over to ssh because a little bit quicker to copy and paste commands so now we need to install vert viewer which includes the remote viewer utility boom and now that that's done we're going to create the thin client script and this is similar to the script we created in the last video but we're going to share this between all the users so we're going to put it in a common location instead of in the user's home directory so i'm going to put it in user local bin so everyone can access it so again like the last video i'm going to copy and paste the script in and then we're going to walk through it so we start again with similar stuff you type in your username and password so in this case we're going to take the vmid as an argument since we're using this script for more than one vm passing in the vm id is a good way to do it in this case i only have one proxmox host so we can just put the node here as we normally would either the dns name or the name of the node and then down for proxy again we either do the dns name or the ip address of the node if you have a cluster you can pick any any i p address or any node in the cluster if you have separate servers then you would have to make these arguments as well so that your you can pass in which server you need to connect to another little tidbit i did i changed since the last version of the script i changed this curl command to remove the forced proxy so if you have a cluster it'll automatically connect to whichever node is currently running the vm instead of potentially proxing it through a different node down here for remote viewer we've switched from using kiosk mode to using full screen mode and we remove the exact command and that means the script will continue to run after remote viewer terminates and the final thing we did is we call kill all x session or lx session so lx session is what runs the lxde user session so killing it will kick us back to the login screen i know this kind of seems like a hack but if you actually read through the lxde like code this is exactly what they do they send sig term to lx session and then lx session decides that it must log out so this is the script so we'll save that and we'll make it executable and now it's there ready for us so we can use it in other places so now we're going to create a user on the local system for each virtual machine we want to be able to log into so in this case i have i have a couple so we'll start by adding one for ubuntu so we'll call him vdi ubuntu and then it asks us for a password we have to give it a password we can't leave it blank here and now here's a quick tip the full name is the name it's going to show in the login manager so if we call it like ubuntu desktop vm that's what's going to show up in the login manager in the drop down box the full name you leave all the rest of these blank information is correct so now we have a new user called vdi ubuntu and the login screen is going to show ubuntu desktop vm so we could do another one for windows 2. we're going to name this one windows and with view that is correct so if we want to let users log into one or more of these vms without a password we have to do a little bit of a hack so what you could just do is tell the users to log in with a password and then only users who know the password can log into specific vms but if we have a vm we like everyone to be able to access we can do a little management with pam which is what does linux authentication to let it authenticate users without a password you're not going to want to do this for any user that has pseudo permissions because that's quite dangerous but in this case our vdi windows and vdi ubuntu users don't really have any permissions at all so we're going to do this so we're going to edit the file etsy pam dot d lite dm and this file essentially defines the rules that pam follows when it decides if it should accept or reject the login request from light dm and light dm is what manages the login screen so we're going to add a line right here at the top that says off sufficient and then pam succeed if dot so and then user in group no password login so that means that if the user is part of the group no password log in and it'll let them log in through light dm but not through ssh or through other things without using their password so save that and now we'll create that group and we're gonna add our ubuntu one to it but not our windows one so people have to type the password in to get to windows but not to get to ubuntu there we go so this next bit is a little bit dangerous basically what happens when you log in to an lxde window session is lxde calls a script called the auto start script for the system and this launches things like the taskbar at the top the desktop desktop icons etc and then after that it calls the auto start file for the user which includes any programs the user wants to start automatically and so for users that are thin client users that the user launches into a remote session we don't want to include any of this desktop junk we just want to go straight into the thin client so we're going to do is we're going to get rid of the system auto start file and move it to the user auto start file so the user pi is going to have their auto start file launch the basic desktop environment like we would expect and any other user is just going to get dropped into a blank desktop background they're going to have a picture and that's it so so first we need to move the auto start file to make a copy of it so we're going to move the file is called etsy xcg lxsession lxde pi autostart and we're going to move it to that same file with an in.back and that way it's there for safekeeping then we're going to create a blank file to replace the autostart file just so lxd doesn't freak out so just using touch will create the file and now we're going to create that our own file in our own user directory that copies what this file used to be so first integrate the folder it goes in and then we can copy it and so essentially what this is going to do is when the user logs in as pi it's going to launch all of the desktop programs that are part of lxde that were supposed to be launched already by the system so that includes lx panel which is the menu bar at the top pcman fm which is the desktop icons that kind of stuff now i've logged in over ssh as the ubuntu user and this is a user we want to drop into a thin client we don't want to drop them into a normal desktop session so we need to create an auto start file for this user that instead of launching lx panel and pc management and that good stuff it launches into our thin client script so here's what we're going to do so first you have to create the folder that it goes in and then we create the file and then i'll show you what goes in there so it's uh in the user's home folder it's under dot config lx session lxdepi autostart and it's pretty simple i'm just gonna have one line so this line is not a shell script that does not get evaluated as such so at means a file to execute and we want to execute bash which is the command line interpreter and then we're gonna give it the path to our shell script which is user local bin thin client and then the argument is the vm id in this case 106 is ubuntu we'll save that and so now you have to do that for every single vm you want to be able to access from the system so i'll do this again for windows and then i'll come back and show you what it looks like now i should be able to log out here and log in to the ubuntu it should just connect click log out so we got user pi who needs the password or we could pick ubuntu desktop vm let's try that one this should work without a password we should be a hit enter and it should log us right in there it goes connecting the graphic server so we're in full screen mode instead of kiosk mode which means the user has access to usb passer and things like that so here we are we're in ubuntu's now what happens when we exit so we go up here and we exit the thin client should drop us back in the login screen all the color bars are my video capture device yep so here we go back in the login screen so in the first video we had the raspberry pi boot up directly into a single thin client session this meant that there was a one-to-one relationship between the raspberry pi and the virtual machine with this video we can now choose between a few virtual machines we've pre-configured on the pi the ultimate goal though is to get a setup more like a commercial vdi solution where the user can pick the type of virtual machine they like and when they log into it we spin up a new clone of a virtual machine just for the user but we're not quite there yet this is a step in the right direction though and it gets us closer to the ideal open source virtual desktop infrastructure thank you for watching if you liked the video please consider liking and subscribing so youtube can recommend more from me in the future
Info
Channel: apalrd's adventures
Views: 10,319
Rating: undefined out of 5
Keywords:
Id: sNgmMxrnLn8
Channel Id: undefined
Length: 12min 50sec (770 seconds)
Published: Thu Mar 10 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.