⬆️ ⬇️

One computer for two (or more) or multiseat based on Ubuntu 10.04 LTS

This article discusses the implementation of multiseat based on Ubuntu 10.04 LTS with hardware acceleration. The example considered in this article has already been put into operation and has been working for about six months in a regular Minsk office. Describes the problems of implementation and implementation of the finished system in the work from the point of view of the ordinary student electrician, who earns part-time job as a system administrator.



Introduction





Here is the time when the system administrator works in a small office when updating the computer park, there is a small problem. Modern computers give a performance level that is much higher than what is needed for office computers. Moreover, the realities of the market are such that differences in performance have little effect on price. And the seemingly cheap Atom-based computers do not differ in price from the more productive computers based on conventional Amd and Intel processors (a motherboard with an Atom processor costs about 100-150 cu for May 2010, Minsk, and the same price for October 2010 in the same Minsk).

')

The same situation with hard drives: for office work there is no need for a disk size of more than 40-80 GB. But such hard drives are practically not represented on the market. At the time of this writing, 160 GB ($ 38), 250 GB ($ 39), 320 GB ($ 40), 500 GB ($ 41) hard drives were on sale, further price differences are more noticeable. The price per gigabyte of small hard drives is quite high. The same situation with all other components.



A natural question arises, how is it rational to use all this? Let's go logically - to reduce the cost of the system, you can either buy components worse (not much cheaper), or abandon some components. In fact, in the workplace, input devices (keyboard, mouse, tablet, etc.) and information display devices (monitor, projector, etc.) are required. The rest of the user system is not particularly relevant, and you can get rid of it. Of course, get rid of everything will not work. Let's look under the cover of the system unit. Here we always see the motherboard, the video card (maybe already on the motherboard), the processor (also on the motherboard) and memory. But the rest of the components are not so important. The optical drive is of little demand, and therefore it probably will not.

The hard disk is also an interesting situation. It may not be, then we will have a so-called diskless station. Here all information is downloaded over the network from the server (implementation of PXE + NFS and a little tambourine). But I want something more.

Then the idea arose to connect two keyboards, two mice and two monitors to one computer and make them work independently. In foreign sources, such systems are called multiseat .

But you can not limit yourself on this, but make a diskless multiseat station. This option is perfect for a pair of multiseat stations with a server. This article is not covered.







Let's take a closer look at multiseat. To connect the necessary number of keyboards and mice, we will have to use USB ports. Now this is not a problem. To connect multiple monitors, we need either several ports on a video card, or several video cards, or we can combine these options.



After setting all this up, we should get the number of workplaces we need, which can satisfy all user needs. Processor time and memory is divided between these users, and the situation when all users simultaneously need all system performance is very rare.



At first glance, it turns out very profitable system. But why, then, about such systems, few have heard? The answer is quite simple - setting up such systems is quite complicated. And not every administrator (even a professional) will be able to put all these components together and make them work.



Implementation options





Let's try to start implementing such a system. Let's start with the choice of operating system. Multiseat can be built on the basis of modern OS: Linux, Windows and, possibly, others.



Immediately, an interesting option for many based on Windows OS is in fact impractical. First, the license prohibits installing one copy of Windows into such systems, so it requires the purchase of two licenses, which immediately kills many advantages, including cost savings. Secondly, it’s very problematic to make such a system, since need to write or buy additional software. For the price, this option comes close to the option of buying two independent computers, or even exceeds it. This option is considered here . It also has advantages - you don’t have to think and do much. Everything is ready, just put the software and get the result.



The second option - multiseat based on Linux - has many solutions. Among them it is possible to distinguish both a solution without hardware acceleration (XGL, Xephyr, Xnest, etc.), and with hardware acceleration (xorg). This article describes the implementation of multiseat with hardware acceleration based on Ubuntu Linux 10.04 LTS.



The system is quite flexible and can work with any number of monitors. In theory, each of the video cards runs on its own graphic X-server. Next, each server launches a graphical desktop environment (Gnome, KDE, etc.) ... profit :). Therefore, the PC on which the multiseat system will be based must have the necessary number of video cards.



In essence, the Linux kernel assumes all the functions of allocating hardware resources. Graphic servers take the video card to their full use and receive CPU time from the Linux kernel.



Implementation





And now for the practice. Oddly enough, it is different from theory. In my case, the system was an ASUS M3A78-CM motherboard with an integrated ATI Radeon 3100 video card. A second ATI Radeon 2600 video card was purchased and installed in a single PCI Express 16x slot. Install more video cards is not a problem, the problem is to get a PCI Express 1x video card. But there is a wonderful solution . Next step: make sure that the two video cards are working simultaneously. It is assumed that at this moment you already have the Linux operating system installed, where there is a great console command lspci, which shows all the pci devices on your system. To restrict to devices in which the word VGA is present, you can make the following structure: lspci | grep vga. In my case, the picture was:



andrey@k211-multiseat:~$ lspci | grep VGA

01:05.0 VGA compatible controller: ATI Technologies Inc Radeon 3100 Graphics

02:00.0 VGA compatible controller: ATI Technologies Inc RV630 [Radeon HD 2600 Series]




Here we see our two video cards. Of course, they did not appear here immediately. I had to get into the BIOS a couple of times and change the settings. The result met expectations.

Further, by inertia, the proprietary ATI driver was installed. This was a very gross mistake. But I understood about it later. And I will tell you too later :).



Now some more theory. Consider how the system boots. Until the display manager is loaded (GDM, KDM, etc.), a lot of things happen, but this will remain outside the scope of this article. Once the display manager has loaded, it will require you to enter a username and password (or will not require it if you configured it that way). And then he starts the Xorg server and the working environment you have chosen. If you ask him well, he can run several Xorg servers with different settings and for different users and, if desired, with different desktop managers.



KDM setup




And now to practice. Some display managers are very difficult to persuade and even patch them (GDM), so choose KDM, which is more compliant. By default, it is not installed in the system. Installation is solved by a simple command in the console: sudo apt-get install kdm. We agree and wait. If all is successful, KDM is installed. Now we will start to persuade him :). The file responsible for configuring the manager is in / etc / kde4 / kdm and is called kdmrc. It has a lot of settings, but we are only interested in a couple. In the [General] section, we change two parameters in this way:



[General]

StaticServers=:0,:1

ReserveServers=:2,:3




This means that KDM will start servers 0 and 1, and servers 2 and 3 will not touch. Next, look for the [X-: 0-Core] section and change the setting in it in this way:



[X-:0-Core]

ServerAttempts=2

ServerArgsLocal= -br -nolisten tcp -layout seat1 -isolateDevice PCI:2:0:0 vt6

AutoLoginEnable=true

AutoLoginUser=alexandr




The first parameter, ServerAttempts = 2, probably does not affect anything, it appeared by long knocking on a tambourine and attempts to start the system. As they say, it happened historically :).

The most important parameter is the following, ServerArgsLocal = -br -nolisten tcp -layout seat1 -isolateDevice PCI: 2: 0: 0 vt6. Consider it. These are the launch arguments for the Xorg graphical server. Let's look at them:

–Br - instead of a gray pattern there will be a black background. So a little prettier.

-nolisten tcp - this option says that it is not necessary to use tcp / ip to work, or that the server is started locally.

-layout seat1 tells you which configuration to use from the xorg.conf file (about it later).

-isolateDevice PCI: 2: 0: 0 - the main option, asks the server to use only one video card, which is PCI: 2: 0: 0.

vt6 indicates that the server will start on the sixth virtual terminal.



The next option (AutoLoginEnable = true) enables automatic login to the system under the user AutoLoginUser = alexandr. Do not forget to change it in the name of your user :).



Next, we modify the file this way:



[X-:1-Core]

ServerAttempts=2

ServerArgsLocal= -br -nolisten tcp -layout seat0 -sharevts -novtswitch -isolateDevice PCI:1:5:0 vt5

AutoLoginEnable=true

AutoLoginUser=andrey




We are already familiar with almost all options. Pay attention to -layout seat0. This is another configuration of seat0 from the xorg.conf file. Two identical configurations can not be, because nothing will work. Also changed is the -isolateDevice PCI device: 1: 5: 0 and the virtual terminal vt5. The -sharevts option causes the server to work simultaneously on one terminal, and -novtswitch prohibits changing the current terminal by pressing the Ctrl + Alt + n keys, where n is the virtual terminal number. More details about the x-server launch options can be found in the console (man xserver). Next comes the option to enable autologin and the user name (andrey).

Oh, and do not forget to create two users. This can be done with the command in the ADDUSER console. There is also a graphical shell. At the first launch, you should disable the autologin option so that you can select the graphical environment manually.

There is another important point. Probably you have already noticed that virtual terminals 5 and 6 are used, and not 7, which is the default for the xorg server. This is due to the fact that if you press the key combination Ctrl + c (a fairly common combination) on the keyboard of the second workstation, then xorg on vt7 drops. Very unpleasant feature. But it is solved by simply mixing xorg from vt7 to any other vt.



Configure xorg.conf




We now proceed to the basic configuration, namely, we will set those same seat0 and seat1. For this we need the file /etc/X11/xorg.conf, which you may not have, but you can create it. We write the following lines into it:



Section "ServerLayout"

Identifier "seat0"

Screen 0 "Screen0" 0 0

InputDevice "Mouse0" "CorePointer"

InputDevice "Keyboard0" "CoreKeyboard"

EndSection




This means that we have defined the profile seat0 with the Screen0 screen, the mouse Mouse0 and the Keyboard0 keyboard. The second profile is determined in the same way:



Section "ServerLayout"

Identifier "seat1"

Screen 1 "Screen1" 0 0

InputDevice "Mouse1" "CorePointer"

InputDevice "Keyboard1" "CoreKeyboard"

EndSection




The thoughtful reader has probably already wondered: “What is Screen1, Mouse1, Keyboard1, Screen0, Mouse0, Keyboard0?” These devices are defined in the same file.



Section "InputDevice"

Identifier "Keyboard0"

Driver "evdev"

Option "Device" "/dev/input/by-path/platform-i8042-serio-0-event-kbd"

Option "XkbModel" "pc105"

Option "XkbRules" "xorg"

Option "XkbLayout" "us,ru(winkeys)"

Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"

EndSection




In modern Linux, evdev is responsible for input devices, so it is indicated as a driver. One of the most difficult stages of setup is to determine the identifier for the keyboard that you need. All input devices are located in the / dev / input / folder, where they are duplicated in the by-path and by-id folders. Or there are event0 - event5 files for keyboards. You need to choose one of the keyboards that you enjoy. Determining the correctness of the choice is quite simple: just type sudo cat / dev / input / eventX in the console, where X is your keyboard number. When you press a key on this keyboard, a symbol should appear in the console.

Each such event is the same as the keyboard in / dev / input / by-path / and / dev / input / by-id /. So do it because it is more convenient for you. I have two different keyboards, so it’s more convenient for me to navigate by model, but with the same keyboards, it’s probably more convenient to work with event.

The "XkbModel" option "pc105" says that we will have a standard 105-key keyboard. The “XkbLayout” option “us, ru (winkeys)” adds two layouts: us and ru (English and Russian).

The “XkbOptions” option “grp: alt_shift_toggle, grp_led: scroll” means that the switching of the layouts is performed by the alt + shift combination, and the scroll lock LED will light up on the Russian layout.



For the second keyboard, everything is almost the same:



Section "InputDevice"

Identifier "Keyboard1"

Driver "evdev"

Option "Device" "/dev/input/by-id/usb-Chicony_USB_Keyboard-event-kbd"

Option "XkbModel" "pc105"

Option "XkbRules" "xorg"

Option "XkbLayout" "us,ru(winkeys)"

Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"

EndSection




Go to the mice.



Section "InputDevice"

Identifier "Mouse0"

Driver "evdev"

Option Device" "/dev/input/by-id/usb-PIXART_USB_OPTICAL_MOUSE-event-mouse"

Option "GrabDevice" "on"

Option "Buttons" "12"

EndSection



It seems everything is like in the keyboard, but there is an Option Option "GrabDevice" "on", which captures all the events from the device in exclusive use. And Option "Buttons" "12", which says that our mouse will have 12 keys.



Now the screens.



Section "Screen"

Identifier "Screen0"

Device "Device0"

DefaultDepth 24

EndSection




We define the device to which the screen is connected (Device0) and, in every case, the depth of color. We do the same with the second screen.



Section "Screen"

Identifier "Screen1"

Device "Device1"

DefaultDepth 24

EndSection




And here are the devices.



Section "Device"

Identifier "Device0"

Driver "radeon"

VendorName "ATI Technologies Inc"

BoardName "ATI 3100"

BusID "PCI:1:5:0"

Option "Int10" "off"

EndSection




Once again I draw attention to the driver "radeon". In no case is the ATI proprietary driver (I can’t say anything about Nvidia cards, but there’s just the opposite). A little later, I will tell you more about why. BusID "PCI: 1: 5: 0" - those same figures for this video card, obtained with the command lspci | grep vga. Option "Int10" "off" disables the initialization of the video card using a BIOS interrupt. This option is required. Without it, you will not succeed.



And for the second video card.



Section "Device"

Identifier "Device1"

Driver "radeon"

VendorName "ATI Technologies Inc"

BoardName "ATI 2600"

BusID "PCI:2:0:0"

Option "Int10" "off"

EndSection




Also in the xorg.conf file you must specify the server settings.



Section "ServerFlags"

Option "DefaultServerLayout" "seat0"

Option "AllowMouseOpenFail" "true"

Option "AutoAddDevices" "false"

Option "AllowEmptyInput" "false"

EndSection




Consider all the options:



“DefaultServerLayout” “seat0” - if something happens to kdm and xorg starts up without parameters, the server needs to know which configuration to load.

“AllowMouseOpenFail” “true” - even if there is no mouse, then consider the mouse working and not confuse the server. In fact, it shouldn't seem to work when using evdev. Perhaps no longer in use. But historically it happened :)

“AutoAddDevices” “false” - prohibits adding devices automatically, only those that are registered in the xorg.conf file. Otherwise, a kind person will come and connect the mouse to the computer, and, logically, it will appear in all workplaces and will interrupt the mouse defined by the corresponding desktop. We do not need this, and therefore disable. And let a kind person look at a mouse and think: “What is it not working for?” There is no need for an authorized person to install mice in complex systems. Breaks something else :)

“AllowEmptyInput” “false” - does not add a standard driver for the mouse and keyboard, if suddenly we forgot to register the mouse and keyboard in xorg.conf.



First start





Here is the first stage and finished. Now you can reboot and, if everything went well, you will see a KDM prompt to enter your login and password. It remains to enter the username and password, choose the working environment, then, if everything is good, enable autologin in the / etc / kde4 / kdm / kdmrc file and configure the system further :).



My graphics server load looks like this:



image



Such a beautiful picture is obtained by the wonderful bootchart program. Here is the full version of the chart .



And now I will tell you why it was impossible to install a proprietary ATI driver. This driver is very difficult to persuade. It takes the -isolateDevice option somewhat differently. A long analysis of the xorg server logs showed that something like this happens.



Runs the first X server (xorg1), which launches the proprietary ATI driver (fglrx1).

fglrx1 - wow, video card, wow, it suits me. We will work with her.

fglrx1 - wow, second. Class, I want. In general, I like it, I take it too.

Xorg1 - ok, working.

Run the second X server (xorg2), which launches the proprietary ATI driver (fglrx2).

fglrx2 - uh-uh, and where is the video card? No, man, I do not understand where the video card?

fglrx2 - well, work yourself without a video card.

Xorg2 - uh ... who offended the driver, why did he leave me (running away from the computer)? Come back, fglrx2, I will forgive everything.



There is no such thing with an open driver. It perfectly recognizes the launch option on a separate device.



Solved problems





Continue to configure the system further. Although everything works, but there are always a lot of little things that are not noticeable at first glance. When we were just taking the setting, we could not even assume that in this configuration the computer would refuse to restart and shut down. It would seem, why? And all because of such interesting pieces as ConsoleKit and PolicyKit . Information on them is not very much, but it all comes down to the fact that PolicyKit allows unprivileged processes to communicate with privileged ones. Or, more simply, he controls the policy of the system. In our case, it is he who does not allow us to turn off the computer, because we do not have rights to it. Information for PolicyKit about who we are is given by the same ConsoleKit, and the task of this subsystem is to keep track of users, their sessions and those sets. But that's bad luck, there is a very bad addition in the documentation: “True, hardware, multi-seat capabilities will be added later.” And we want multiseat now. You can patch ConsoleKit, but let's get a little deeper and see if we can do without it. When a user logs in, a session is created for him, and the session is marked as active. But when two users simultaneously log in (our multiseat), it creates two sessions, but ConsoleKit is lost and makes them inactive. You can view current sessions by typing ck-list-sessions in the console.



andrey@k211-multiseat:~$ ck-list-sessions

Session1:

unix-user = '1000'

realname = ''

seat = 'Seat3'

session-type = ''

active = FALSE

x11-display = ':1'

x11-display-device = ''

display-device = ''

remote-host-name = ''

is-local = TRUE

on-since = '2010-10-25T14:14:04.812473Z'

login-session-id = ''

Session2:

unix-user = '1001'

realname = ''

seat = 'Seat4'

session-type = ''

active = FALSE

x11-display = ':0'

x11-display-device = ''

display-device = ''

remote-host-name = ''

is-local = TRUE

on-since = '2010-10-25T14:14:05.146443Z'

login-session-id = ''




I tried to persuade ConsoleKit to make sessions active for a long time, until I decided to enter from the other end. The computer does not allow you to turn off PolicyKit, which has rules to turn off the computer, and an inactive user does not resemble it. We are looking for a file that is responsible for turning off the computer policy, and find all the policies in this folder / usr / share / polkit-1 / actions. The file responsible for shutdown, reboot, etc. called org.freedesktop.consolekit.policy. Open it. And we see the usual xml-file. In the section we see a lot of events. Let's look at the first.



Stop the system

System policy prevents stopping the system

<allow_inactive>no</allow_inactive>

<allow_active>yes</allow_active>







The action id field indicates the action. In this case, the system shutdown. Next is a description, that is, a description of what it is. This text will be displayed if necessary authorization for this action. The message field indicates the message that the person will receive if necessary authorization. Next comes the section that manages permissions on actions. It has two fields: allow_inactive - the condition for permission to perform an action to an inactive user (both, but this is our inactive session in the ConsoleKet) and allow_active - to the active one. In general, the documentation also says about the allow_any field. But at the time of the creation of this system, I have not heard anything about it, perhaps the option appeared later. The parameters can be such keys:



no - refuse action

yes - allow actions

auth_self - request user password

auth_admin - request administrator password

auth_self_keep - request a user password and remember it for a while

auth_admin_keep - request an administrator password and remember it for a while.



Now we change the <allow_inactive> no </ allow_inactive> option to <allow_inactive> yes </ allow_inactive> and we can turn off the computer from any user, but under the condition that we have only one session on the computer, and not two. For other actions, change the options to the following:

Stop the system when multiple users are logged in

System policy prevents stopping the system when other users are logged in

<message xml:lang="ru">! . ?

<allow_inactive>auth_admin_keep</allow_inactive>

<allow_active>auth_admin_keep</allow_active>







Here, this is our case. We have two users, and when one wants to turn off the computer, a window is displayed with a request to enter a password. If there is one user in the system, the window will not appear.



Many will ask, why password? Let's imagine the situation. Here are two people working at the computer. One goes home and turns off the computer, forgetting that the second person is still working. As a result, the computer shuts down to the great indignation of the second, who is not ready for such a development. The warning with the requirement to once again enter the password still saves nerves to both users.



The remaining parameters are similar.



Restart the system

System policy prevents restarting the system

<allow_inactive>yes</allow_inactive>

<allow_active>yes</allow_active>







Restart the system when multiple users are logged in

System policy prevents restarting the system when other users are logged in

<message xml:lang="ru">! . ?

<allow_inactive>auth_admin_keep</allow_inactive>

<allow_active>auth_admin_keep</allow_active>







With the shutdown and restart of the computer sorted out.



Usb drives





Another interesting situation occurs when using a USB drive. We insert the flash drive, and two copies of Gnome (in my case) fight for who will mount it. Only one of them wins, and the second offendedly swears an error. Moreover, the first one mounts it with the rights only for its user, and the second one does not start up on the flash drive. A rather unpleasant situation that can destroy the whole multiseat venture. We will deal with it.



The option that immediately came to mind is to go down a little lower to the hardware and mount the flash drive before Gnome. I had to read the manuals and consult with Google. And the answer was found. His name is UDEV. UDEV is a device manager that takes care of the maintenance of the device when it appears in the system before the component is used. Also on his conscience, the return path - a neat withdrawal of the device from the system.



But for any drive has its own characteristics. It is necessary not only to mount it, but also to unmount it. And the situation is this - the drive is mounted when a flash drive is attached, and to unmount it, it is necessary to give a command from the user (by right-clicking the mouse → it is safe to disconnect the drive). If the device tag is in the / etc / fstab file, then any user can unmount the device, otherwise only the user with administrative rights can do that. Our plan is as follows: when connecting a flash drive, write the parameter to mount in / etc / fstab, call mount, we get a flash drive. When you click secure device delete, call umount. The basic idea was found in this blog .



UDEV Setup




All UDEV rules are located in the /etc/udev/rules.d folder. The rules start to work in alphabetical order. The name of the rules does not matter. For myself, I created a 40-usbmount.rules file with the following content:



ACTION=="add", KERNEL=="sd[bz][0-9]", RUN+="/bin/mkdir -p /media/%k"

ACTION=="add", KERNEL=="sd[bz][0-9]", RUN+="/bin/sed -i '/\/dev\/%k.*/d' /etc/fstab"

ACTION=="add", KERNEL=="sd[bz][0-9]", RUN+="/bin/sed -i '$a\/dev/%k /media/%k auto rw,noauto,noexec,nodev,noatime,users,iocharset=utf8,uid=1000,gid=100,umask=0, 0 0' /etc/fstab"

ACTION=="add", KERNEL=="sd[az][0-9]", RUN+="/bin/mount /dev/%k"

ACTION=="remove", KERNEL=="sd[bz][0-9]", RUN+="/bin/umount -l /dev/%k"

ACTION=="remove", KERNEL=="sd[bz][0-9]", RUN+="/bin/rmdir /media/%k"

ACTION=="remove", KERNEL=="sd[bz][0-9]", RUN+="/bin/sed -i '/\/dev\/%k.*/d' /etc/fstab"




Let's see what is happening here. Let's look at the first four lines. They are triggered when a device is added (ACTION == "add"), that is, our flash drive (KERNEL == "sd [bz] [0-9]"), and then the RUN + = "command" command is run. The == icon indicates a condition. If true, then the line is executed further, if false, then skipped. I have one hard drive in my system - sda. As most linux users know (I, at least, I think so), disks in linux are indicated by sd [X] [Y], where X is the letter of the Latin alphabet, in order of the disks (a-first, b-second and t .d.), and Y is the partition number of the disk. Therefore, in my case, it is KERNEL == "sd [bz] [0-9]". If you have two hard drives, then you should change the record to the following KERNEL == "sd [s-z] [0-9]". And so on. The commands that follow the RUN + = operator will be discussed a little later.



The last three commands are triggered when the device is disconnected (ACTION == "remove"), whether it is safe extraction or just a pulled flash drive. It works on the same removable drives.



Consider now the commands coming after the operator RUN + =. This statement indicates which applications are used, which should start if all past conditions are true. There is also a small nuance: you must specify the full path to the executable file.

The / bin / mkdir -p / media /% k command creates a folder for further mounting of the drive. % k is a UDEV variable that indicates the name of the device that triggered the rule. That is, when you connect a flash drive, it will be sdb1 (in my case). And when this command is triggered, the folder / media / sdb1 should be created. Create a folder in / media, because in Ubuntu it is so accepted. And we want to make a system with minimal differences.



The following command is / bin / sed -i '/\/dev\/%k.*/d' / etc / fstab. The team already has a little difficulty. It should remove all references to our device from the / etc / fstab file. If suddenly we accidentally turned off the computer with a flash drive in it, then we will have a small problem with the further mounting of flash drives. This line is designed to combat this. Let us analyze it in order. The / bin / sed command is run with the -i switch, which means that you need to edit the file specified at the end of the command (in our case / etc / fstab). '/\/dev\/%k.*/d' — , , /dev/sdb.* ( ) , , .



/bin/sed -i '$a\/dev/%k /media/%k auto rw,noauto,noexec,nodev,noatime,users,iocharset=utf8,uid=1000,gid=100,umask=0, 0 0' /etc/fstab ($a) /etc/fstab. /dev/sdb1 /media/sdb1 auto rw,noauto,noexec,nodev,noatime,users,iocharset=utf8,uid=1000,gid=100,umask=0, 0 0



, sdb1, , .



/bin/mount /dev/%k. . /dev/sdb1 ( ) , /etc/fstab. , . :) .



, , . /bin/umount -l /dev/%k .



-l «» . . , , . .

/bin/rmdir /media/%k , .



/bin/sed -i '/\/dev\/%k.*/d' /etc/fstab fstab. .



. , , USB CD-ROM. - . , , KERNEL==«sd[bz][0-9]» . . , . , , .



UDEV Linux. man udev.



, /etc/fstab.

fstab “ — — — -- dump — ”.

/dev/sdb1 /media/sdb1 auto rw,noauto,noexec,nodev,noatime,users,iocharset=utf8,uid=1000,gid=100,umask=0, 0 0



/dev/sdb1-- , . /media/sdb1-- , .



. Auto , . , Windows : fat ntfs.



:

rw — , .

noauto - this entry will not be perceived by the mount -a command. That is, mount all available devices.

noexec - the permission flag for launching binary files is set to 0. That is, you cannot run binary files directly from this flash drive. You will have to set the start file permission flag.

nodev - says that devices cannot be placed on this file system (folder / dev).

noatime - do not update file access time. According to the description, it should work faster.

users - a regular user can mount this device, not just root.

iocharset = utf8 - file system encoding. The option is typical only for file systems fat and ntfs.

uid = 1000 - user id, whose rights will be distributed to the file. The option is characteristic only for the file systems fat and ntfs

gid = 100 - id of the group, the rights of which will extend to the file. Do not forget to add two or more users to one group so that they can work with a flash drive without any problems, because it is mounted by everyone at once. If users belong to different groups, then one of the groups will not be able to work with a flash drive. The option is typical only for file systems fat and ntfs.

umask = 0 - file access mask. Zero means it remains the default. Learn more about this in Wikipedia .



The penultimate zero means that you do not need to backup the file system with the dump utility. And the last one is that you do not need to check the file system with the fsck utility.



You can learn more about all other mount options using the man fstab and man mount commands in the console.



After we figured out how to mount the flash drive and create a new rule, we need to somehow say something about this UDEV, but how does it know about our changes. To do this, you can type the command udevadm control —reload-rules in the console. Now you can insert a flash drive and look at the result of the work.



Experience of use





That's all about it. Behind the scenes, of course, there are many questions. Let's say I did not solve the problem with the audio system, that is, with the separation of sound from two workplaces into different audio outputs. For half a year of work, this was never necessary for anyone. The computer is still office.



Among the known problems of the system, it should be noted that flash-video is played at double speed, and the standard video playback all plays at double speed. VLC reproduces everything fine.



And now perhaps the most interesting - the experience of using the system. Two users are sitting at this computer. Man and woman.Both of these people are just over 50 years old. They are familiar with computers at the level of a noisy box, in which there are office documents and a pair of office toys. Before that, they used Windows XP. There were no problems with the transition. In total, I spent about an hour consulting these people, this is a total time in a couple of weeks. Most of the questions arose in the first time - still unusual. The man had already figured out on his own how to install his favorite card toys in the application center, and even pleased the woman with toys for her. Although still this person does not really understand how to put the program in Windows. So the system can be called quite user friendly. The internal network uses a normal server (non-shutdown computer :)). The link to it was successfully created in the transition menu, and from there it is already used.The woman really wanted to see the program Consultant +. The program started perfectly through wine.



, . , , , . , , . . , . . , . . ( ) . -, , . , . , . . :).



Of technical problems, nothing was noted. Although, of course, if something breaks, then very few people can fix it. Therefore, such a system is not very recommended to install without a competent system administrator who understands Linux. Although, on the other hand, if everything is set up and taken away from user rights, the system works like a clock. For half a year there were no technical problems caused by users. And, in principle, it should not arise.



Probably the most valuable thing in this system is a significant money saving. And both on components, and on electricity. And given that the computer is office and is turned on for about 9 hours a day (8 workers plus lunch), then the savings on electricity are noticeable. As for the price of components, the system unit with a keyboard and mouse in my case costs $ 407, the monitor is $ 162, that is, the cost of one workplace was $ 569. The second monitor ($ 162), the keyboard ($ 8), the mouse ($ 7) and the video card ($ 48) together cost $ 225, which is 40% of the cost of the first workplace. If we calculate the cost of one workplace, we get $ 397. Somehow not bad for a normal computer. And if in percent, then one job becomes 30% cheaper.



Perhaps I missed some points in the description. Therefore, all the files that are mentioned in the article can be downloaded in full form here .



UPD In the comments an important addition.

Source: https://habr.com/ru/post/112534/



All Articles